DEV Community

Adam Miedema
Adam Miedema

Posted on • Originally published at cleavr.io

How to install Plausible Analytics on your own server

Plausible Analytics is a great alternative to Google Analyics. Hosting plausible on your own Cleavr managed server gives you
even more control over the usage data that you collect.

We, at Cleavr, have been using Plausible Analytics at Cleavr for the last year. Our main reasons were because:

  • Google Analytics was overbearing and provides more than we really needed
  • We made the decision to not contribute to Google's quest to own all web data
  • Plausible is simple and provides the core usage analytics that we need

The best part, Plausible can be installed on your server in just a few minutes!

We encourage you to consider sponsoring Plausible in some way so that they can keep up the good work. Visit their GitHub sponsorship page.

Prerequisite

Have a server provisioned and ready-to-go in Cleavr.

Step 1: Install Docker Service

In the Services section on the server you are installing Plausible on, install the Docker service.

Plausible wraps up their program in a docker container and so we just need to first make sure Docker is installed on the server.

Step 2: Add Generic Port App

Add a new Generic Port App on the server. Add in the URL you want assign to Plausible Analytics.

For the port number, add in 8000. If you have another app using the port, you can customize the port number.

Step 3: Run Plausibe Quick Script

In the Quick Script section of Cleavr, add a new quick script with the following script:

cd /home/cleavr
mkdir plausible
cd plausible
git clone https://github.com/plausible/hosting
cd hosting
key="$(openssl rand -base64 64 | tr -d '\n' ; echo)"
echo "
ADMIN_USER_EMAIL={{ADMIN_USER_EMAIL}}
ADMIN_USER_NAME={{ADMIN_USER_NAME}}
ADMIN_USER_PWD={{ADMIN_USER_PWD}}
BASE_URL={{BASE_URL}}
SECRET_KEY_BASE=$key
" > plausible-conf.env

docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

Save the quick script and then run it as cleavr user. Add in the required variables for user name, email, password, and url.

After the script finishes running, you will likely get a false error. Verify the URL you used to make sure that Plausible was successfully installed.

Step 3: Verify Installation And Set Up Plausible

Once the script run is complete, navigate to the url you configured Plausible with and verify the login page shows.

From here, log in and set up Plausible for your sites!

Top comments (0)