From 02edc6c5f25bb5ac6163ba48ea121f83b9c8b930 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Wed, 30 Aug 2023 15:11:41 +0100 Subject: [PATCH] Plausible & Clickhouse config. --- services/clickhouse.hcl | 67 +++++++++++++++++++++++++++++++++++++++++ services/plausible.hcl | 51 +++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 services/clickhouse.hcl create mode 100644 services/plausible.hcl diff --git a/services/clickhouse.hcl b/services/clickhouse.hcl new file mode 100644 index 0000000..05d2368 --- /dev/null +++ b/services/clickhouse.hcl @@ -0,0 +1,67 @@ +job "clickhouse" { + datacenters = ["alo"] + + group "db" { + network { + port "clickhouse" { + static = 8123 + } + } + + task "clickhouse" { + driver = "docker" + + config { + image = "clickhouse/clickhouse-server:23.3.7.5-alpine" + volumes = [ + "/data/compute/appdata/clickhouse:/var/lib/clickhouse", + "local/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro", + "local/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro", + ] + ports = [ "clickhouse" ] + } + + service { + name = "clickhouse" + port = "clickhouse" + } + + template { +data = < + + warning + true + + 0.0.0.0 + + + + + + + + + + + +EOH + destination = "local/clickhouse-config.xml" + } + + template { +data = < + + + 0 + 0 + + + +EOH + destination = "local/clickhouse-user-config.xml" + } + } + } +} diff --git a/services/plausible.hcl b/services/plausible.hcl new file mode 100644 index 0000000..02000fb --- /dev/null +++ b/services/plausible.hcl @@ -0,0 +1,51 @@ +job "plausible" { + datacenters = ["alo"] + + group "analytics" { + network { + port "http" { + to = 8000 + } + } + + task "plausible" { + driver = "docker" + + config { + image = "plausible/analytics:v2" + command = "/bin/sh" + args = ["-c", "sleep 10 && /entrypoint.sh db migrate && /entrypoint.sh run"] + ports = [ "http" ] + } + + env { + DATABASE_URL = "postgres://plausible:jooRichahFoQui9eTo5h@postgres.service.consul:5432/plausible_db?ssl=false" + CLICKHOUSE_DATABASE_URL = "http://clickhouse.service.consul:8123/plausible_events_db" + MAILER_EMAIL = "hello@alo.land" + SMTP_HOST_ADDR = "192.168.1.1" + ADMIN_USER_EMAIL = "petru@paler.net" + ADMIN_USER_NAME = "ppetru" + ADMIN_USER_PWD = "bShs7bqzF8e8jWADGScw" + BASE_URL = "https://a.alo.land" + SECRET_KEY_BASE = "K5GOnw7Ozeln/S7wLNbrJw12Dy40kDa2bE2CMKBaGYW/OHdOdSaxj8MrPkvCkULi9" + GOOGLE_CLIENT_ID = "481110282602-9kjrskre00epg9hig5v2qu98qhvnb5ts.apps.googleusercontent.com" + GOOGLE_CLIENT_SECRET = "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" + } + + service { + name = "plausible" + port = "http" + tags = [ + "traefik.enable=true", + "traefik.http.routers.plausible.entryPoints=websecure", + "traefik.http.routers.plausible.rule=Host(`a.alo.land`)", + ] + } + + resources { + cpu = 1000 + memory = 512 + } + } + } +}