Skip to content

Commit 60d6815

Browse files
committed
v2.1.2
1 parent 4e949e8 commit 60d6815

File tree

3 files changed

+43
-73
lines changed

3 files changed

+43
-73
lines changed

README.md

+29-67
Original file line numberDiff line numberDiff line change
@@ -70,107 +70,87 @@ Right now the latter looks like this:
7070
```env
7171
BASE_URL=replace-me
7272
SECRET_KEY_BASE=replace-me
73-
TOTP_VAULT_KEY=replace-me
73+
HTTP_PORT=8000
74+
HTTPS_PORT=8001
7475
```
7576

7677
Let's do as it asks and populate these required environment variables with our own values.
7778

7879
#### Required configuration
7980

80-
First we generate the [secret key base](#secret_key_base) and [TOTP vault key](#totp_vault_key) using OpenSSL:
81+
First we generate the [secret key base](#secret_key_base) using OpenSSL:
8182

8283
<sub><kbd>console</kbd></sub>
8384
```console
8485
$ openssl rand -base64 48
8586
GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz
86-
$ openssl rand -base64 32
87-
dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=
8887
```
8988

9089
And then we decide on the [base URL](#base_url) where the instance would be accessible:
9190

9291
<sub><kbd>plausible-conf.env</kbd></sub>
9392
```diff
9493
- BASE_URL=replace-me
95-
+ BASE_URL=http://plausible.example.com
94+
+ BASE_URL=https://plausible.example.com
9695
- SECRET_KEY_BASE=replace-me
9796
+ SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz
98-
- TOTP_VAULT_KEY=replace-me
99-
+ TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=
97+
HTTP_PORT=8000
98+
HTTPS_PORT=8001
10099
```
101100

102-
We can start our instance now but the requests would be served over HTTP. Not cool! Let's configure [Caddy](https://caddyserver.com) to enable HTTPS.
101+
We can start our instance now.
103102

104-
#### Caddy
105-
106-
> [!TIP]
107-
> For other reverse-proxy setups please see [reverse-proxy](./reverse-proxy) docs.
103+
#### Reverse proxy
108104

109105
<details>
110-
<summary>Don't need reverse proxy?</summary>
106+
<summary>Using a reverse proxy?</summary>
111107

112108
---
113109

114-
If you're **opting out** of a reverse proxy and HTTPS, you'll need to adjust the Plausible service [configuration](./docker-compose.yml#L38) to ensure it's not limited to localhost (127.0.0.1). This change allows the service to be accessible from any network interface:
110+
> [!TIP]
111+
> Please see [reverse-proxy](./reverse-proxy) docs for some reverse-proxy setups.
112+
113+
If you're using a reverse proxy, you'll might want to adjust the Plausible service [configuration](./docker-compose.yml#L38) to ensure it's limited to localhost (127.0.0.1).
115114

116115
<sub><kbd>[docker-compose.yml](./docker-compose.yml#L38)</kbd></sub>
117116
```diff
118117
plausible:
119118
ports:
120-
- - 127.0.0.1:8000:8000
121-
+ - 8000:8000
119+
- - 8000:8000
120+
+ - 127.0.0.1:8000:8000
122121
```
123122

124-
---
125-
126-
</details>
127-
128-
First we need to point DNS records for our base URL to the IP address of the instance. This is needed for Caddy to issue the TLS certificates.
129-
130-
Then we need to let Caddy know the domain name for which to issue the TLS certificate and the service to redirect the requests to.
131-
132-
<sub><kbd>[reverse-proxy/docker-compose.caddy-gen.yml](./reverse-proxy/docker-compose.caddy-gen.yml)</kbd></sub>
133-
```diff
134-
plausible:
135-
labels:
136-
- virtual.host: "example.com" # change to your domain name
137-
+ virtual.host: "plausible.example.com"
138-
virtual.port: "8000"
139-
- virtual.tls-email: "[email protected]" # change to your email
140-
+ virtual.tls-email: "[email protected]"
141-
```
142-
143-
Finally we need to update the base URL to use HTTPS scheme.
123+
You also need to disable automatic certificate issuance by removing `HTTPS_PORT` from ENV.
144124

145125
<sub><kbd>plausible-conf.env</kbd></sub>
146126
```diff
147-
- BASE_URL=http://plausible.example.com
148-
+ BASE_URL=https://plausible.example.com
127+
BASE_URL=https://plausible.example.com
149128
SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz
150-
TOTP_VAULT_KEY=dsxvbn3jxDd16az2QpsX5B8O+llxjQ2SJE2i5Bzx38I=
129+
HTTP_PORT=8000
130+
- HTTPS_PORT=8001
151131
```
152132

153-
Now we can start everything together.
133+
---
134+
135+
</details>
154136

155137
#### Launch
156138

157139
<sub><kbd>console</kbd></sub>
158140
```console
159-
$ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up -d
141+
$ docker compose up -d
160142
[+] Running 19/19
161143
✔ plausible_db 9 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled
162144
✔ plausible_events_db 7 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled
163145
✔ plausible 7 layers [⣿⣿⣿⣿⣿⣿⣿] Pulled
164-
✔ caddy-gen 8 layers [⣿⣿⣿⣿⣿⣿⣿⣿] Pulled
165-
[+] Running 5/5
146+
[+] Running 4/4
166147
✔ Network hosting_default Created
167148
✔ Container hosting-plausible_db-1 Started
168149
✔ Container hosting-plausible_events_db-1 Started
169150
✔ Container hosting-plausible-1 Started
170-
✔ Container caddy-gen Started
171151
```
172152

173-
It takes some time to start PostgreSQL and ClickHouse, create the databases, and run the migrations. After about fifteen seconds you should be able to access your instance at the base URL and see the registration screen for the admin user.
153+
It takes some time to start PostgreSQL and ClickHouse, create the databases, run the migrations, and issue a TLS certificate. After about fifteen seconds you should be able to access your instance at the base URL and see the registration screen for the admin user.
174154

175155
> [!TIP]
176156
> If something feels off, make sure to check out the logs with <kbd>docker compose logs</kbd> and start a [GitHub discussion.](https://github.com/plausible/analytics/discussions/categories/self-hosted-support)
@@ -208,7 +188,7 @@ $ docker compose rm plausible
208188
? Going to remove hosting-plausible-1 Yes
209189
[+] Running 1/0
210190
✔ Container hosting-plausible-1 Removed
211-
$ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up -d
191+
$ docker compose up -d
212192
[+] Running 8/8
213193
✔ plausible 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 6.4s
214194
✔ 96526aa774ef Pull complete 0.4s
@@ -218,11 +198,10 @@ $ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen
218198
✔ 724ddb9b523f Pull complete 2.8s
219199
✔ 32581b0068b9 Pull complete 1.7s
220200
✔ 4f4fb700ef54 Pull complete 2.0s
221-
[+] Running 4/4
201+
[+] Running 3/3
222202
✔ Container hosting-plausible_events_db-1 Running 0.0s
223203
✔ Container hosting-plausible_db-1 Running 0.0s
224204
✔ Container hosting-plausible-1 Started 1.2s
225-
✔ Container caddy-gen Running 0.0s
226205
$ docker images --filter=reference='ghcr.io/plausible/community-edition:*'
227206
REPOSITORY TAG IMAGE ID CREATED SIZE
228207
ghcr.io/plausible/community-edition v2.1 63f7c8708294 6 days ago 83.4MB
@@ -232,9 +211,6 @@ Untagged: ghcr.io/plausible/community-edition:v2.1.0-rc.0
232211
...
233212
```
234213

235-
> [!TIP]
236-
> You can omit <kbd>-f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml</kbd> if you are not using Caddy.
237-
238214
Changes in major versions would involve performing a data migration (e.g. [v2.0.0](https://github.com/plausible/analytics/releases/tag/v2.0.0)) or some other extra step.
239215

240216
## Configure
@@ -355,15 +331,6 @@ $ docker compose exec plausible_db psql -U postgres -h localhost -d plausible_db
355331

356332
### Web
357333

358-
#### LISTEN_IP
359-
360-
Default: `0.0.0.0`
361-
362-
Configures the IP address to bind the listen socket for the web server.
363-
364-
> [!WARNING]
365-
> Note that setting it to `127.0.0.1` in a container would make the web server unavailable from outside the container.
366-
367334
---
368335

369336
#### PORT
@@ -732,16 +699,11 @@ $ docker compose rm plausible
732699
? Going to remove hosting-plausible-1 Yes
733700
[+] Running 1/0
734701
⠿ Container hosting-plausible-1 Removed
735-
$ docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up -d
736-
[+] Running 4/4
702+
$ docker compose up -d
703+
[+] Running 3/3
737704
✔ Container hosting-plausible_events_db-1 Running 0.0s
738705
✔ Container hosting-plausible_db-1 Running 0.0s
739706
✔ Container hosting-plausible-1 Started 1.2s
740-
✔ Container caddy-gen Running 0.0s
741-
[+] Running 3/3
742-
⠿ Container hosting-plausible_db-1 Healthy 0.5s
743-
⠿ Container hosting-plausible_events_db-1 Healthy 0.5s
744-
⠿ Container hosting-plausible-1 Started
745707
$ docker compose exec plausible sh -c 'echo $GOOGLE_CLIENT_ID'
746708
974728454958-e1vcqqqs6hmoc394663kjrkgfajrifdg.apps.googleusercontent.com
747709
```

docker-compose.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
plausible_db:
33
# Plausible v2.1.1 was tested against PostgreSQL versions 15 and 16
4-
# https://github.com/plausible/analytics/blob/v2.1.1/.github/workflows/elixir.yml#L21-L32
4+
# https://github.com/plausible/analytics/blob/v2.1.2/.github/workflows/elixir.yml#L21-L32
55
image: postgres:16-alpine
66
restart: always
77
volumes:
@@ -23,16 +23,23 @@ services:
2323
hard: 262144
2424

2525
plausible:
26-
image: ghcr.io/plausible/community-edition:v2.1.1
26+
image: ghcr.io/plausible/community-edition:v2.1.2
2727
restart: always
2828
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
2929
depends_on:
3030
- plausible_db
3131
- plausible_events_db
3232
ports:
33-
- 127.0.0.1:8000:8000
34-
env_file:
35-
- plausible-conf.env
33+
- 8000:8000
34+
- 8001:8001
35+
env:
36+
BASE_URL: ${BASE_URL}
37+
SECRET_KEY_BASE: ${SECRET_KEY_BASE}
38+
HTTP_PORT: 8000
39+
HTTPS_PORT: 8001
40+
DATABASE_URL: postgres://postgres:postgres@plausible_db:5432/plausible_db
41+
CLICKHOUSE_DATABASE_URL: http://plausible_events_db:8123/plausible_events_db
42+
DISABLE_REGISTRATION: true
3643

3744
volumes:
3845
db-data:

plausible-conf.env

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
BASE_URL=replace-me
22
SECRET_KEY_BASE=replace-me
3-
TOTP_VAULT_KEY=replace-me
3+
HTTP_PORT=8000
4+
HTTPS_PORT=8001

0 commit comments

Comments
 (0)