From c9e8c8ce991dca1c3bd5848f44f3b1d86d5c9b43 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Fri, 12 Jun 2020 18:06:49 +0300 Subject: [PATCH] Docs (#82) * Add note on Architecture & Requirements * Add status front matter * Add note on geolocation --- HOSTING.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/HOSTING.md b/HOSTING.md index 624694f30..13ee8d0d6 100644 --- a/HOSTING.md +++ b/HOSTING.md @@ -1,7 +1,27 @@ +--- +status: Beta +--- + # Plausible Analytics -Self-hosting is possible based on the docker images and are automatically pushed into [Dockerhub](https://hub.docker.com/r/plausible/analytics) registry for all commits on `master` branch. At the moment, `latest` is the only tag on DockerHub as we haven't reached a stable -release of self-hosted Plausible yet. +Self-hosting is possible based on the docker images and are automatically pushed into [Dockerhub](https://hub.docker.com/r/plausible/analytics) registry for all commits on `master` branch. At the moment, `latest` is the only tag on DockerHub as we haven't reached a stable release of self-hosted Plausible yet. + +### Architecture + +Plausible runs as a single server, backed by two databases: PostgreSQL for user data and ClickhouseDB for the stats. When you +download and run the docker image you also need to provide connection details for these two databases. + +Most hosting providers will offer a managed PostgreSQL instance, but it's not as simple with Clickhouse. +You can [install Clickhouse on a VPS](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-clickhouse-on-ubuntu-18-04), +run it using their [official Docker image](https://hub.docker.com/r/yandex/clickhouse-server/), or use a managed service provided by +[Yandex Cloud](https://cloud.yandex.com/services/managed-clickhousec). [Aiven has announced](https://landing.aiven.io/2020-upcoming-aiven-services-webinar) that they are planning offer a managed ClickHouse service in the future and more hosting providers are following suit. + +As of June 2020, here's the setup of the official cloud version of Plausible for reference: +* Web server: Digital Ocean Droplet w/ 1vCPU & 2GB RAM. Managed via the [official Docker app](https://marketplace.digitalocean.com/apps/docke://marketplace.digitalocean.com/apps/docker). +* User database: Digital Ocean Managed PostgreSQL w/ 1vCPU & 1GB RAM. +* Stats database: Digital Ocean Droplet w/ 6vCPU & 16GB RAM. Installed on Ubuntu 18.04 using the [official tutorial](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-clickhouse-on-ubuntu-18-04) + +Total cost: $105/mo ### Building Docker image Besides the DockerHub registry, one can build docker image from [Dockerfile](./Dockerfile). @@ -129,6 +149,17 @@ For performance reasons, all the analytics events are stored in clickhouse: - CLICKHOUSE_DATABASE_POOLSIZE (*Number*) - A default pool size for connecting to the database, defaults to *10*, a higher number is recommended for a production system. +### IP Geolocation + +Plausible uses the GeoLite2 database created by [MaxMind](https://www.maxmind.com) for enriching analytics data with visitor countries. Their +end-user license does not make it very easy to just package the database along with an open-source product. This is why, if you want +to get country data for your analytics, you need to create an account and download their **GeoLite2 Country** database. + +Once you have the database, mount it on the Plausible docker image and configure the path of the database file: +- GEOLITE2_COUNTRY_DB (*String*) + +If the Geolite database is not configured, no country data will be captured. + ### External Services - [Google Client](https://developers.google.com/api-client-library)