Skip to content

Commit

Permalink
feat: Added *LiipMonitorBundle* for health-checking API docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Mar 5, 2024
1 parent d51461e commit 59fcb39
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ ENV APP_FFMPEG_PATH=/usr/bin/ffmpeg
ENV MYSQL_HOST=db
ENV MYSQL_PORT=3306

HEALTHCHECK --start-period=30s --interval=1m --timeout=6s CMD bin/console monitor:health -q

# Added ffmpeg to extract video files thumbnails
RUN apk add --no-cache ffmpeg

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"liip/monitor-bundle": "^2.22",
"nelmio/cors-bundle": "^2.4",
"roadiz/cms-pack": "dev-develop",
"sentry/sentry-symfony": "^4.13",
Expand Down
1 change: 1 addition & 0 deletions composer.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"liip/monitor-bundle": "^2.22",
"nelmio/cors-bundle": "^2.4",
"roadiz/cms-pack": "dev-develop",
"sentry/sentry-symfony": "^4.13",
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
Limenius\LiformBundle\LimeniusLiformBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Rollerworks\Bundle\PasswordCommonListBundle\RollerworksPasswordCommonListBundle::class => ['all' => true],
Liip\MonitorBundle\LiipMonitorBundle::class => ['all' => true],
];
30 changes: 30 additions & 0 deletions config/packages/monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
liip_monitor:
# enabling the controller requires that `assets` are enabled in the framework bundle
enable_controller: false
checks:
groups:
default:
# Checks to see if the disk usage is below warning/critical percent thresholds
disk_usage:
warning: 70
critical: 90
path: '%kernel.cache_dir%'

# Connection name or an array of connection names
doctrine_dbal: [default]

# Checks to see if migrations from specified configuration file are applied
doctrine_migrations:
migrations:
connection: default

# Validate that a Redis service is running
# redis:
# cache_service:
# dsn: '%env(string:REDIS_DSN)%'

# Validate that a messenger transport does not contain more than warning/critical messages
# Transport must implement MessageCountAwareInterface
messenger_transports:
async:
critical_threshold: 10 # required
2 changes: 2 additions & 0 deletions docker/php-fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ENV APP_FFMPEG_PATH=/usr/bin/ffmpeg
ENV MYSQL_HOST=db
ENV MYSQL_PORT=3306

HEALTHCHECK --start-period=30s --interval=1m --timeout=6s CMD bin/console monitor:health -q

RUN apk add --no-cache shadow make git ffmpeg \
&& usermod -u ${USER_UID} www-data \
&& groupmod -g ${USER_UID} www-data \
Expand Down

0 comments on commit 59fcb39

Please sign in to comment.