Hosting Uptime Kuma on Fly.io

Uptime Kuma is an easy-to-use self-hosted monitoring tool.

I’ve been using Uptime Kuma for a few projects of mine so here’s how you can host it yourself on Fly.io.

Speedrun:

$ git clone https://github.com/lubien/fly-uptime-kuma.git
$ cd fly-uptime-kuma
$ fly launch \
  --copy-config \
  --auto-confirm \
  --ha=false \
  --name pick-an-unique-name-for-you \
  --now

This will create a 1GB volume and only one machine. If you look at the source, I’ve disabled auto_stop_machines and made min_machines_running = 1 so the monitor is always up.

Hide your Uptime Kuma from the outside world

I’m not a fan of anyone snooping my self hosted things and since the major selling point of Uptime Kuma is alerting I’ve removed public IPs from mine using fly ips release [IP]. You could also change the fly launch command above to use --no-public-ips so they’re never allocated.

To access a hidden uptime kuma you can easily use fly proxy -a KUMA_APP_NAME 3333:3001 and go to http://localhost:3333. If you use an WireGuard app in you computer you could also directly go to http://app_name.internal:3001, that takes some work before you can do it but makes easier for future use.


Let me know your feedback!

15 Likes

Thanks! I got it running in no time.

1 Like

That was a very smooth deploy process.

I like the idea of using OSS tools for something like this. I’ve often decided against it because it’s generally a pain to deploy and keep it online but if the deployment process is so simple then it’s worth considering.

1 Like

Thanks for sharing this! It made it super easy to get up and running.

My app has run out of RAM once or twice (using a free 256MB VM), so I’ve allocated 256MB swap by adding swap_size_mb = 256 at the top level of the fly.toml file. It hasn’t been needed again yet, but should help with occasional spikes.
https://fly.io/docs/reference/configuration/#swap_size_mb-option

2 Likes

As another private/secure access method, Uptime Kuma has built-in support for cloudflared. I used that to set up a Cloudflare tunnel with access control provided by Google authentication. This provides easy, extra secure access to Uptime Kuma without a public IP.

I launched my app with the --no-public-ips arg and used your fly proxy tip to initially tunnel in to get cloudflared set up.

1 Like

Thanks for your effort, I have used your job to deploy a new uptime-kuma instance, works like a champ :smiling_face_with_three_hearts::smiling_face_with_three_hearts:

1 Like

When I do this just as directed, I get this error message

All the good names are already taken of course, so I relaunched with the --name flag and a unique name and all looks to be well so far.

1 Like

Thanks for the heads up, I’ve updated the original post now :pray:

1 Like

Simple and efficient!

Just curious, how your config creates automatically a volume for uptime kuma? By just mentioning the mounts with double square brackets? Any references to the documentation are much appreciated. Thank you!

1 Like

That’s correct. Nowadays flyctl can read your toml and prepare volumes beforehand.

1 Like

I already have my uptime kuma up and running on my fly.io
But how can I upgrade it to the latest version on fly.io?

Changing the image to louislam/uptime-kuma:1.23.13-alpine or something else should do the trick!

Don’t forget to fly deploy after

Is the Dockerfile for the image available?

(reposting because I accidentally clicked the delete button above)

Howdy. There is and its the official one louislam/uptime-kuma:1

1 Like

Thanks, I’ll check it out.

1 Like

Hey guys, I’m also trying to run Uptime Kuma however getting the below after I run the docker compose file:

ERROR: for uptime-kuma  Cannot start service uptime-kuma: OCI runtime create failed: 
container_linux.go:380: starting container process caused: exec: "curl": executable file not found in $PATH: unknown

The docker compose file I used is from the Uptime Kuma website, would using wget fix this? Thank you.

Are you running docker compose build locally? Would you post your build output here?

(Fly does not directly support docker-compose.yml files, but per the posts in this thread, you can get the system running in Fly, using the TOML config file format).

1 Like

Do you mean the docker-compose file? (ignore my stupidity lol)

I don’t understand your question. Fly doesn’t use Docker Compose files.

Let me ask about your problem a different way. How did you run the Docker Compose file, and where did you do that thing? Did you run that on the console in your laptop/computer?

Hi, I just noticed where I was wrong :smiling_face_with_tear: I ran the following file locally but I wanted to run it on Fly, lubiens response above had the answer in front of me :smiley:

version: "3.8"

services:
  uptime-kuma:
    image: louislam/uptime-kuma:latest
    container_name: uptime-kuma
    restart: always
    ports:
      - "3001:3001"  # This maps the container port "3001" to the host port "3001"
    volumes:
      - /path/to/data:/app/data  # Configuring persistent storage
    environment:
      - TZ=UTC  # Set the timezone (change to your preferred local timezone so monitoring times are the same)
      - UMASK=0022  # Set your file permissions manually
    networks:
      - kuma_network  # add your own custom network config
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3001"]
      interval: 30s
      retries: 3
      start_period: 10s
      timeout: 5s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

networks:
  kuma_network:
    driver: bridge```

docker-compose up -d