Code Monkey home page Code Monkey logo

plausible_on_dokku's Introduction

Plausible Dokku Maintenance

Run Plausible on Dokku

Perquisites

What is Plausible?

Plausible is a lightweight and open-source website analytics tool. No cookies and fully compliant with GDPR, CCPA and PECR.

What is Dokku?

Dokku is a lightweight implementation of a Platform as a Service (PaaS) that is powered by Docker. It can be thought of as a mini-Heroku.

Requirements

Setup

Note: Throughout this guide, we will use the domain plausible.example.com for demonstration purposes. Make sure to replace it with your actual domain name.

App and plugins

Create the app

Log into your Dokku host and create the Minio app:

dokku apps:create plausible

Install, create and link PostgreSQL and Clickhouse plugins

# Install Dokku plugins
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku plugin:install https://github.com/dokku/dokku-clickhouse.git clickhouse
# Create running plugins
dokku postgres:create plausible
dokku clickhouse:create plausible -i clickhouse/clickhouse-server
# Link plugins to the main app
dokku postgres:link plausible plausible
dokku clickhouse:link plausible plausible

Configuration

Setting up secret key

dokku config:set plausible SECRET_KEY_BASE=$(openssl rand -base64 64 | tr -d '\n')

Setting up BASE_URL

dokku config:set plausible BASE_URL=https://plausible.example.com

Setting up SMTP information

dokku config:set plausible [email protected] \
                           SMTP_HOST_ADDR=mail.example.com \
                           SMTP_HOST_PORT=465 \
                           [email protected] \
                           SMTP_USER_PWD=example1234 \
                           SMTP_HOST_SSL_ENABLED=true

Disable registration (optional)

dokku config:set plausible DISABLE_REGISTRATION=true

Domain

To enable routing for the Plausible app, we need to configure the domain. Execute the following command:

dokku domains:set plausible plausible.example.com

Push Plausible to Dokku

Grabbing the repository

Begin by cloning this repository onto your local machine.

# Via SSH
git clone [email protected]:d1ceward/plausible_on_dokku.git

# Via HTTPS
git clone https://github.com/d1ceward/plausible_on_dokku.git

Set up git remote

Now, set up your Dokku server as a remote repository.

git remote add dokku [email protected]:plausible

Push Plausible

Now, you can push the Plausible app to Dokku. Ensure you have completed this step before moving on to the next section.

git push dokku master

SSL certificate

Lastly, let's obtain an SSL certificate from Let's Encrypt.

# Install letsencrypt plugin
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git

# Set certificate contact email
dokku letsencrypt:set plausible email [email protected]

# Generate certificate
dokku letsencrypt:enable plausible

Wrapping up

Congratulations! Your Plausible instance is now up and running, and you can access it at https://plausible.example.com.

Possible issue with proxy ports mapping

If the Plausible instance is not available at the address https://plausible.example.com check the return of this command:

dokku proxy:ports plausible
### Valid return
-----> Port mappings for plausible
    -----> scheme  host port  container port
    http           80         5000

### Invalid return
-----> Port mappings for plausible
    -----> scheme  host port  container port
    http           5000       5000

If the return is not as expected, execute this command:

dokku proxy:ports-set plausible http:80:5000
# if you also setup SSL:
dokku proxy:ports-set plausible https:443:5000

If the command's return was valid and Plausible is still not available, please create an issue in the issue tracker.

Bonus : Rename script file

By default, Plausible will use a file called /js/plausible.js which is blocked by most adblockers. To overcome this, you can add an Nginx configuration file: vi /home/dokku/plausible/nginx.conf.d/rewrite.conf:

rewrite ^/js/pls.js$ /js/plausible.js last;

Rename pls.js to whatever fits your need, and use this file name from now on.

plausible_on_dokku's People

Contributors

d1ceward avatar neamar avatar weisisheng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.