Skip to content
Plausible Analytics · Chapter 3 of 14 Day 1: Starting Plausible CE

Day 1: Starting Plausible CE

Goal: Plausible Community Edition runs as a Compose stack, you have created the first user and the site itdrills.com, closed registration and know why docker compose restart ignores a changed .env. · Duration: approx. 60 min · Prerequisite: Day 0

Briefing

  • For the Community Edition, Plausible provides a repo of its own, plausible/community-edition, with compose.yml, ClickHouse configuration and a wiki. Every version is a branch of its own (no Git tags) – you clone the branch v3.2.1.
  • Three services: plausible (the application, Elixir), plausible_db (PostgreSQL 16: users, sites, goals) and plausible_events_db (ClickHouse 24.12: every pageview, every event).
  • Your own values belong in .env and compose.override.yml – the bundled compose.yml stays unchanged, so that an upgrade is just a branch switch (Day 9).
  • Two keys in .env are critical: SECRET_KEY_BASE (sessions, signatures) and TOTP_VAULT_KEY (encrypts the two-factor secrets). Lose them and you lose the logins – Day 8.
  • The Community Edition has no funnels, no revenue goals, no SSO and no Sites API. What it offers in exchange: direct access to the raw data in ClickHouse.
 Browser ──► :8000 plausible (v3.2.1)
                    ├─► plausible_db         PostgreSQL 16    users, sites, goals
                    └─► plausible_events_db  ClickHouse 24.12 events, sessions
 Volumes: ce_db-data  ce_event-data  ce_event-logs  ce_plausible-data

Drill 1: The CE repo

# on argo
cd ~/plausible
git clone -q -b v3.2.1 --single-branch \
  https://github.com/plausible/community-edition ce \
  2>&1 | grep -v detached
cd ce && git log --oneline -1
ls
grep 'image:' compose.yml

Expected:

ec6c4da Update v3.2.1
LICENSE
README.md
clickhouse
compose.yml
    image: postgres:16-alpine
    image: clickhouse/clickhouse-server:24.12-alpine
    image: ghcr.io/plausible/community-edition:v3.2.1

clickhouse/ contains configuration files that make ClickHouse more frugal (fewer system logs, IPv4 only) – Day 9 takes a look inside.

Save your progress? Sign up for free

Drill 2: Your own values

BASE_URL is the address under which browsers reach Plausible – it ends up in the tracking snippet. openssl generates the two keys.

# on argo
cd ~/plausible/ce
cat > .env <<EOF
BASE_URL=http://plausible.lab:8000
SECRET_KEY_BASE=$(openssl rand -base64 48)
TOTP_VAULT_KEY=$(openssl rand -base64 32)
HTTP_PORT=8000
EOF
chmod 600 .env
sed 's/=.*/=…/' .env
cat > compose.override.yml <<'EOF'
services:
  plausible:
    ports:
      - 8000:8000
EOF
docker compose config --services

Expected:

BASE_URL=…
SECRET_KEY_BASE=…
TOTP_VAULT_KEY=…
HTTP_PORT=…
plausible_db
plausible_events_db
plausible

HTTP_PORT is the port inside the container; ports in the override file makes it reachable on the VM. Compose reads compose.yml, compose.override.yml and .env from the current directory automatically.

Warning: .env contains secrets and does not belong in any Git repo. Back it up anyway – without the two keys a restore is worthless (Day 8).

Save your progress? Sign up for free

Drill 3: The start

# on argo
cd ~/plausible/ce
docker compose up -d --quiet-pull 2>&1 | tail -2
until curl -sf http://plausible.lab:8000/api/health >/dev/null; do sleep 5; done
docker compose ps --format '{{.Service}}\t{{.Status}}'
docker stats --no-stream --format '{{.Name}} {{.MemUsage}}' | sed 's/ \/.*//'
curl -s http://plausible.lab:8000/api/health; echo

Expected (times differ):

 Container ce-plausible-1 Starting
 Container ce-plausible-1 Started
