This commit is contained in:
ruslandoga 2024-09-14 14:07:25 +07:00
parent ecbbd7c7e1
commit 2a019e2a0f
2 changed files with 18 additions and 12 deletions

View File

@ -27,25 +27,37 @@
compose.yml compose.yml
``` ```
1. Create and configure your [environment file:](https://docs.docker.com/compose/environment-variables/) 1. Create and configure your [environment](https://docs.docker.com/compose/environment-variables/) file:
```console ```console
$ touch .env $ touch .env
$ echo "HTTP_PORT=80" >> .env
$ echo "HTTPS_PORT=443" >> .env
$ echo "BASE_URL=https://plausible.example.com" >> .env $ echo "BASE_URL=https://plausible.example.com" >> .env
$ echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env $ echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
$ cat .env $ cat .env
HTTP_PORT=80
HTTPS_PORT=443
BASE_URL=https://plausible.example.com BASE_URL=https://plausible.example.com
SECRET_KEY_BASE=As0fZsJlUpuFYSthRjT5Yflg/NlxkFKPRro72xMLXF8yInZ60s6xGGXYVqml+XN1 SECRET_KEY_BASE=As0fZsJlUpuFYSthRjT5Yflg/NlxkFKPRro72xMLXF8yInZ60s6xGGXYVqml+XN1
``` ```
Make sure `$BASE_URL` is set to the actual domain where you plan to host the service. The domain must have a DNS entry pointing to your server for proper resolution and automatic Let's Encrypt TLS certificate issuance. Make sure `$BASE_URL` is set to the actual domain where you plan to host the service. The domain must have a DNS entry pointing to your server for proper resolution and automatic Let's Encrypt TLS certificate issuance.
1. Expose Plausible server to the web with an [override file:](./wiki/compose-override)
```console
$ cat > compose.override.yml << EOF
services:
plausible:
ports:
- 80:80
- 443:443
environment:
- HTTP_PORT=80
- HTTPS_PORT=443
EOF
```
Setting `HTTP_PORT=80` and `HTTPS_PORT=443` enables automatic Let's Encrypt TLS certificate issuance. You might want to choose different values if, for example, you plan to run Plausible behind [a reverse proxy.](./wiki/reverse-proxy)
1. Start the services with Docker Compose: 1. Start the services with Docker Compose:
```console ```console

View File

@ -39,10 +39,6 @@ services:
condition: service_healthy condition: service_healthy
plausible_events_db: plausible_events_db:
condition: service_healthy condition: service_healthy
ports:
# Note that setting ports opens firewall for external access.
- 80:${HTTP_PORT}
- 443:${HTTPS_PORT}
volumes: volumes:
- plausible-data:/var/lib/plausible - plausible-data:/var/lib/plausible
ulimits: ulimits:
@ -52,8 +48,6 @@ services:
environment: environment:
- BASE_URL=${BASE_URL} - BASE_URL=${BASE_URL}
- SECRET_KEY_BASE=${SECRET_KEY_BASE} - SECRET_KEY_BASE=${SECRET_KEY_BASE}
- HTTP_PORT
- HTTPS_PORT
volumes: volumes:
db-data: db-data: