Post

Plausible Analytics

Plausible Analytics is an open source, simple, lightweight and privacy-friendly Google Analytics alternative. One aspect that makes Plausible different from many of the other web analytics tools such as Google Analytics is the fact that Plausible is fully open-source software.

Plausible Demo

Plausible Docs

Create docker-compose.yml file for running the containers for Plausible.

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
version: "3.3"
services:
  mail:
    image: bytemark/smtp
    container_name: mail
    restart: always
    networks:
      - proxy

  plausible_db:
    image: postgres:14-alpine
    container_name: postgres
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
    networks:
      - proxy


  plausible_events_db:
    image: clickhouse/clickhouse-server:22.6-alpine
    container_name: plausible_events
    restart: always
    deploy:
        resources:
            limits:
              cpus: "0.75"
              memory: 1G
            reservations:
              cpus: "0.25"
              memory: 512M
    volumes:
      - event-data:/var/lib/clickhouse
      - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
      - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    networks:
      - proxy

  plausible:
    image: plausible/analytics:latest
    container_name: plausible
    restart: always
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
    deploy:
        resources:
            limits:
              cpus: "0.50"
              memory: 512M
            reservations:
              cpus: "0.25"
              memory: 128M
    depends_on:
      - plausible_db
      - plausible_events_db
      - mail
    ports:
      - 8000:8000
    env_file:
      - plausible-conf.env
    networks:
      - proxy

volumes:
  db-data:
    driver: local
  event-data:
    driver: local

networks:
  proxy:
    external: true

Run the commands to create a secret key and the plausible-conf.env file.

1
2
3
4
5
cat <<EOF >>./plausible-conf.env
BASE_URL=https://<your-domain>
SECRET_KEY_BASE=$(openssl rand -base64 64 | tr -d '\n')
#DISABLE_REGISTRATION=invite_only
EOF
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.