Open Source Web Analytics

07 May 2023

Tags : openshift, web, analytics, plausible

No one is reading your blog ! 😭 Lolz, but seriously how do you know ? i recently stumbled across Plausible - an easy to use, OpenSource and privacy-friendly analytics solution.

Running on OpenShift

Plausible has a very handy self-hosting section in their docs.

I checked out the kubernetes help and modified them to run on OpenShift

# Create a new namespace for all resources
oc new-project plausible
# Create a configmap from the plausible-conf.env file
oc -n plausible create secret generic plausible-config \
  --from-env-file=plausible-conf.env
# Please change the Postgres and Clickhouse passwords to something more secure here!
# Create the Postgres user
oc -n plausible create secret generic plausible-db-user \
  --from-literal='username=postgres' --from-literal='password=postgres'
# Create the Clickhouse user
oc -n plausible create secret generic plausible-events-db-user \
  --from-literal='username=clickhouse' --from-literal='password=clickhouse'
# Deploy plausible
oc -n plausible apply -f ./kubernetes/openshift

Your deployments should look something like this:

Next, i logged into Plausible, created an account, then set the config to disable self registration i.e. in your plausible-config secret

DISABLE_REGISTRATION=true

Next, i added this blog as a target website in Plausible, and put the generated html into the blog header section

    <!-- WebAnalytics -->
    <script defer data-domain="blog.eformat.me" src="https://plausible.apps.sno.eformat.me/js/script.js"></script>

Once deployed, Viola! 🧝 Checkout the public Analytics dashboard link in the nav-bar.

Commentaires