94 Commits
Author SHA1 Message Date
ruslandoga decedb09d6 Create LICENSE 2024-12-04 19:23:25 +07:00
Aiden d6a61a500b Remove version tag from compose file 2024-05-11 10:17:08 +07:00
ruslandoga 41b38bd384 flatten docs, no details 2024-05-10 18:43:12 +07:00
ruslandoga 2703326e60 Merge pull request #113 from plausible/allow-nginx-ws
allow ws proxying in nginx
2024-04-26 01:53:24 +08:00
ruslandoga 06f122fde5 Merge pull request #118 from plausible/ch-logs-volume
save CH logs into a named volume
2024-04-16 20:19:49 +08:00
ruslandoga 3ea11aad26 save CH logs into a named volume 2024-04-16 00:35:54 +08:00
ruslandoga 4ebc0f6631 Merge pull request #112 from plausible/doc-remove-localhost-only
add note about removing localhost-only binding
2024-03-25 17:48:01 +08:00
ruslandoga cf97d39241 allow ws proxying in nginx
Relevant:
- https://github.com/plausible/analytics/discussions/3826
- https://github.com/plausible/analytics/discussions/3817#discussioncomment-8615006
2024-03-25 15:58:51 +08:00
ruslandoga 9c5b0c9be9 Merge pull request #110 from onzecki/patch-1
Add WebSocket Proxy mod
2024-03-25 11:42:13 +08:00
ruslandoga 565906e9f5 add note about removing localhost-only binding 2024-03-25 11:38:18 +08:00
onzecki b6d9eac722 Add WebSocket Proxy mod 2024-03-23 16:26:43 +01:00
ruslandoga 0a9c71320a explain PostgreSQL "supported versions" message 2024-02-26 22:04:11 +08:00
ruslandoga bdf1483526 we actually test against PostgreSQL 13, 14, and 15 2024-02-24 20:20:55 +08:00
ruslandoga 518aa3a35a make Plausible listen on 127.0.0.1 by default 2024-02-24 01:50:30 +08:00
ruslandoga 376369fd21 add ls after clone to verify right files were copied 2024-02-24 00:06:04 +08:00
ruslandoga 6096b4e8b8 it's plausible/community-edition now 2024-02-24 00:04:21 +08:00
Uku Taht 5377947618 Merge pull request #90 from plausible/new-docs
New docs
2024-02-23 14:04:04 +02:00
ruslandoga 33a3413131 new docs 2024-02-23 20:00:42 +08:00
ruslandoga 546f641ec1 drop TOTP_VAULT_KEY for v2.0.0 for now 2024-02-23 19:58:56 +08:00
hq1 1d4f9e93c5 Add TOTP_VAULT_KEY placeholder (#89) 2024-02-19 09:32:53 +01:00
ruslandoga bb6decee4d simplify upgrade-postgres guide 2023-10-12 20:35:53 +08:00
ruslandoga ba84dc28d2 remove geoip volume
as suggested in https://github.com/plausible/analytics/discussions/3252
2023-08-10 16:11:36 +07:00
ruslandoga 44925a9937 remove geoip 2023-07-17 20:44:06 +07:00
ruslandoga 2e72a378b1 upgrade clickhouse 2023-07-17 20:42:03 +07:00
ruslandoga 171d8070d8 use plausible v2 2023-07-17 20:41:32 +07:00
ruslandoga dd0e109a57 use newer clickhouse version 2023-06-14 13:50:13 +08:00
ruslandoga 36d45da228 remove k8s 2023-05-29 20:05:48 +08:00
ruslandoga 3e1462eabd use v1.5 in docker-compose.yml 2023-04-11 15:56:39 +07:00
ruslandoga 36ada560cb Merge pull request #65 from joshavant/clickhouse-config-updates
Update Clickhouse logging suppression XML
2023-01-19 14:07:13 +07:00
joshavant fac1deb8f2 Update Clickhouse logging suppression XML 2023-01-15 23:09:25 -06:00
ruslandoga 524cc15440 Merge pull request #64 from plausible/remove-stale-info
remove more stale info
2023-01-15 21:35:09 +07:00
ruslandoga 2dc9b61b02 remove more stale info 2023-01-15 21:34:29 +07:00
ruslandoga 0366e4c510 Merge pull request #61 from plausible/remove-stale-info
remove references to admin env vars
2023-01-15 20:43:44 +07:00
ruslandoga a54938ed01 remove references to admin env vars 2023-01-15 20:43:23 +07:00
ruslandoga 5097a507fc Merge pull request #60 from ketan-vijayvargiya/master
Remove admin creation
2023-01-07 15:41:57 +07:00
ketan-vijayvargiya 7a3a3d2dd9 Remove admin creation 2022-12-16 04:19:20 +00:00
Marko Saric a6fe8d13df Merge pull request #56 from robertmarsal/patch-1
fix: remove typo from the config
2022-10-12 14:13:59 +02:00
Robert Marsal 00a07f352d Remove typo from the config 2022-10-12 12:39:14 +01:00
ruslandoga c091fb7119 Merge pull request #52 from ruslandoga/upgrade-postgres
upgrade postgres
2022-10-12 17:48:02 +07:00
ruslandoga a220fd2d08 add postgres upgrade guide 2022-10-12 09:32:32 +07:00
Marko Saric eb10707338 Merge pull request #55 from Jeroenvb3/master
Fixed link to self hosting docs in readme.
2022-10-07 15:19:43 +02:00
Jeroen van Bennekum 812d6bb5e9 Fixed link to self hosting docs in readme. 2022-10-07 15:12:36 +02:00
ruslandoga cbc35f7e5c upgrade postgres 2022-09-24 12:18:54 +04:00
ruslandoga 3177d22992 Merge pull request #45 from paskal/paskal/newer_clickhouse
Update clickhouse to 22.6
2022-09-13 11:19:57 +04:00
Dmitry Verkhoturov 662452a19b update clickhouse version to one working under arm
Also, previously we used Ubuntu base image.
Now, we're switching to Alpine.
2022-09-12 19:32:43 +02:00
Uku Taht f768205710 Merge pull request #40 from oscartbeaumont/master
fixed incorrect selector for SMTP service
2021-11-24 10:49:04 +02:00
Oscar Beaumont 2a9eaf06bc fixed incorrect selector for SMTP service
The selector was set incorrectly and hence would point to nothing causing 500 errors when sending emails. I must have not tested with SMTP when I originally created the Kubernetes configurations hence this mistake made it through.
2021-11-24 04:39:49 +11:00
Uku Taht a37016e345 Merge pull request #39 from Philipinho/master
Add Apache2 instructions
2021-10-26 11:01:23 +02:00
Philipinho 8b8262a967 Add Apache2 instructions 2021-10-25 14:13:46 +01:00
Uku Taht dcd6f5d737 Merge pull request #38 from navjotjsingh/restart
Add Restart Ability to all the Containers
2021-08-23 11:53:46 +03:00
navjotjsingh 0b6636553f Add restart to GEOIP container 2021-08-22 17:20:33 +05:30
navjotjsingh 10e446eb2c Add Restart Ability to all the Containers 2021-08-19 14:35:24 +05:30
Uku Taht 70a5eb11c6 Merge pull request #37 from oscartbeaumont/master
added Kubernetes support
2021-08-04 14:08:54 +03:00
Oscar Beaumont 5ca6f3d069 fix: added warning about multiple replicas 2021-08-04 17:37:41 +08:00
Oscar Beaumont dabb387823 fix: converted Plausible config to secret
This was done as the Plausible configuration file contains the secret key base which is used to encrypt the cookies.
2021-08-02 15:01:55 +08:00
Oscar Beaumont 46f050f54c added plausible init container, security context's & events-db configuration into configmap 2021-07-19 15:28:44 +08:00
Oscar Beaumont aa9f96cd12 lowered unreasonably high resource requirements 2021-07-19 14:05:07 +08:00
Oscar Beaumont 03919f11f1 changed databases to StatefulSet 2021-07-19 13:54:58 +08:00
Oscar Beaumont ee329a3138 added Kubernetes support 2021-07-15 17:36:49 +08:00
Uku Taht 3adc80359b Merge pull request #36 from iwootten/use-latest-clickhouse
Use latest versioned clickhouse
2021-03-15 11:46:48 +02:00
Ian Wootten 692a0ffa85 Use latest versioned release 2021-03-12 15:55:14 +00:00
Ian Wootten 9949e2a83f Revert "Pin Clickhouse version down"
This reverts commit 6be56570a1.
2021-03-12 15:03:20 +00:00
Uku Taht 6be56570a1 Pin Clickhouse version down 2021-03-10 10:45:02 +02:00
Marko Saric 0e92240174 Update issue templates 2021-01-15 14:33:41 +01:00
Uku Taht 53bb9fb9ea Revert "Changed Postgres version from 12 to latest"
This reverts commit a735885fae.
Fixes #26
2020-12-07 11:35:04 +02:00
Uku Taht 11f3867b70 Merge pull request #23 from mabasic/patch-1
Instructs Nginx to listen on both IPv6 and IPv4
2020-12-07 11:25:45 +02:00
Uku Taht 564e059001 Merge pull request #28 from plausible/fix-clickhouse-config
Fix clickhouse configuration for docker
2020-12-07 11:22:46 +02:00
Uku Taht 758a79e5d6 Fix clickhouse configuration for docker 2020-12-07 11:20:50 +02:00
Mario Bašić 9827f5ace7 Instructs Nginx to listen on both IPv6 and IPv4
On a server which has IPv6 configured, `sudo certbot --nginx` would fail because certbot looks for both A and AAAA DNS records, and if AAAA (IPv6) is found it uses that. 

By adding:

```
listen 80;
listen [::]:80;
```

issue #22 is solved. Servers which have only IPv4 configured will continue working normally.
2020-12-03 16:53:43 +01:00
Uku Taht ffdc473cf2 Merge pull request #13 from RealOrangeOne/master
Add clickhouse configuration to disable logging tables
2020-12-01 10:56:27 +02:00
Uku Taht 6025983534 Merge pull request #16 from Maciejfiedler/patch-1
Changed Postgres version from 12 to latest
2020-11-26 09:53:34 +02:00
Maciej Fiedler a735885fae Changed Postgres version from 12 to latest
By switching to the latest or 13 version, the plausible_db container will no more complain about the wrong postgres version and shut down. This resolved my error, when i implemented this docker-compose into my own docker-compose.
2020-11-25 14:54:23 +01:00
Jake Howard 1c2004fce7 Add clickhouse configuration to disable logging tables.
These tables aren't appropriate for small-scale installations, especially for single home use.

See https://theorangeone.net/posts/calming-down-clickhouse/ and https://github.com/plausible/analytics/issues/301
2020-11-14 14:20:13 +00:00
Uku Taht 5b9e8c9e8d Merge pull request #11 from birjolaxew/master
Add configuration for various reverse proxies
2020-11-05 13:58:00 +02:00
Uku Taht 2d0c1fdb7c Merge pull request #7 from avimanyu786/patch-1
Update docker-compose.geoip.yml
2020-10-30 14:13:58 +02:00
Uku Taht b861c9be2b Merge pull request #9 from kiprasmel/patch-1
Update plausible-conf.env - remove the brackets around env var values
2020-10-30 14:13:38 +02:00
birjolaxew 2a691320b6 Remove domain alias configuration from caddy-gen file
Domain aliases aren't applicable to our use case, so no need to
leave it in
2020-10-30 06:12:26 +01:00
birjolaxew 8a88026ca8 Remove redundant port configuration in caddy-gen file 2020-10-30 06:00:35 +01:00
birjolaxew ffccee3219 Add reverse-proxy configuration for existing Traefik installation
Largely based on the work of @MoryCorp in #10
2020-10-30 05:59:56 +01:00
birjolaxew f055f1d0aa Add reverse-proxy configuration for existing NGINX installation 2020-10-30 05:48:12 +01:00
birjolaxew 2e9dd1560e Add docker-compose file for simple reverse proxy
Based on caddy-gen
This will start a reverse proxy on port 80 and 443, which proxies
to the plausible container. Note that it will clash with any
existing reverse proxies on the host machine
2020-10-30 05:43:38 +01:00
birjolaxew 4ff0b7fbfc Change Plausible to not bind to port 80 by default
This is done in preparation for adding reverse-proxy configurations
Unfortunately a later docker-compose file cannot *remove* a port
binding, so it has to be removed in the root file.
If there is interest, the 80:8000 binding can be re-added in a
new docker-compose overwrite file.
2020-10-30 05:30:23 +01:00
Kipras Melnikovas 5b566c9ea2 Update plausible-conf.env - remove the brackets around env var values
I got confused why I couldn't log in even though the credentials were correct.

Turns out you're supposed to remove the brackets around the env variables - I didn't knew that. I think this will prove less confusing
2020-10-30 00:25:41 +02:00
Avimanyu Bandyopadhyay ecd8f30104 Update docker-compose.geoip.yml
Without mounting the geoip volume, the countries will not show on the map inside the Plausible dashboard.
2020-10-24 03:07:38 +05:30
Uku Taht 09fb07ef60 Merge pull request #5 from bokub/master
Remove useless links
2020-10-16 14:42:05 +03:00
Boris Kubiak 26ee599130 Remove useless links
Don't expose GeoIP ports
2020-10-16 11:15:49 +02:00
Uku Taht 891914e9a1 Do not expose database ports to the public internet 2020-10-14 13:38:49 +03:00
Uku Taht c5146231aa Use the latest image 2020-10-05 16:10:41 +03:00
Uku Taht a68f36d934 Remove clickhouse config 2020-10-02 11:19:43 +03:00
Uku Taht a081f25c1d Add clickhouse config 2020-10-02 10:27:55 +03:00
Uku Taht f56fab0bb8 Fix docker-compose command 2020-10-01 15:50:23 +03:00
Uku Taht 98f72b21ec Create admin when booting up 2020-10-01 13:56:05 +03:00
Uku Taht 2229a63ee4 Use dev image for testing 2020-10-01 11:14:51 +03:00
Uku Taht c0fcca12ac Initial commit 2020-10-01 11:13:13 +03:00
54 changed files with 1296 additions and 211 deletions
@@ -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!
-9
View File
@@ -1,9 +0,0 @@
*
!compose.yml
!clickhouse/logs.xml
!clickhouse/ipv4-only.xml
!clickhouse/low-resources.xml
!clickhouse/default-profile-low-resources-overrides.xml
!README.md
!LICENSE
!.gitignore
+1
View File
@@ -0,0 +1 @@
*
+937 -60
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<!-- 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>
+8
View File
@@ -0,0 +1,8 @@
<clickhouse>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
</default>
</profiles>
</clickhouse>
@@ -1,19 +0,0 @@
<!-- https://clickhouse.com/docs/en/operations/tips#using-less-than-16gb-of-ram -->
<clickhouse>
<profiles>
<default>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_threads -->
<max_threads>1</max_threads>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_block_size -->
<max_block_size>8192</max_block_size>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_download_threads -->
<max_download_threads>1</max_download_threads>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#input_format_parallel_parsing -->
<input_format_parallel_parsing>0</input_format_parallel_parsing>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#output_format_parallel_formatting -->
<output_format_parallel_formatting>0</output_format_parallel_formatting>
</default>
</profiles>
</clickhouse>
-3
View File
@@ -1,3 +0,0 @@
<clickhouse>
<listen_host>0.0.0.0</listen_host>
</clickhouse>
-28
View File
@@ -1,28 +0,0 @@
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<query_log replace="1">
<database>system</database>
<table>query_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<engine>
ENGINE = MergeTree
PARTITION BY event_date
ORDER BY (event_time)
TTL event_date + interval 30 day
SETTINGS ttl_only_drop_parts=1
</engine>
</query_log>
<!-- Stops unnecessary logging -->
<metric_log remove="remove" />
<asynchronous_metric_log remove="remove" />
<query_thread_log remove="remove" />
<text_log remove="remove" />
<trace_log remove="remove" />
<session_log remove="remove" />
<part_log remove="remove" />
</clickhouse>
-4
View File
@@ -1,4 +0,0 @@
<clickhouse>
<!-- https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings#mark_cache_size -->
<mark_cache_size>524288000</mark_cache_size>
</clickhouse>
-88
View File
@@ -1,88 +0,0 @@
services:
plausible_events_db:
image: clickhouse/clickhouse-server:24.12-alpine
restart: always
volumes:
- event-data:/var/lib/clickhouse
- event-logs:/var/log/clickhouse-server
- ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro
# This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default.
# Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings.
- ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro
# The following configuration files make ClickHouse consume less resources, which is useful for small setups.
# https://clickhouse.com/docs/en/operations/tips#using-less-than-16gb-of-ram
- ./clickhouse/low-resources.xml:/etc/clickhouse-server/config.d/low-resources.xml:ro
- ./clickhouse/default-profile-low-resources-overrides.xml:/etc/clickhouse-server/users.d/default-profile-low-resources-overrides.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
environment:
- CLICKHOUSE_SKIP_USER_SETUP=1
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1",
]
start_period: 1m
plausible:
image: ghcr.io/plausible/community-edition:v3.2.1
restart: always
command: sh -c "/entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
plausible_events_db:
condition: service_healthy
volumes:
- plausible-data:/var/lib/plausible
ulimits:
nofile:
soft: 65535
hard: 65535
ports:
- 5000:8000
environment:
- TMPDIR=/var/lib/plausible/tmp
# required: https://github.com/plausible/community-edition/wiki/configuration#required
- BASE_URL=${BASE_URL}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
# optional: https://github.com/plausible/community-edition/wiki/configuration#optional
# registration: https://github.com/plausible/community-edition/wiki/configuration#registration
- TOTP_VAULT_KEY
- DISABLE_REGISTRATION
- ENABLE_EMAIL_VERIFICATION
# web: https://github.com/plausible/community-edition/wiki/configuration#web
- HTTP_PORT
- HTTPS_PORT
# databases: https://github.com/plausible/community-edition/wiki/configuration#database
- DATABASE_URL
- CLICKHOUSE_DATABASE_URL
# Google: https://github.com/plausible/community-edition/wiki/configuration#google
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
# geolocation: https://github.com/plausible/community-edition/wiki/configuration#ip-geolocation
- IP_GEOLOCATION_DB
- GEONAMES_SOURCE_FILE
- MAXMIND_LICENSE_KEY
- MAXMIND_EDITION
# email: https://github.com/plausible/community-edition/wiki/configuration#email
- MAILER_ADAPTER
- MAILER_EMAIL
- MAILER_NAME
- SMTP_HOST_ADDR
- SMTP_HOST_PORT
- SMTP_USER_NAME
- SMTP_USER_PWD
- SMTP_HOST_SSL_ENABLED
- POSTMARK_API_KEY
- MAILGUN_API_KEY
- MAILGUN_DOMAIN
- MAILGUN_BASE_URI
- MANDRILL_API_KEY
- SENDGRID_API_KEY
volumes:
event-data:
event-logs:
plausible-data:
+49
View File
@@ -0,0 +1,49 @@
services:
mail:
image: bytemark/smtp
restart: always
plausible_db:
# Plausible v2.0.0 was tested against PostgreSQL versions 12, 13, and 14
# https://github.com/plausible/analytics/blob/v2.0.0/.github/workflows/elixir.yml#L16
image: postgres:14-alpine
restart: always
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
plausible_events_db:
image: clickhouse/clickhouse-server:23.3.7.5-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: plausible/analytics:v2.0
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
- mail
ports:
- 127.0.0.1:8000:8000
env_file:
- plausible-conf.env
volumes:
db-data:
driver: local
event-data:
driver: local
event-logs:
driver: local
Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

