openneo-analytics/README.md
Emi Matchu 72aba0d579 Replace run.sh with an equivalent ansible.cfg
I've learned some more about Ansible, and how to use `ansible.cfg` to
set up `ansible-playbook` to do the same thing as our `run.sh` was
doing! Same number of files, less overhead for the workflow's weirdness.
2024-02-13 08:36:54 -08:00

2.1 KiB

OpenNeo Analytics

This is the deployment code we use to set up and manage analytics.openneo.net, a self-hosted copy of Plausible! It's an analytics service that's unusually privacy-oriented, keeping as little data as possible to give us an impression of trends in usage and what features people do and don't use.

We like to use Ansible playbooks to keep track of how we set up our servers, here's how we've structured them! (We don't use very fancy Ansible features: these are all very basic commands, captured in script form for convenience!)

  • setup-users.yml: Sets up the user accounts for the system, with their SSH keys for login.
  • setup-security.yml: Sets up firewall rules and automatic system updates. (This is a standard playbook I use for all my servers!)
  • setup-nginx.yml: Sets up the nginx reverse-proxy to sit in front of Plausible, including certbot for auto-renewing SSL certificates.
  • setup-plausible.yml: Sets up the Plausible server itself, as a systemd service running Plausible's official Docker container.

You can run them individually, or all at once, with ansible-playbook:

ansible-playbook setup-all.yml

If you're interested in setting up your own Plausible service, this could be useful as a starting point, there's not much custom here! Just a couple things to note:

  • setup-users.yml contains my own username and my own SSH public keys—you'll want to replace those! (Public SSH keys aren't secret, don't worry, I'm fine!)
  • You'll need to create your own copy of files/plausible-conf.env, with your own random secret key. We've omitted ours from the repo for security reasons, but files/plausible-conf.example.env is similar!
  • We used the latest version of Plausible available at the time we deployed, but it's possible you're reading this later. It's worth checking out Plausible's own self-hosting instructions, and making sure your copy of files/docker-compose.yml references the latest versions.
  • This code is distributed under the GPLv3 license; see the LICENSE file for more details.

Hope this helps!