A few months ago I wrote about how to set up a
Google Cloud Platform instance onto which you could install a docker container called
Uptime Kuma to monitor the status of services on your server. This is essentially the same but using a service called
Fly.io, and while also being free it is arguably more straight forward. Rather than go into the 'why and why not' part of whether this is something you need or should have, let's jump right in.
- The ability to access your server's command line via a terminal or SSH
- Sudo/root privileges inside your terminal to edit files
Setting up Fly.io
This section will talk you through the steps needed to set up a connection to fly.io from your terminal, but you can always follow along with their documentation here.
- Open up a terminal/SSH session to your server and log in with your user (it doesn't need to be an admin)
- Type the following command:
curl -L https://fly.io/install.sh | sh
When you do this, there's a chance you'll get the following output (or something similar):
flyctl was installed successfully to /var/services/homes/[USERNAME]/.fly/bin/flyctl Manually add the directory to your $HOME/.bash_profile (or similar) export FLYCTL_INSTALL="/var/services/homes/[USERNAME]/.fly" export PATH="$FLYCTL_INSTALL/bin:$PATH" Run '/var/services/homes/[USERNAME]/.fly/bin/flyctl --help' to get started
This might look a little confusing, but is pretty simple.
- Copy each line that begins with
exportand run them individually (there will be no printed output)
- Then type
ls -aland enter. You should see that you have a file called
- Whichever one you have, you need to edit and paste those two export lines to the end of them
touch ~/.bashrc, then continue to edit it with
- It will also be helpful to then run
~/.bash_profile) to make this persistent
flyctl auth signupand follow the instructions
- After that, or if you already have an account, run
flyctl auth loginand follow the instructions
That's it, you're all signed in and ready to begin making your
Uptime Kuma app....
Creating your UptimeKuma container on Fly.io
This can be done either via your command line/terminal, or via their app. I'll show you how to use the former.
flyctl launch --image louislam/uptime-kuma:latestinto your cli and press enter
- Follow the onscreen instructions, bear in mind that the
App Nameneeds to be something unique, and will form the first part of the subdomain URL you'll be given later on
- It will ask you if you would like to set up a Postgresql database and deploy now, hit
- If you do another
ls -al, you should now see a
fly.tomlfile in your home directory. Open it in your editor, and make sure it looks like the following:
- Save the above, then run
flyctl launch. After a lot of output, you'll see an error
Mounts source volume "kuma" does not exist. No problem, simply run
flyctl volumes create kuma, choose your region again, and it will create it for you
- Now run
flyctl deployand your container will be spun up
Remember how I mentioned you'd be given an URL to access your Uptime Kuma instance? Typing in
flyctl status will return a couple lines of information, one of which will be
Hostname. Type this into your browser, and you'll find yourself directed to the Uptime Kuma welcome page where you can create your credentials.
The first thing I would do is create your login credentials and then enable 2FA in the settings. You don't own this server, and so you want to make your service on it as secure as possible.
Set up your monitors and notification service
Next, play around with the Uptime Kuma service, set up your monitors and your notification method (I use Pushover).
Note that Fly.io could change their business model or availability whenever they want. Some people might be tempted to put more sensitive information or services on their servers (for instance Vaultwarden) and if that sounds good to you, be aware that you could lose that access at any time.
Monitoring the monitor
By signing into your account's dashboard at https://fly.io, you can check out how your instance is behaving and its resource usage. It's worth noting you only get 256MB RAM and a single shared CPU core, however I've had around 20 monitors running in Uptime Kuma and RAM hasn't gone over 200MB.
Updating Uptime Kuma
Whenever a new image is available, this is as simple as typing
flyctl deploy again into your terminal. How you track a newly available image though is up to you...