+2
View File
@@ -0,0 +1,2 @@
BASE_URL=replace-me
SECRET_KEY_BASE=replace-me
+47
View File
@@ -0,0 +1,47 @@
This directory contains pre-made configurations for various reverse proxies. Which flavor you should choose depends on your setup.
## No existing reverse proxy
If you aren't running an existing reverse proxy, then you can use the [`caddy-gen`](https://github.com/wemake-services/caddy-gen) based docker-compose file. Update it to include the domain name you use for your server, then combine it with the existing docker-compose files:
```shell
$ docker-compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up
```
## Existing reverse proxy
If you are already running a reverse proxy, then the above will not work as it will clash with the existing port bindings. You should instead use one of the available configuration files:
### NGINX
If you already have NGINX running as a system service, use the configuration file in the `nginx` directory.
Edit the file `reverse-proxy/nginx/plausible` to contain the domain name you use for your server, then copy it into NGINX's configuration folder. Enable it by creating a symlink in NGINX's enabled sites folder. Finally use Certbot to create a TLS certificate for your site:
```shell
$ sudo cp reverse-proxy/nginx/plausible /etc/nginx/sites-available
$ sudo ln -s /etc/nginx/sites-available/plausible /etc/nginx/sites-enabled/plausible
$ sudo certbot --nginx
```
### Traefik 2
If you already have a Traefik container running on Docker, use the docker-compose file in the `traefik` directory. Note that it assumes that your Traefik container is set up to support certificate generation.
Edit the file `reverse-proxy/traefik/docker-compose.traefik.yml` to contain the domain name you use for your server, then combine it with the existing docker-compose files:
```shell
$ docker-compose -f docker-compose.yml -f reverse-proxy/traefik/docker-compose.traefik.yml up
```
### Apache2
Install the necessary Apache modules and restart Apache. Edit the file `reverse-proxy/apache2/plausible.conf` to contain the domain name you use for your server, then copy it into Apache's configuration folder. Enable it by creating a symlink in Apache's enabled sites folder with `a2ensite` command. Finally use Certbot to create a TLS certificate for your site:
```shell
$ sudo a2enmod proxy proxy_http proxy_ajp remoteip headers proxy_wstunnel
$ sudo systemctl restart apache2
$ sudo cp reverse-proxy/apache2/plausible.conf /etc/apache2/sites-available/
$ sudo a2ensite plausible.conf
$ sudo systemctl restart apache2
$ sudo certbot --apache
```
+18
View File
@@ -0,0 +1,18 @@
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ProxyPreserveHost On
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" forwarded
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!forwarded
CustomLog ${APACHE_LOG_DIR}/access.log forwarded env=forwarded
</VirtualHost>
@@ -0,0 +1,24 @@
version: "3.3"
services:
caddy-gen:
container_name: caddy-gen
image: "wemakeservices/caddy-gen:latest"
restart: always
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- caddy-certificates:/data/caddy
ports:
- "80:80"
- "443:443"
depends_on:
- plausible
plausible:
labels:
virtual.host: "example.com" # change to your domain name
virtual.port: "8000"
virtual.tls-email: "[email protected]" # change to your email
volumes:
caddy-certificates:
driver: local
+15
View File
@@ -0,0 +1,15 @@
server {
# replace example.com with your domain name
server_name example.com;
listen 80;
listen [::]:80;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
@@ -0,0 +1,8 @@
version: "3.3"
services:
plausible:
labels:
traefik.enable: "true"
traefik.http.routers.plausible.rule: "Host(`example.com`)" # change to your domain name
traefik.http.routers.plausible.entrypoints: "websecure"
traefik.http.services.plausible.loadbalancer.server.port: "8000"
+159
View File
@@ -0,0 +1,159 @@
Guide to upgrading PostgreSQL version `>= 12` to version `14` using `pg_dump` and `psql`. Based on [Upgrade a PostgreSQL database with docker.](https://hollo.me/devops/upgrade-postgresql-database-with-docker.html)
**Note:** following this guide you'd need to stop some containers and it would make your plausible instance temporarily unavailable.
---
### Plan
1. dump contents of the old version PostgreSQL to a file
1. copy the dump to the host
1. replace old version PostgreSQL with new version PostgreSQL
1. copy and load the dump into new version PostgreSQL
---
### Steps
1. Stop `plausible` to avoid writing to old `plausible_db`
```console
> docker compose stop plausible
[+] Running 2/2
⠿ Container hosting-plausible-1 Stopped 6.5s
```
2. Dump old `plausible_db` contents to a backup file
```console
> docker compose exec plausible_db sh -c "pg_dump -U postgres plausible_db > plausible_db.bak"
```
3. Copy the backup to the host
```console
> docker compose cp plausible_db:plausible_db.bak plausible_db.bak
```
4. (Optional) verify backup went OK
```console
> head plausible_db.bak
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.12 (Debian 12.12-1.pgdg110+1)
-- Dumped by pg_dump version 12.12 (Debian 12.12-1.pgdg110+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
```
5. Edit `docker-compose.yml` to use new PostgreSQL version, here we update from `v12` to `v14`, alpine flavour.
```diff
plausible_db:
- image: postgres:12
+ image: postgres:14-alpine
restart: always
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
```
6. Ensure relevant containers are stopped
```console
> docker compose stop plausible plausible_db
[+] Running 2/2
⠿ Container hosting-plausible-1 Stopped 0.0s
⠿ Container hosting-plausible_db-1 Stopped 0.2s
```
7. Remove old `plausible_db` container to be able to nuke its volume in the next step
```console
> docker compose rm plausible_db
? Going to remove hosting-plausible_db-1 Yes
[+] Running 1/0
⠿ Container hosting-plausible_db-1 Removed 0.0s
```
8. Remove old `plausible_db` volume, mine is named `hosting_db-data`
```console
> docker volume ls
DRIVER VOLUME NAME
<...snip...>
local hosting_db-data
local hosting_event-data
<...snip...>
> docker volume rm hosting_db-data
hosting_db-data
```
9. Start new version `plausible_db` container
```console
> docker compose up plausible_db -d
[+] Running 9/9
⠿ plausible_db Pulled 9.3s
⠿ 9b18e9b68314 Already exists 0.0s
⠿ 75aada9edfc5 Pull complete 1.2s
⠿ 820773693750 Pull complete 1.2s
⠿ 8812bb04ef2e Pull complete 5.2s
⠿ 2ccec0f7805c Pull complete 5.2s
⠿ 833f9b98598e Pull complete 5.3s
⠿ 1eb578dc04e6 Pull complete 5.4s
⠿ c873bf6204df Pull complete 5.4s
[+] Running 2/2
⠿ Volume "hosting_db-data" Created 0.0s
⠿ Container hosting-plausible_db-1 Started 0.5s
```
10. Create new DB and load data into it
```console
> docker compose exec plausible_db createdb -U postgres plausible_db
> docker compose cp plausible_db.bak plausible_db:plausible_db.bak
> docker compose exec plausible_db sh -c "psql -U postgres -d plausible_db < plausible_db.bak"
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
CREATE EXTENSION
<...snip...>
```
11. Start all other containers
```console
> docker compose up -d
[+] Running 4/4
⠿ Container hosting-plausible_events_db-1 Running 0.0s
⠿ Container hosting-mail-1 Running 0.0s
⠿ Container hosting-plausible_db-1 Started 0.5s
⠿ Container hosting-plausible-1 Started 0.5s
```
12. (Optional) Remove backups from the container and the host
```console
> rm plausible_db.bak
> docker compose exec plausible_db rm plausible_db.bak
```