From 83cac35966c9ad95de9e93ab10e168a2c2e47d25 Mon Sep 17 00:00:00 2001 From: MoryCorp Date: Fri, 30 Oct 2020 00:40:18 +0100 Subject: [PATCH] Add configuration for GeopIP and facilitate env files usage --- docker-compose.yml | 45 ++++++++++++++++---- geoip/geoip.conf => env/geopip.env | 0 plausible-conf.env => env/plausible-conf.env | 0 geoip/docker-compose.geoip.yml | 21 --------- 4 files changed, 36 insertions(+), 30 deletions(-) rename geoip/geoip.conf => env/geopip.env (100%) rename plausible-conf.env => env/plausible-conf.env (100%) delete mode 100644 geoip/docker-compose.geoip.yml diff --git a/docker-compose.yml b/docker-compose.yml index cad7a67..5dd107e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,15 @@ services: mail: image: bytemark/smtp restart: always + + geoip: + image: maxmindinc/geoipupdate + environment: + - GEOIPUPDATE_EDITION_IDS=GeoLite2-Country + - GEOIPUPDATE_FREQUENCY=168 # update every 7 days + env_file: env/geoip-conf.env + volumes: + - geoip:/usr/share/GeoIP plausible_db: image: postgres:12 @@ -10,6 +19,9 @@ services: - db-data:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=postgres + networks: + - internal + restart: always plausible_events_db: image: yandex/clickhouse-server:latest @@ -19,24 +31,33 @@ services: nofile: soft: 262144 hard: 262144 + networks: + - internal + restart: always plausible: image: plausible/analytics:latest command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run" depends_on: + - mail + - geoip - plausible_db - plausible_events_db - - mail - ports: - - 80:8000 #Remove this line if you plan to use Traefik env_file: - - plausible-conf.env + - env/plausible-conf.env + networks: + - internal + - web + environment: + - GEOLITE2_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb + volumes: + - geoip:/geoip:ro + restart: always labels: - # Uncomment line below if you plan to use Traefik - # - "traefik.enable=true" - # - "traefik.http.routers.plausible.rule=Host(`yourdomain.com`)" # replace this with your own domain - # - "traefik.http.routers.plausible.entrypoints=websecure" - # - "traefik.http.services.plausible.loadbalancer.server.port=8000" + - "traefik.enable=true" + - "traefik.http.routers.plausible.rule=Host(`yourdomain.com`)" # replace this with your own domain + - "traefik.http.routers.plausible.entrypoints=websecure" + - "traefik.http.services.plausible.loadbalancer.server.port=8000" volumes: db-data: @@ -45,3 +66,9 @@ volumes: driver: local geoip: driver: local + +networks: + web: + external: true + internal: + external: false diff --git a/geoip/geoip.conf b/env/geopip.env similarity index 100% rename from geoip/geoip.conf rename to env/geopip.env diff --git a/plausible-conf.env b/env/plausible-conf.env similarity index 100% rename from plausible-conf.env rename to env/plausible-conf.env diff --git a/geoip/docker-compose.geoip.yml b/geoip/docker-compose.geoip.yml deleted file mode 100644 index 239577c..0000000 --- a/geoip/docker-compose.geoip.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "3.3" -services: - plausible: - depends_on: - - geoip - environment: - - GEOLITE2_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb - - geoip: - image: maxmindinc/geoipupdate - environment: - - GEOIPUPDATE_EDITION_IDS=GeoLite2-Country - - GEOIPUPDATE_FREQUENCY=168 # update every 7 days - env_file: - geoip/geoip.conf - volumes: - - geoip:/usr/share/GeoIP - -volumes: - geoip: - driver: local