This guide provides step-by-step instructions for installing and hosting Plausible Analytics on RunCloud servers using the native server installation method. By making the appropriate changes, you can easily modify these instructions for a containerized server installation.
Prerequisites:
- A Docker server connected to your RunCloud account.
- A domain name pointing to your server.
Step 1: Create an empty web application on your RunCloud server
To get started, log in to your RunCloud dashboard. From there, you’ll need to create a new web application.
First, click on the “Web Applications” section; then, click the “Create New” button.
Give your new web application a descriptive name and create a new user account, as it is the recommended best practice.
After that, you’ll need to configure your domain and change the stack type to “Nginx + Custom config” to properly set up Plausible Analytics on your RunCloud server.
Once you’ve done that, click “Create Web Application” to proceed.
Step 2: SSH into the server and navigate to the root directory of your application
In the RunCloud dashboard, click on the web application you just created. In the “SSH Access” section, you can configure your SSH access if you haven’t already.
Next, open up a terminal or command prompt on your local machine and run the appropriate SSH command to connect to your server.
Once you’re connected, navigate to your web application’s root directory using the cd command. If you’d like to learn more about using SSH with RunCloud, we recommend checking out the post titled How To Connect to Your Server via SSH.
Step 3: Clone the Plausible Community Edition
In the terminal, run the following command to clone the Plausible Community Edition repository:
git clone https://github.com/plausible/hosting plausible/
This will create a new directory called plausible in the root of your web application.
Step 4: Run the Docker image
To continue, you must navigate into the plausible directory you cloned earlier. Once in the plausible directory, you must add random keys to the Plausible configuration file. You can generate these keys using the following commands:
openssl rand -base64 48
openssl rand -base64 32
After generating the keys, you must add them to the plausible-conf.env file. If you’re unfamiliar with editing files via the command line, we recommend checking out our post on Using the Nano Text Editor.
Your plausible-conf.env file should look something like this after the edits:
BASE_URL=https://example.com
SECRET_KEY_BASE=8nmqHmHnWXyutYXimakQr/8bppfnCqZjAXhY556OzOQsJzhWCn1S+Tk7MWgK/Vjv
TOTP_VAULT_KEY=e3zuwHOa2evWxkOfG69sZJ7ovZWkBjdcmzkKaV8fmwI=
Once you’ve configured the Plausible settings, you can start the Docker containers by running the following command in the plausible directory:
docker-compose up -d
This will start the necessary containers in the background and get Plausible up and running on your RunCloud server.
Step 5: Configure the Nginx proxy in the RunCloud dashboard
Return to the web application you created earlier to configure the Nginx proxy in the RunCloud dashboard.
In the “Nginx Config” section, click the “Add a New Config” button.
RunCloud makes it very easy to test and manage various configurations. To do so, select a predefined proxy configuration from the dropdown menu.
You can also provide a descriptive name for the proxy config if you’d like.
Next, you must uncomment the appropriate line in the file editor based on your server setup.
- If you’re using a native server installation, uncomment the line that says
# proxy_pass http://127.0.0.1:<port number of your app>;
and replace<port number of your app>
with the actual port number your app is using. - If you’re using a containerized installation, uncomment the line that says
# proxy_pass http://host:<port number of your app>;
and again, replace<port number of your app>
with the correct port number.
If you didn’t change the Plausible config, it uses port 8000 on the Docker machines by default, so you’d edit this line to mention port 8000 depending on your server stack.
Once you are done editing, you can save the configuration to deploy it to your server.
Step 6: Log in to your Plausible dashboard
Once the containers are up and running, you can access your Plausible dashboard by navigating to the domain or IP address of your RunCloud server. You should see the Plausible login page:
After completing these steps, you should have Plausible Analytics self-hosted and running on your RunCloud server. You can now start using Plausible to track website analytics for your projects.