Last active
January 31, 2023 10:14
-
-
Save kamontat/37d40e28fb5aab55a0a13382ca1a0ab9 to your computer and use it in GitHub Desktop.
for article `setup-freqtrade-with-grafana`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
# persistant grafana and prometheus data | |
# to get more detail you can run `docker volume --help` | |
volumes: | |
grafana-data: | |
prometheus-data: | |
services: | |
freqtrade: | |
image: freqtradeorg/freqtrade:develop_plot | |
container_name: freqtrade | |
restart: on-failure | |
ports: | |
- 8080:8080 | |
volumes: | |
- ./user_data:/freqtrade/user_data | |
command: > | |
trade | |
--logfile "/freqtrade/user_data/logs/freqtrade.log" | |
--config "/freqtrade/user_data/config.json" | |
healthcheck: | |
test: ["CMD-SHELL", "python3 /freqtrade/scripts/rest_client.py --config /freqtrade/user_data/config.json ping | grep -q pong"] | |
interval: 30s | |
timeout: 4s | |
retries: 3 | |
start_period: 1m | |
ftmetric: | |
# TODO: recommend to specify version `ghcr.io/kamontat/ftmetric:vX.X.X` | |
image: ghcr.io/kamontat/ftmetric | |
container_name: ftmetric | |
restart: on-failure | |
environment: | |
- FTH_FREQTRADE__URL=http://freqtrade:8080 | |
# TODO: make it secure | |
- FTH_FREQTRADE__USERNAME=freqtrader | |
- FTH_FREQTRADE__PASSWORD=verysecretpassword | |
depends_on: | |
- freqtrade | |
healthcheck: | |
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/version"] | |
interval: 1m | |
timeout: 1s | |
retries: 3 | |
start_period: 15s | |
prometheus: | |
image: prom/prometheus:v2.28.0 | |
restart: on-failure | |
# be aware before open the port | |
# ports: | |
# - 9090:9090 | |
volumes: | |
# TODO: add configuration at prometheus/prometheus.yml | |
# - ./prometheus:/etc/prometheus/ | |
- prometheus-data:/prometheus | |
command: | |
- "--config.file=/etc/prometheus/prometheus.yml" | |
extra_hosts: | |
- "host.docker.internal:host-gateway" | |
healthcheck: | |
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"] | |
interval: 1m | |
timeout: 1s | |
retries: 3 | |
start_period: 15s | |
grafana: | |
image: grafana/grafana:8.0.3 | |
container_name: grafana | |
restart: on-failure | |
ports: | |
- 3000:3000 | |
depends_on: | |
- freqtrade | |
- prometheus | |
volumes: | |
- prometheus-data:/prometheus | |
environment: | |
## override server url | |
# - GF_SERVER_ROOT_URL=http://example.com | |
- GF_SERVER_HTTP_PORT=3000 | |
## enabled grafana beta alert manager | |
# - GF_FEATURE_TOGGLES_ENABLE=ngalert | |
- GF_SECURITY_ADMIN_USER=admin | |
- GF_SECURITY_ADMIN_PASSWORD=verygrafanapassword | |
healthcheck: | |
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"] | |
interval: 1m | |
timeout: 1s | |
retries: 3 | |
start_period: 15s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment