I recently migrated my self-hosted Fathom Lite from Digital Ocean to a Google Cloud for better scalability and a bigger VPS. Fathom’s recommended solution for HTTPS is to put Fathom behind Nginx as explained here. While doing the server upgrades I decided to swap out Nginx for Caddy. I never used Caddy before and was pleasantly surprised how easy it is to get up and running with Fathom Lite. It’s way easier then setting up Nginx with just 2 lines of configurations.
Before setting up Caddy we’ll need to install and run Fathom with default configurations. Make sure it’s working: http://<public-ip>:8080. Next install Caddy and create the following file and name it
Caddyfile. The first line just needs to be whatever public domain you wish Caddy to configure HTTPS on. The second line determines where to setup the reverse proxy to Fathom.
some-public-url.domain.tld reverse_proxy 127.0.0.1:8080
That’s it. You can try it out by running the following. Assuming you have a DNS record pointing to your public IP then Caddy will automatically generate a Let’s Encrypt SSL cert for your reverse proxy where Fathom is running.
To run the Caddy server in the background simple run:
Ensure both Caddy and Fathom are always running using Systemd service.
run.sh script with the following. This will start Fathom then Caddy then Fathom again in a blocking mode which works best with Systemd service. That way if Fathom would ever crash Systemd could see the crash and simply restart the service.
cd ~/Documents/fathom/ nohup ./fathom s & cd ~/Documents/caddy/ sudo caddy stop sudo caddy start cd ~/Documents/fathom/ pkill -f "fathom s" ./fathom s > ~/Logs/fathom.log 2>&1
Create the following
sudo nano /etc/systemd/system/fathom.service
Add the following contents. Be sure to add in your username and location of your script file.
[Unit] Description=Fathom [Service] User=username ExecStart=/bin/bash /home/username/Scripts/run.sh Restart=always [Install] WantedBy=multi-user.target
After saving run
sudo systemctl daemon-reload to pull in the new configurations and then
sudo systemctl start fathom.service and
sudo systemctl status fathom.service to verify it working.
Finally, try and restart your VPS
sudo reboot. If all is successfully, then your Fathom site should be up and running automatically.