version: '2.4'

networks:
  gateway_default:
    external: true
services:
  grafana:
    image: grafana/grafana
    user: "0"
    container_name: graf
    volumes:
      - /mnt/grafana-data:/var/lib/grafana
      - ./datasources:/etc/grafana/datasources
      - ./dashboards:/etc/grafana/dashboards
      - ./setup.sh:/setup.sh
    entrypoint: /setup.sh
    environment:
      - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
      - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-lovewifi!}
      - GF_USERS_ALLOW_SIGN_UP=false
      - VIRTUAL_PORT=3000
      - VIRTUAL_HOST=grafana.home.toozhao.com
      - LETSENCRYPT_HOST=grafana.home.toozhao.com
      - LETSENCRYPT_EMAIL=me@toozhao.com
    restart: unless-stopped
    networks:
      - gateway_default
