Skip to content

Instantly share code, notes, and snippets.

@jmarceli
Last active April 27, 2022 13:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmarceli/88390c37d20d2d0426e96df448e3c04c to your computer and use it in GitHub Desktop.
Save jmarceli/88390c37d20d2d0426e96df448e3c04c to your computer and use it in GitHub Desktop.
Grafana and InfluxDB with Let's Encrypt SSL on Docker https://grzegorowski.com/grafana-with-lets-encrypt-ssl-on-docker/
version: '2'
services:
grafana:
image: grafana/grafana:5.0.0 # or probably any other version
container_name: grafana
restart: always
environment:
- VIRTUAL_HOST=YOUR.DOMAIN.TEST # adjust to match your domain name
- VIRTUAL_PROTO=https
- VIRTUAL_PORT=3000
- LETSENCRYPT_HOST=YOUR.DOMAIN.TEST # adjust to match your domain name
- LETSENCRYPT_EMAIL=YOUR.EMAIL@ADDRESS.TEST # adjust to match your email
- GF_SERVER_CERT_FILE=/etc/letsencrypt/certs/YOUR.DOMAIN.TEST.crt # adjust to match your domain name
- GF_SERVER_CERT_KEY=/etc/letsencrypt/certs/YOUR.DOMAIN.TEST.key # adjust to match your domain name
- GF_SERVER_PROTOCOL=https
- GF_SERVER_DOMAIN=YOUR.DOMAIN.TEST # adjust to match your domain name
- GF_SECURITY_ADMIN_USER=SECURE_USERNAME # adjust to create Grafana admin account
- GF_SECURITY_ADMIN_PASSWORD=SECURE_PASS # adjust to set Grafana admin password
volumes:
- ./letsencrypt/certs:/etc/letsencrypt/certs:ro
- grafana-data:/var/lib/grafana
influx:
image: influxdb:1.4.2 # or any other recent version
container_name: influx
restart: always
volumes:
- influx-data:/var/lib/influxdb
- ./letsencrypt/certs:/etc/letsencrypt/certs:ro
ports:
- "8086:8086"
environment:
# might be used someday when issue #59 will be resolved/merged
#- VIRTUAL_HOST=YOUR.DOMAIN.TEST:8086
#- VIRTUAL_PROTO=https
#- VIRTUAL_PORT=8086
- INFLUXDB_HTTP_HTTPS_ENABLED=true
- INFLUXDB_HTTP_HTTPS_CERTIFICATE=/etc/letsencrypt/certs/YOUR.DOMAIN.TEST.crt # adjust to match your domain name
- INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/etc/letsencrypt/certs/YOUR.DOMAIN.TEST.key # adjust to match your domain name
- INFLUXDB_DB=SOME_DB_NAME # set any other to create database on initialization
- INFLUXDB_HTTP_ENABLED=true
- INFLUXDB_HTTP_AUTH_ENABLED=true
- INFLUXDB_ADMIN_USER=SECURE_USERNAME # adjust to create InfluxDB admin account
- INFLUXDB_ADMIN_PASSWORD=SECURE_PASS # adjust to create InfluxDB admin password
# Containers below ensures automatic cert creation and renewal
nginx:
image: jwilder/nginx-proxy:0.6.0
container_name: nginx
restart: always
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx/html:/usr/share/nginx/html
- ./nginx/vhost.d:/etc/nginx/vhost.d
- ./letsencrypt/certs:/etc/nginx/certs:ro
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.7
container_name: letsencrypt
restart: always
volumes_from:
- nginx
volumes:
- ./letsencrypt/certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
influx-data:
driver: local
grafana-data:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment