From 1705a4bc7970540e286d8220fbf551799c11cd0a Mon Sep 17 00:00:00 2001 From: moeny-matt Date: Tue, 12 Nov 2024 16:31:22 -0500 Subject: [PATCH] Basic setup --- .gitignore | 2 + README.md | 9 ++++- compose.override.yml | 5 +++ compose.yml | 90 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 compose.override.yml create mode 100644 compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c842e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 88980de..2482ff0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ -# plausible +# Plausible +## Self-host [Plausible Community Edition](https://plausible.io/blog/community-edition) with Docker + +1. [Install Docker](https://docs.docker.com/engine/install/ubuntu/) + +2. [Manage Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) + +3. Follow the [quick start guide](https://github.com/plausible/community-edition/?tab=readme-ov-file) \ No newline at end of file diff --git a/compose.override.yml b/compose.override.yml new file mode 100644 index 0000000..0096091 --- /dev/null +++ b/compose.override.yml @@ -0,0 +1,5 @@ +services: + plausible: + ports: + - 80:80 + - 443:443 \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..c5011c0 --- /dev/null +++ b/compose.yml @@ -0,0 +1,90 @@ +services: + plausible_db: + image: postgres:16-alpine + restart: always + volumes: + - db-data:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + start_period: 1m + + plausible_events_db: + image: clickhouse/clickhouse-server:24.3.3.102-alpine + restart: always + volumes: + - event-data:/var/lib/clickhouse + - event-logs:/var/log/clickhouse-server + - ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro + # This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default. + # Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings. + - ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro + ulimits: + nofile: + soft: 262144 + hard: 262144 + healthcheck: + test: ["CMD-SHELL", "wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1"] + start_period: 1m + + plausible: + image: ghcr.io/plausible/community-edition:v2.1.4 + restart: always + command: sh -c "/entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" + depends_on: + plausible_db: + condition: service_healthy + plausible_events_db: + condition: service_healthy + volumes: + - plausible-data:/var/lib/plausible + ulimits: + nofile: + soft: 65535 + hard: 65535 + environment: + - TMPDIR=/var/lib/plausible/tmp + # required: https://github.com/plausible/community-edition/wiki/configuration#required + - BASE_URL=${BASE_URL} + - SECRET_KEY_BASE=${SECRET_KEY_BASE} + # optional: https://github.com/plausible/community-edition/wiki/configuration#optional + # registration: https://github.com/plausible/community-edition/wiki/configuration#registration + - TOTP_VAULT_KEY + - DISABLE_REGISTRATION + - ENABLE_EMAIL_VERIFICATION + # web: https://github.com/plausible/community-edition/wiki/configuration#web + - HTTP_PORT + - HTTPS_PORT + # databases: https://github.com/plausible/community-edition/wiki/configuration#database + - DATABASE_URL + - CLICKHOUSE_DATABASE_URL + # Google: https://github.com/plausible/community-edition/wiki/configuration#google + - GOOGLE_CLIENT_ID + - GOOGLE_CLIENT_SECRET + # geolocation: https://github.com/plausible/community-edition/wiki/configuration#ip-geolocation + - IP_GEOLOCATION_DB + - GEONAMES_SOURCE_FILE + - MAXMIND_LICENSE_KEY + - MAXMIND_EDITION + # email: https://github.com/plausible/community-edition/wiki/configuration#email + - MAILER_ADAPTER + - MAILER_EMAIL + - MAILER_NAME + - SMTP_HOST_ADDR + - SMTP_HOST_PORT + - SMTP_USER_NAME + - SMTP_USER_PWD + - SMTP_HOST_SSL_ENABLED + - POSTMARK_API_KEY + - MAILGUN_API_KEY + - MAILGUN_DOMAIN + - MAILGUN_BASE_URI + - MANDRILL_API_KEY + - SENDGRID_API_KEY + +volumes: + db-data: + event-data: + event-logs: + plausible-data: \ No newline at end of file