-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 88de58e
Showing
7 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...hub/ISSUE_TEMPLATE/best-place-for-self-hosting-issues-is-the-community-forum.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
name: Best place for self-hosting issues is the community forum | ||
about: Please do not submit issues here | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: spellcheck | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
codespell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: codespell-project/actions-codespell@v2 | ||
with: | ||
check_filenames: true | ||
|
||
typos: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: crate-ci/typos@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<p align="center"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="./images/logo_dark.svg" width="300"> | ||
<source media="(prefers-color-scheme: light)" srcset="./images/logo_light.svg" width="300"> | ||
<img src="./images/logo_light.svg" width="300"> | ||
</picture> | ||
</p> | ||
|
||
<p align="center"> | ||
<strong>A getting started guide to self-hosting <a href="https://plausible.io/blog/community-edition">Plausible Community Edition</a></strong> | ||
</p> | ||
|
||
**Contact**: | ||
|
||
- For release announcements please go to [GitHub releases.](https://github.com/plausible/analytics/releases) | ||
- For a question or advice please go to [GitHub discussions.](https://github.com/plausible/analytics/discussions/categories/self-hosted-support) | ||
|
||
--- | ||
|
||
## Install | ||
|
||
[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. | ||
|
||
```console | ||
$ curl get-docker.sh | ||
``` | ||
|
||
### Requirements | ||
|
||
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. | ||
|
||
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. | ||
|
||
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. | ||
|
||
### Quick start | ||
|
||
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. | ||
|
||
<sub><kbd>console</kbd></sub> | ||
```console | ||
$ git clone -b v2.1.2 --single-branch https://github.com/plausible/community-edition plausible-ce | ||
Cloning into 'community-edition'... | ||
remote: Enumerating objects: 280, done. | ||
remote: Counting objects: 100% (146/146), done. | ||
remote: Compressing objects: 100% (74/74), done. | ||
remote: Total 280 (delta 106), reused 86 (delta 71), pack-reused 134 | ||
Receiving objects: 100% (280/280), 69.44 KiB | 7.71 MiB/s, done. | ||
Resolving deltas: 100% (136/136), done. | ||
$ ls -1 plausible-ce | ||
README.md | ||
clickhouse/ | ||
compose.yml | ||
``` | ||
|
||
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. | ||
|
||
Right now there are some environment variables missing: | ||
|
||
<sub><kbd>compose.yml</kbd></sub> | ||
```yaml | ||
BASE_URL: ${BASE_URL} | ||
SECRET_KEY_BASE: ${SECRET_KEY_BASE} | ||
``` | ||
Let's do as it asks and populate these required environment variables with our own values. | ||
#### Required configuration | ||
First we generate the [secret key base](#secret_key_base) using OpenSSL: | ||
<sub><kbd>console</kbd></sub> | ||
```console | ||
$ openssl rand -base64 48 | ||
GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz | ||
``` | ||
|
||
And then we decide on the [base URL](#base_url) where the instance would be accessible: | ||
|
||
<sub><kbd>plausible-conf.env</kbd></sub> | ||
```diff | ||
- BASE_URL=replace-me | ||
+ BASE_URL=https://plausible.example.com | ||
- SECRET_KEY_BASE=replace-me | ||
+ SECRET_KEY_BASE=GLVzDZW04FzuS1gMcmBRVhwgd4Gu9YmSl/k/TqfTUXti7FLBd7aflXeQDdwCj6Cz | ||
HTTP_PORT=8000 | ||
HTTPS_PORT=8001 | ||
``` | ||
|
||
We can start our instance now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<clickhouse> | ||
<logger> | ||
<level>warning</level> | ||
<console>true</console> | ||
</logger> | ||
|
||
<!-- | ||
Avoid the warning: "Listen [::]:9009 failed: Address family for hostname not supported". | ||
If Docker has IPv6 disabled, bind ClickHouse to IPv4 to prevent this issue. | ||
Add this to the configuration to ensure it listens on all IPv4 interfaces: | ||
<listen_host>0.0.0.0</listen_host> | ||
--> | ||
|
||
<!-- Stop all the unnecessary logging --> | ||
<query_thread_log remove="remove"/> | ||
<query_log remove="remove"/> | ||
<text_log remove="remove"/> | ||
<trace_log remove="remove"/> | ||
<metric_log remove="remove"/> | ||
<asynchronous_metric_log remove="remove"/> | ||
<session_log remove="remove"/> | ||
<part_log remove="remove"/> | ||
</clickhouse> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<clickhouse> | ||
<profiles> | ||
<default> | ||
<log_queries>0</log_queries> | ||
<log_query_threads>0</log_query_threads> | ||
</default> | ||
</profiles> | ||
</clickhouse> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
services: | ||
plausible_db: | ||
image: postgres:16-alpine | ||
restart: always | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_PASSWORD=postgres | ||
|
||
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/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 | ||
|
||
plausible: | ||
image: ghcr.io/plausible/community-edition:v2.1.2 | ||
restart: always | ||
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" | ||
depends_on: | ||
- plausible_db | ||
- plausible_events_db | ||
ports: | ||
- 8000:8000 | ||
- 8001:8001 | ||
volumes: | ||
- plausible-data:/var/lib/plausible | ||
environment: | ||
BASE_URL: ${BASE_URL} | ||
SECRET_KEY_BASE: ${SECRET_KEY_BASE} | ||
HTTP_PORT: 8000 | ||
HTTPS_PORT: 8001 | ||
DATABASE_URL: postgres://postgres:postgres@plausible_db:5432/plausible_db | ||
CLICKHOUSE_DATABASE_URL: http://plausible_events_db:8123/plausible_events_db | ||
DISABLE_REGISTRATION: true | ||
|
||
volumes: | ||
db-data: | ||
event-data: | ||
event-logs: | ||
plausible-data: |