|
| 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. |
0 commit comments