Stop! Wait a moment!
Do you want to change your life? Join me on my 50-Day Life Transformation Challenge. Get involved! It won't cost you anything except a few bad habits.
Stop! Wait a moment!
Do you want to change your life? Join me on my 50-Day Life Transformation Challenge. Get involved! It won't cost you anything except a few bad habits.
Plausible is a minimalistic and DSGVO-compliant alternative to Google Analytics. It works completely without cookies and is also open source. Quite a few good arguments. It's high time to turn my back on Google Analytics anyway, so I'm taking a closer look at Plausible
The goal: Give Plausible a chance and install my own Plausible server on a DigitalOcean droplet to track this website.
Overview:
You need nothing more than a freshly launched DigitalOcean droplet (of course, you can use any other provider. These instructions should work anywhere). I decided to use a small Droplet:
The performance should be perfectly sufficient for one page.
Click here to get a $100 Digitalocean credit for free.
sudo apt update && sudo apt upgrade
In the next step, I install Docker and Docker Compose
sudo apt install docker.io docker-compose
Now I m cloning the Plausible hosting repository. This is already prepared and includes everything you need to run a Plausible server:
mkdir docker
cd docker
git clone https://github.com/plausible/hosting
mv hosting plausible
cd plausible
In the cloned repository, there is a plausible-conf.env that we still need to customize:
The values here are largely self-explanatory:
ADMIN_USER_EMAIL: Email address of administrator
ADMIN_USER_NAME: username of the administrator
ADMIN_USER_PWD: Password of the administrator
BASE_URL: URL via which the plausible server can later be reached
SECRET_KEY: A randomly generated secret key.
For example, such a key can be created like this:
openssl rand -base64 64
Important: It is mandatory to prefix the BASE_URL with "http://" or "https://", otherwise the Docker container will abort during the installation of the system.
After making the configuration adjustments, I can start the Plausible Server:
docker-compose up --detach
By the way, the option "--detach" or even just "-d" will start the Docker container in the background.
The initial startup of the Plausible server takes some time. It creates a Postgres and a ClickHouse database for the user and tracking data, and a migration script sets up the database tables.
As an aside: ClickHouse is an open source database that is column-oriented, making it especially useful for evaluating large datasets in analytics. Thus, reports can be generated in real time.
Now I m already able to access my Plausible server via http://example.com:8000. However, since I want to open it up to the outside via port 80 and also use a Docker container or two on the server, I set up a reverse proxy. The reverse proxy basically routes all browser requests via the default port 80 to the local Docker container under port 8000.
sudo apt install nginx
So, I first create a configuration for the Plausible Reverse Proxy. To do this, I change to the NGINX configuration directory for the virtual hosts:
cd /etc/nginx/sites-available
nano plausible.con
NGINX Reverse Proxy Configuration for Plausible:
server {
listen 80;
listen [::]:80;
server_name plausible.example.com;
location / {
proxy_pass http://localhost:8000;
}
}
Replace plausible.example.com with the domain under which you want to reach your Plausible server later. Remember to create an A-record to the IP of the DigitalOcean droplet in your domain's DNS settings.
After saving the NGINX configuration, I still need to create a symbolic link to this file in the /etc/nginx/sites-enabled directory:
ln -s /etc/nginx/sites-available/plausible.conf /etc/nginx/sites-enabled/plausible.conf
sudo service nginx start
sudo apt install certbot
sudo apt install python3-certbot-nginx
sudo certbot --nginx -d plausible.example.com
Done! Now I can reach the Plausible server at https://plausible.example.com.
I can now log into my Plausible server with the credentials I entered in the plausible-conf.env above.
In the next step, I can immediately create an initial site to be tracked.
Comments