The Ops Community ⚙️

Cover image for Plausible Manual Setup
Akilesh
Akilesh

Posted on

Plausible Manual Setup

From the previous post, you know that plausible is a simple, lightweight, open-source alternative to Google Analytics.

Check out their service, which offers a variety of features and seamless integration in under two minutes.

We will self-host plausible in a cloud. All the configurations and the services used in this post could be modified according to your needs.

Digital Ocean

You need a digital ocean account to create a cloud server.

You can feel free to choose your own cloud service provides (AWS, Azure,...) to create a instance.

Droplet

  1. Create a new droplet aka server by clicking the
    Create > Drolets.
    Image description

  2. Choose a Linux distributor you are good at using. I'll choose Ubuntu.
    Image description

  3. Choose a datacenter region located close to your current location.

  4. The authentication process in the cloud is a tricky one. We will use the SSH key to secure our droplet to know more about how to connect using SSH. Refer to this blog.

  5. All the setting up process is done, you can click the create a droplet and wait for a few minutes until the droplet gets ready to run.
    Image description

Droplet Console

For the shake of our covenant, we will use an inbuilt web - based terminal console to access our droplet.

Image description

1) Lets first clone the plausible/hosting repo.

$ git clone https://github.com/plausible/hosting
$ cd hosting
Enter fullscreen mode Exit fullscreen mode

Image description

2) We have access to mess with two files and explore what they need to offer docker-compose.yml & plausible-conf.env

Image description

In plausible-conf.env we need to fill the required parameters
for these placeholders.

ADMIN_USER_EMAIL=replace-me
ADMIN_USER_NAME=replace-me
ADMIN_USER_PWD=replace-me
BASE_URL=replace-me
SECRET_KEY_BASE=replace-me
Enter fullscreen mode Exit fullscreen mode
  • SECRET_KEY_BASE Now to set the parameters we'll first need a random 64-character secret key which will be used to secure the app. Use the below command to generate one.
$ openssl rand -base64 64 | tr -d '\n' ; echo
Enter fullscreen mode Exit fullscreen mode

Now edit plausible-conf.env and set SECRET_KEY_BASE to your secret key.

  • BASE_URL It should be the base URL where this instance is accessible, including the scheme (e.g. http:// or https://), the domain name, and, optionally, a port. If no port is specified the default 8000. ex: https://1x9.5x.x6.x4:8000
  • ADMIN_USER You just fill your details email id, User name: Password (PWD).

Reference

ADMIN_USER_EMAIL=2112akilesh@gmail.com
ADMIN_USER_NAME=akilesh
ADMIN_USER_PWD=xxxxxxxxxx
BASE_URL=https://1x9.5x.x6.x4
SECRET_KEY_BASE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Enter fullscreen mode Exit fullscreen mode

Start the server

Docker installation commend on ubuntu

$ apt install docker-compose
Enter fullscreen mode Exit fullscreen mode

Once you've entered your secret key base, base URL and admin credentials, you're ready to start up the server:

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

This commend will execute the following process:

  • Creates a Postgres database for user data
  • Creates a Clickhouse database for stats
  • Runs migrations on both databases to prepare the schema
  • Creates an admin account (which is just a normal account with a generous 100 years of free trial)
  • Starts the server on port 8000

To check your docker status, run this commends in your terminal:

sudo systemctl status docker
Enter fullscreen mode Exit fullscreen mode

Image description

You can now navigate to http://{hostname}:8000 and see the login screen.

Image description

After logging process, add your domain to plausible and repeat the process that we did in their paid tier.Reference.

Image description

History Repeats🔄

Top comments (1)

Collapse
 
akilesh profile image
Akilesh

Self hosting error

Refer this if you have blocked loading mixed active content error message.
stackoverflow.com/questions/206054...