# # HISTORY: # 2024-05-24 * init # 2024-09-15 ! decided not to go with plausible /A # shall still publish for further references /A # = Prerequisites and preparations = Install docker ```bash sudo su apt install apt-transport-https ca-certificates curl software-properties-common install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update apt-cache policy docker-ce apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker run hello-world systemctl enable docker systemctl status docker ``` Pulling code ```bash sudo su mkdir /opt cd opt git clone https://github.com/plausible/hosting plausible ``` Generate and note two salts for configuration file (one for SECRET, one for TOTP) ```bash openssl rand -base64 48 openssl rand -base64 32 ``` Edit configuration file ```bash cd /opt/plausible vi plausible-conf.env ``` Replace base URL with determined and freshly generated salts. ```ini BASE_URL=https://plausible.2dz.fi SECRET_KEY_BASE=kIeJSvP4wkpwuZkyAxxxxxxxxxxxxxxxxxxHmE7wy0VPz0cN3i0o0Pz3dEE TOTP_VAULT_KEY=9Yvk001NDaJfxxxxxxxQgpgIGhOlyeXyyP7/T/qnnDs= ``` Configure Docker compose file ```bash vi docker-compose.yml ``` Build container ```bash docker compose up --detach ``` Configure reverse-proxy (nginx) ```bash vi /etc/nginx/sites-available/plausible.2dz.fi.conf ``` ``` server { listen 80; listen [::]:80; server_name plausible.2dz.fi; access_log /var/log/nginx/plausible.access.log; error_log /var/log/nginx/plausible.error.log; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location = /live/websocket { proxy_pass http://127.0.0.1:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } } } ``` Enable configuration for new server, test and reload ```bash ln -s /etc/nginx/sites-available/plausible.2dz.fi.conf /etc/nginx/sites-enabled/plausible.2dz.fi.conf nginx -t nginx -s reload ``` Enabling SSL ```bash certbot --nginx -d plausible.2dz.fi ``` Troubleshooting ```bash docker ps -a docker stop (id) (id) (id) docker rm (id) (id) (id) docker compose up -d --no-deps --build --force-recreate ``` Ref. ``` https://github.com/plausible/community-edition https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04 https://docs.docker.com/engine/install/debian/ Upgrade: https://github.com/plausible/community-edition?tab=readme-ov-file#install Enhanced config found here: https://github.com/plausible/community-edition?tab=readme-ov-file#example-configurations ```