Ghost/.github/scripts/docker-compose.yml
Chris Raible 190ebcd684
Added ability to push prometheus metrics to a pushgateway (#21526)
ref
https://linear.app/ghost/issue/ENG-1746/enable-ghost-to-push-metrics-to-a-pushgateway

- We'd like to use prometheus to expose metrics from Ghost, but the
"standard" approach of having prometheus scrape the `/metrics` endpoint
adds some complexity and additional challenges on Pro.
- A suggested simpler alternative is to use a pushgateway, to have Ghost
_push_ metrics to prometheus, rather than have prometheus scrape the
running instances.
- This PR introduces this functionality behind a configuration. 
- It also includes a refactor to the current metrics-server
implementation so all the related code for prometheus is colocated, and
the configuration is a bit more organized. `@tryghost/metrics-server`
has been renamed to `@tryghost/prometheus-metrics`, and it now includes
the metrics server and prometheus-client code itself (including the
pushgateway code)
- To enable the prometheus client alone, `prometheus:enabled` must be
true. This will _not_ enable the metrics server or the pushgateway — it
will essentially collect the metrics, but not do anything with them.
- To enable the metrics server, set `prometheus:metrics_server:enabled`
to true. You can also configure the host and port that the metrics
server should export the `/metrics` endpoint on in the
`prometheus:metrics_server` block.
- To enable the pushgateway, set `prometheus:pushgateway:enabled` to
true. You can also configure the pushgateway's `url`, the `interval` it
should push metrics in (in milliseconds) and the `jobName` in the
`prometheus:pushgateway` block.
2024-11-05 11:50:39 -08:00

59 lines
1.7 KiB
YAML

name: ghost
services:
mysql:
image: mysql:8.0.35
container_name: ghost-mysql
# We'll need to look into how we can further fine tune the memory usage/performance here
command: --innodb-buffer-pool-size=1G --innodb-log-buffer-size=500M --innodb-change-buffer-max-size=50 --innodb-flush-log-at-trx_commit=0 --innodb-flush-method=O_DIRECT
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ghost
restart: always
volumes:
# Turns out you can drop .sql or .sql.gz files in here, cool!
- ./mysql-preload:/docker-entrypoint-initdb.d
- mysql-data:/var/lib/mysql
healthcheck:
test: "mysql -uroot -proot ghost -e 'select 1'"
interval: 1s
retries: 120
redis:
image: redis:7.0
container_name: ghost-redis
ports:
- "6379:6379"
restart: always
prometheus:
profiles: [monitoring]
image: prom/prometheus:v2.30.3
container_name: ghost-prometheus
ports:
- "9090:9090"
restart: always
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
grafana:
profiles: [monitoring]
image: grafana/grafana:8.2.3
container_name: ghost-grafana
ports:
- "3000:3000"
restart: always
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
volumes:
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- ./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/main.yaml
- ./grafana/dashboards:/var/lib/grafana/dashboards
pushgateway:
profiles: [monitoring]
image: prom/pushgateway:v1.6.0
container_name: ghost-pushgateway
ports:
- "9091:9091"
volumes:
mysql-data: