Add matomo container

This commit is contained in:
Alejandro Celaya 2023-06-04 12:40:10 +02:00
parent 36e2a9387d
commit b4386a3508
3 changed files with 58 additions and 30 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ vendor/
data/database.sqlite data/database.sqlite
data/shlink-tests.db data/shlink-tests.db
data/GeoLite2-City.* data/GeoLite2-City.*
data/infra/matomo
docs/swagger-ui* docs/swagger-ui*
docs/mercure.html docs/mercure.html
docker-compose.override.yml docker-compose.override.yml

View File

@ -22,7 +22,8 @@ use const PHP_SAPI;
$isTestEnv = env('APP_ENV') === 'test'; $isTestEnv = env('APP_ENV') === 'test';
$enableSwoole = PHP_SAPI === 'cli' && openswooleIsInstalled() && ! runningInRoadRunner(); $enableSwoole = PHP_SAPI === 'cli' && openswooleIsInstalled() && ! runningInRoadRunner();
return (new ConfigAggregator\ConfigAggregator([ return (new ConfigAggregator\ConfigAggregator(
providers: [
! $isTestEnv ! $isTestEnv
? new EnvVarLoaderProvider('config/params/generated_config.php', enumValues(Core\Config\EnvVars::class)) ? new EnvVarLoaderProvider('config/params/generated_config.php', enumValues(Core\Config\EnvVars::class))
: new ConfigAggregator\ArrayProvider([]), : new ConfigAggregator\ArrayProvider([]),
@ -44,11 +45,16 @@ return (new ConfigAggregator\ConfigAggregator([
Rest\ConfigProvider::class, Rest\ConfigProvider::class,
new ConfigAggregator\PhpFileProvider('config/autoload/{,*.}global.php'), new ConfigAggregator\PhpFileProvider('config/autoload/{,*.}global.php'),
// Local config should not be loaded during tests, whereas test config should be loaded ONLY during tests // Local config should not be loaded during tests, whereas test config should be loaded ONLY during tests
new ConfigAggregator\PhpFileProvider($isTestEnv ? 'config/test/*.global.php' : 'config/autoload/{,*.}local.php'), new ConfigAggregator\PhpFileProvider(
$isTestEnv ? 'config/test/*.global.php' : 'config/autoload/{,*.}local.php',
),
// Routes have to be loaded last // Routes have to be loaded last
new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'), new ConfigAggregator\PhpFileProvider('config/autoload/routes.config.php'),
], 'data/cache/app_config.php', [ ],
cachedConfigFile: 'data/cache/app_config.php',
postProcessors: [
Core\Config\PostProcessor\BasePathPrefixer::class, Core\Config\PostProcessor\BasePathPrefixer::class,
Core\Config\PostProcessor\MultiSegmentSlugProcessor::class, Core\Config\PostProcessor\MultiSegmentSlugProcessor::class,
Core\Config\PostProcessor\ShortUrlMethodsProcessor::class, Core\Config\PostProcessor\ShortUrlMethodsProcessor::class,
]))->getMergedConfig(); ],
))->getMergedConfig();

View File

@ -33,6 +33,7 @@ services:
- shlink_mercure - shlink_mercure
- shlink_mercure_proxy - shlink_mercure_proxy
- shlink_rabbitmq - shlink_rabbitmq
- shlink_matomo
environment: environment:
LC_ALL: C LC_ALL: C
extra_hosts: extra_hosts:
@ -70,6 +71,7 @@ services:
- shlink_mercure - shlink_mercure
- shlink_mercure_proxy - shlink_mercure_proxy
- shlink_rabbitmq - shlink_rabbitmq
- shlink_matomo
environment: environment:
LC_ALL: C LC_ALL: C
extra_hosts: extra_hosts:
@ -95,6 +97,7 @@ services:
- shlink_mercure - shlink_mercure
- shlink_mercure_proxy - shlink_mercure_proxy
- shlink_rabbitmq - shlink_rabbitmq
- shlink_matomo
environment: environment:
LC_ALL: C LC_ALL: C
extra_hosts: extra_hosts:
@ -201,3 +204,21 @@ services:
- "8005:8080" - "8005:8080"
volumes: volumes:
- ./docs/swagger:/app - ./docs/swagger:/app
shlink_matomo:
container_name: shlink_matomo
image: matomo:4.14-apache
ports:
- "8003:80"
volumes:
# Matomo does not persist port in trusted hosts. This is needed to edit config afterwards
# https://github.com/matomo-org/matomo/issues/9549
- ./data/infra/matomo:/var/www/html
links:
- shlink_db_mysql
environment:
MATOMO_DATABASE_HOST: "shlink_db_mysql"
MATOMO_DATABASE_ADAPTER: "mysql"
MATOMO_DATABASE_DBNAME: "matomo"
MATOMO_DATABASE_USERNAME: "root"
MATOMO_DATABASE_PASSWORD: "root"