plausible   Up 56 seconds
plausible_db    Up About a minute (healthy)
plausible_events_db Up About a minute (healthy)
ce-plausible-1 394.2MiB
ce-plausible_db-1 64.95MiB
ce-plausible_events_db-1 172.7MiB
site 4.773MiB
{"sessions":"ok","postgres":"ok","clickhouse":"ok","sites_cache":"ok"}

plausible waits until both databases are healthy and runs the migrations on startup – that takes a good minute; the until loop waits until /api/health answers. Around 630 MiB for all three – when idle.

Save your progress? Sign up for free

Drill 4: The first user

The first user is created in the browser. On your machine (with the hosts entry from Day 0), open http://plausible.lab:8000/register and enter: name Lab Admin, email [email protected], password lab-plausible-123.

Registering the first user

There is no email confirmation: without an SMTP configuration, ENABLE_EMAIL_VERIFICATION is off. Verify in PostgreSQL:

# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
  -tAc "select id, email, name from users"

Expected:

1|[email protected]|Lab Admin

Save your progress? Sign up for free

Drill 5: The site and the snippet

After registration, Plausible asks for the first site. Enter itdrills.com – without https://, without www. Plausible then shows the snippet for the website’s <head>.

The tracking snippet for itdrills.com

Copy the snippet into a file – you need it on Day 3:

<!-- Privacy-friendly analytics by Plausible -->
<script async src="http://plausible.lab:8000/js/pa--JsuJYgBCST1JOUHGfKkS.js"></script>
<script>
  window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arg…
  plausible.init()
</script>

(abridged)

In this course’s version (v3.2.1), every site has a script of its own, pa-<id>.js. The checkboxes under “Optional measurements” (outbound links, downloads, forms) live in this script, no longer in the snippet.

Verify:

# on argo
cd ~/plausible/ce
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
  -tAc "select id, domain from sites"
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
  -tAc "select id, outbound_links, file_downloads, form_submissions
        from tracker_script_configuration"
ID=$(docker compose exec -T plausible_db psql -U postgres -d plausible_db \
  -tAc "select id from tracker_script_configuration")
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' \
  http://plausible.lab:8000/js/$ID.js

Expected:

1|itdrills.com
pa--JsuJYgBCST1JOUHGfKkS|t|t|t
200 application/javascript

Your ID is a different one – it is generated randomly when the site is created.

Save your progress? Sign up for free

Drill 6: Who may register?

DISABLE_REGISTRATION controls /register. The default is invite_only: Plausible always admits the first user, after that only invited ones. false opens registration to everyone, true closes it completely.

# on argo
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  http://plausible.lab:8000/register

Expected:

302 http://plausible.lab:8000/login

Break it: A colleague should be able to register themselves for one hour. Set the value and – as you are used to – restart.

# on argo
cd ~/plausible/ce
echo "DISABLE_REGISTRATION=false" >> .env
docker compose restart plausible 2>&1 | tail -1
until curl -sf http://plausible.lab:8000/api/health >/dev/null; do sleep 5; done
curl -s -o /dev/null -w '%{http_code}\n' http://plausible.lab:8000/register

Expected:

 Container ce-plausible-1 Started
302

Symptom: Registration stays closed.

Investigate and cause:

# on argo
cd ~/plausible/ce
docker compose exec -T plausible env | grep -c DISABLE_REGISTRATION

Expected:

0

restart restarts the existing container – with the environment it was created with. A changed .env only takes effect when Compose recreates the container.

Fix and verify:

# on argo
cd ~/plausible/ce
docker compose up -d 2>&1 | tail -1
until curl -sf http://plausible.lab:8000/api/health >/dev/null; do sleep 5; done
curl -s -o /dev/null -w '%{http_code}\n' http://plausible.lab:8000/register

Expected:

 Container ce-plausible-1 Started
200

The hour is up: registration closes completely (true) – you invite new colleagues via “People” (roles on Day 7), which then needs invite_only.

