Plausible & Clickhouse config.

This commit is contained in:
2023-08-30 15:11:41 +01:00
parent 6b3b9ee65b
commit 02edc6c5f2
2 changed files with 118 additions and 0 deletions

67
services/clickhouse.hcl Normal file
View File

@@ -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 = <<EOH
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<listen_host>0.0.0.0</listen_host>
<!-- Stop all the unnecessary logging -->
<query_thread_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<part_log remove="remove"/>
</clickhouse>
EOH
destination = "local/clickhouse-config.xml"
}
template {
data = <<EOH
<clickhouse>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
</default>
</profiles>
</clickhouse>
EOH
destination = "local/clickhouse-user-config.xml"
}
}
}
}

51
services/plausible.hcl Normal file
View File

@@ -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
}
}
}
}