Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP-FPM dashboard #168

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# dev|prod
APP_ENVIRONMENT=dev
APP_KERNEL_SECRET=ThisTokenIsNotSoSecretChangeIt
APP_TRUSTED_PROXIES=
APP_METRICS_ALLOWED_IPS=0.0.0.0/0
APP_WAIT_FOR=unix:///var/run/proxysql/proxysql.sock,mysql:3306,redis:6379,rabbit-mq:5672,nchan:81
APP_RABBIT_MQ_DSN=amqp://guest:guest@rabbit-mq:5672?heartbeat=60&prefetchCount=30

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"ext-pcntl": "*",
"ext-posix": "*",
"ext-session": "*",
"artprima/prometheus-metrics-bundle": "^1.17",
"doctrine/dbal": "^3.3",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
Expand Down
134 changes: 133 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ imports:

framework:
secret: '%env(APP_KERNEL_SECRET)%'
trusted_proxies: '%env(APP_TRUSTED_PROXIES)%'
validation:
enabled: true
router:
Expand All @@ -29,6 +30,15 @@ monolog:
twig:
strict_variables: '%kernel.debug%'

artprima_prometheus_metrics:
namespace: app
ignored_routes: [metrics]
storage:
type: apcng
disable_default_metrics: false
disable_default_promphp_metrics: false
enable_console_metrics: false

services:

gaming.schedule-doctrine-connection-heartbeat-middleware:
Expand Down
4 changes: 4 additions & 0 deletions config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
WebInterface:
resource: web-interface/routing.yml

metrics:
path: /metrics
controller: Artprima\PrometheusMetricsBundle\Controller\MetricsController::prometheus
6 changes: 6 additions & 0 deletions config/web-interface/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ security:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
metrics:
pattern: ^/metrics
stateless: true
main:
pattern: ^/
custom_authenticators:
- 'web-interface.security.arrival_authenticator'
access_control:
- { path: '^/metrics', roles: PUBLIC_ACCESS, ips: ['%env(APP_METRICS_ALLOWED_IPS)%'] }
- { path: '^/metrics', roles: ROLE_NO_ACCESS }
3 changes: 3 additions & 0 deletions deploy/single-server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ x-php-container:
environment:
APP_ENVIRONMENT: "prod"
APP_KERNEL_SECRET: "ThisTokenIsNotSoSecretChangeIt"
APP_TRUSTED_PROXIES: ""
APP_METRICS_ALLOWED_IPS: "0.0.0.0/0"
APP_WAIT_FOR: "unix:///var/run/proxysql/proxysql.sock,mysql:3306,redis:6379,rabbit-mq:5672,nchan:81"
APP_RABBIT_MQ_DSN: "amqp://guest:guest@rabbit-mq:5672?heartbeat=60&prefetchCount=30"
APP_CHAT_DOCTRINE_DBAL_URL: "mysqli://root:password@localhost/chat?persistent=1&unix_socket=/var/run/proxysql/proxysql.sock"
Expand Down Expand Up @@ -167,6 +169,7 @@ services:
- "traefik.http.routers.web-interface-http.priority=10"
- "traefik.http.routers.web-interface-http.rule=PathPrefix(`/`)"
- "traefik.http.services.web-interface-http.loadbalancer.server.port=80"
- "prometheus-job=php-fpm"
connect-four-follow-event-store:
<<: *php-container
command: bin/console connect-four:follow-event-store pointer --select-all-subscribers
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ services:
- "traefik.http.routers.php-fpm.priority=10"
- "traefik.http.routers.php-fpm.rule=PathPrefix(`/`)"
- "traefik.http.services.php-fpm.loadbalancer.server.port=80"
- "prometheus-job=php-fpm"

##############################
# Long running processes #
Expand Down
Loading