# on argo
cd ~/plausible/ce
sed -i 's/^DISABLE_REGISTRATION=.*/DISABLE_REGISTRATION=true/' .env
docker compose up -d 2>&1 | tail -1
until curl -sf http://plausible.lab:8000/api/health >/dev/null; do sleep 5; done
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  http://plausible.lab:8000/register

Expected:

 Container ce-plausible-1 Started
302 http://plausible.lab:8000/login

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Show which ports the three services listen on. Target time: 15 s
  2. Show the stack’s four volumes. Target time: 15 s
  3. Show which Plausible version runs in the container. Target time: 20 s

Solution

# on argo
cd ~/plausible/ce
docker compose ps --format '{{.Service}} {{.Ports}}'
docker volume ls --format '{{.Name}}' | grep '^ce_'
docker compose images plausible --format json | jq -r '.[0].Tag'

Expected:

plausible 0.0.0.0:8000->8000/tcp, [::]:8000->8000/tcp
plausible_db 5432/tcp
plausible_events_db 8123/tcp, 9000/tcp, 9009/tcp
ce_db-data
ce_event-data
ce_event-logs
ce_plausible-data
v3.2.1

Only plausible is reachable from outside; the databases talk only inside the Compose network.

Save your progress? Sign up for free

Checkpoint

# on argo
cd ~/plausible/ce
curl -s http://plausible.lab:8000/api/health; echo
curl -s -o /dev/null -w '%{http_code}\n' http://plausible.lab:8000/register
docker compose exec -T plausible_db psql -U postgres -d plausible_db \
  -tAc "select count(*) from sites"
stat -c '%a' .env

Expected:

{"sessions":"ok","postgres":"ok","clickhouse":"ok","sites_cache":"ok"}
302
1
600

Challenge

A colleague wants to move the stack to port 8001 “real quick”. Change only compose.override.yml so that Plausible is reachable from outside on :8001 – and think about what happens to the snippet then. Restore :8000 afterwards.

Hint: The left side of 8000:8000 is the port on the VM.

Solution

# on argo
cd ~/plausible/ce
sed -i 's/- 8000:8000/- 8001:8000/' compose.override.yml
docker compose up -d 2>&1 | tail -1
until curl -sf http://plausible.lab:8001/api/health >/dev/null; do sleep 5; done
curl -s -o /dev/null -w '%{http_code}\n' http://plausible.lab:8001/api/health
grep BASE_URL .env
sed -i 's/- 8001:8000/- 8000:8000/' compose.override.yml
docker compose up -d 2>&1 | tail -1
until curl -sf http://plausible.lab:8000/api/health >/dev/null; do sleep 5; done

Expected:

 Container ce-plausible-1 Started
200
BASE_URL=http://plausible.lab:8000
 Container ce-plausible-1 Started

Plausible answers on :8001, but BASE_URL – and with it every snippet on every website – still points to :8000. Whoever changes the port has to update BASE_URL and adjust every embedded snippet. That is why Day 4 puts a fixed name without a port in front.

Save your progress? Sign up for free

Cleanup

Nothing. The stack keeps running for all the following days.

Interview Note

  • Which databases does Plausible need and what for? PostgreSQL for accounts, sites and settings, ClickHouse for events and sessions – column-oriented, built for aggregations over millions of rows.
  • Why does a change in .env not take effect after docker compose restart? Restart keeps the container’s configuration; only up -d recreates it.
  • What does the Community Edition lack compared to the cloud? Funnels, revenue goals, SSO, the Sites API and support.

Enterprise Note

  • Never edit compose.yml from the CE repo’s branch, only override it – otherwise every upgrade becomes a merge.
  • Generate .env from a vault (sops, OpenBao) instead of by hand; the two keys are as important as the databases.
  • Registration on invite_only, accounts by invitation; without SMTP there is no password reset – SMTP belongs in production (Day 9).
  • Plausible itself points out on every page that CE is not tested by Plausible – so test upgrades yourself.

Contents

More