Skip to content

Commit 88de58e

Browse files
committed
v2.1.2
0 parents  commit 88de58e

7 files changed

+200
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Best place for self-hosting issues is the community forum
3+
about: Please do not submit issues here
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Please do not submit issues here. Best place for self-hosting issues, questions and ideas is [the community forum here on GitHub](https://github.com/plausible/analytics/discussions/categories/self-hosted-support). Thanks!

.github/workflows/spellcheck.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: spellcheck
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
codespell:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: codespell-project/actions-codespell@v2
13+
with:
14+
check_filenames: true
15+
16+
typos:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: crate-ci/typos@master

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

README.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<p align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="./images/logo_dark.svg" width="300">
4+
<source media="(prefers-color-scheme: light)" srcset="./images/logo_light.svg" width="300">
5+
<img src="./images/logo_light.svg" width="300">
6+
</picture>
7+
</p>
8+
9+
<p align="center">
10+
<strong>A getting started guide to self-hosting <a href="https://plausible.io/blog/community-edition">Plausible Community Edition</a></strong>
11+
</p>
12+
13+
**Contact**:
14+
15+
- For release announcements please go to [GitHub releases.](https://github.com/plausible/analytics/releases)
16+
- For a question or advice please go to [GitHub discussions.](https://github.com/plausible/analytics/discussions/categories/self-hosted-support)
17+
18+
---
19+
20+
## Install
21+
22+
[Plausible Community Edition (or CE for short)](https://plausible.io/blog/community-edition) is designed to be self-hosted through [Docker.](https://docs.docker.com/guides/get-started/) You don't have to be a Docker expert to launch your own instance, but you should have a basic understanding of the command-line and networking to successfully set it up.
23+
24+
```console
25+
$ curl get-docker.sh
26+
```
27+
28+
### Requirements
29+
30+
The only thing you need to install Plausible CE is a server with Docker. The server must have a CPU with x86_64 or arm64 architecture and support for SSE 4.2 or equivalent NEON instructions. We recommend using a minimum of 4GB of RAM but the requirements will depend on your site traffic.
31+
32+
We've tested this on [Digital Ocean](https://m.do.co/c/91569eca0213) (affiliate link) but any hosting provider works. If your server doesn't come with Docker pre-installed, you can follow [their docs](https://docs.docker.com/get-docker/) to install it.
33+
34+
To make your Plausible CE instance accessible on a (sub)domain, you also need to be able to edit your DNS. Plausible CE isn't currently designed for subfolder installations.
35+
36+
### Quick start
37+
38+
To get started quickly, clone the [plausible/community-edition](https://github.com/plausible/community-edition) repo. It has everything you need to boot up your own Plausible CE server.
39+
40+
<sub><kbd>console</kbd></sub>
41+
```console
42+
$ git clone -b v2.1.2 --single-branch https://github.com/plausible/community-edition plausible-ce
43+
Cloning into 'community-edition'...
44+
remote: Enumerating objects: 280, done.
45+
remote: Counting objects: 100% (146/146), done.
46+
remote: Compressing objects: 100% (74/74), done.
47+
remote: Total 280 (delta 106), reused 86 (delta 71), pack-reused 134
48+
Receiving objects: 100% (280/280), 69.44 KiB | 7.71 MiB/s, done.
49+
Resolving deltas: 100% (136/136), done.
50+
$ ls -1 plausible-ce
51+
README.md
52+
clickhouse/
53+
compose.yml
54+
```
55+
56+
This most important file is [compose.yml.](./compose.yml) It installs and orchestrates networking between your Plausible CE server, Postgres database, and Clickhouse database for stats.
57+
58+
Right now there are some environment variables missing:
59+
60+
<sub><kbd>compose.yml</kbd></sub>
61+
```yaml
62+
BASE_URL: ${BASE_URL}
63+
SECRET_KEY_BASE: ${SECRET_KEY_BASE}
64+
```
65+
66+
Let's do as it asks and populate these required environment variables with our own values.
67+
68+
#### Required configuration
69+
70+
First we generate the [secret key base](#secret_key_base) using OpenSSL:
71+
72+
<sub><kbd>console</kbd></sub>
73+
```console
74+
$ openssl rand -base64 48
75+
GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz
76+
```
77+
78+
And then we decide on the [base URL](#base_url) where the instance would be accessible:
79+
80+
<sub><kbd>plausible-conf.env</kbd></sub>
81+
```diff
82+
- BASE_URL=replace-me
83+
+ BASE_URL=https://plausible.example.com
84+
- SECRET_KEY_BASE=replace-me
85+
+ SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz
86+
HTTP_PORT=8000
87+
HTTPS_PORT=8001
88+
```
89+
90+
We can start our instance now.

clickhouse/clickhouse-config.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<clickhouse>
2+
<logger>
3+
<level>warning</level>
4+
<console>true</console>
5+
</logger>
6+
7+
<!--
8+
Avoid the warning: "Listen [::]:9009 failed: Address family for hostname not supported".
9+
If Docker has IPv6 disabled, bind ClickHouse to IPv4 to prevent this issue.
10+
Add this to the configuration to ensure it listens on all IPv4 interfaces:
11+
<listen_host>0.0.0.0</listen_host>
12+
-->
13+
14+
<!-- Stop all the unnecessary logging -->
15+
<query_thread_log remove="remove"/>
16+
<query_log remove="remove"/>
17+
<text_log remove="remove"/>
18+
<trace_log remove="remove"/>
19+
<metric_log remove="remove"/>
20+
<asynchronous_metric_log remove="remove"/>
21+
<session_log remove="remove"/>
22+
<part_log remove="remove"/>
23+
</clickhouse>

clickhouse/clickhouse-user-config.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<clickhouse>
2+
<profiles>
3+
<default>
4+
<log_queries>0</log_queries>
5+
<log_query_threads>0</log_query_threads>
6+
</default>
7+
</profiles>
8+
</clickhouse>

compose.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
services:
2+
plausible_db:
3+
image: postgres:16-alpine
4+
restart: always
5+
volumes:
6+
- db-data:/var/lib/postgresql/data
7+
environment:
8+
- POSTGRES_PASSWORD=postgres
9+
10+
plausible_events_db:
11+
image: clickhouse/clickhouse-server:24.3.3.102-alpine
12+
restart: always
13+
volumes:
14+
- event-data:/var/lib/clickhouse
15+
- event-logs:/var/log/clickhouse-server
16+
- ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
17+
- ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
18+
ulimits:
19+
nofile:
20+
soft: 262144
21+
hard: 262144
22+
23+
plausible:
24+
image: ghcr.io/plausible/community-edition:v2.1.2
25+
restart: always
26+
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
27+
depends_on:
28+
- plausible_db
29+
- plausible_events_db
30+
ports:
31+
- 8000:8000
32+
- 8001:8001
33+
volumes:
34+
- plausible-data:/var/lib/plausible
35+
environment:
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
43+
44+
volumes:
45+
db-data:
46+
event-data:
47+
event-logs:
48+
plausible-data:

0 commit comments

Comments
 (0)