--- layout: post title: "Self-Hosting Fathom Analytics with DigitalOcean" date: 2021-02-02 --- Since my previous post walked through the process of setting up Fathom PRO on Netlify, I figured it made sense to create a similar tutorial for the "Lite" variation, self-hosted on DigitalOcean. Please note that while I think the PRO version of Fathom Analytics is truly great, for my small, niche blog it seemed overkill compared to self-hosting. Switching over from $14/mo to $5/mo while retaining most of the same functionality was a no-brainer. Choose the option that best suits your needs (or in the case - budget & bandwidth). With that cleared up - let's get into it! ## Prerequisites 1. One or more website(s) where you would like to include analytics 2. DigitalOcean account (**this link will give you a $100 credit!**) 3. Positive attitude and passion for privacy-respecting analytics! ## Create a Droplet Once your DigitalOcean account is setup, navigate to the Marketplace and search for `Fathom Analytics`. Then click the `Create Fathom Analytics Droplet`. From here you'll be brought to a page that allows you to customize the specifications of your new droplet. If you're a smaller traffic site (personal blog, etc) selecting the **$5/month** Basic Shared CPU option is your best bet. Select the data-center region based on where most of your traffic originates from. I would suggest enabling `IPv6` and setting up your authentication via SSH instead of a regular password system. Adding backups is entirely at your own discretion. Once you're ready, click **Create Droplet**. ## Enter the Matrix (not really) Once DigitalOcean finishes spinning up your new droplet, open a terminal and connect to it by entering: ssh root@YOUR_DROPLET_IP If you setup your login via SSH everything should work as-is. If you went the password route, you'll given a prompt to enter it. Now that you're connected, Fathom will guide you through a simple configuration setup. It's fairly straightforward and painless. Once complete, move to the next step. ## Domains You'll most likely want to host this instance on your own domain or subdomain - instead of connecting directly via the droplet's `IP`. Head over to your **Networking** page in the sidebar of DigitalOcean and add your custom domain. Then, click on that newly added domain - we need to add some new records. You're going to add two new `A` records to this domain:
Type | Hostname | Value |
---|---|---|
A | @ | YOUR_DROPLET_IP |
A | www | YOUR_DROPLET_IP |