Experimenting With Coolify
This post serves as a quick introduction to Coolify, and my thoughts about it after playing around with it over the weekend.
What is Coolify?
Coolify is a platform as a service (PaaS), like Heroku or Vercel, which allows you to easily deploy your applications, databases and other services to the web. The USP of Coolify in comparison to other PaaS providers is that you self-host it on your server. It is fully agnostic with no lock-in, so you can run Coolify anywhere really, from AWS to your Raspberry Pi.
It has some pretty nifty features out of the box, these include: Full support for docker workflows (via docker-compose files), automated deployments when you push git commits, as well as webhooks for integrating with CICD pipelines such as github actions (though I’ve not tried this personally). It can also handle SSL certificate generation for your applications with custom domains via lets encrypt (this has been hit and miss for me though).
Lastly it has a clean but somewhat clunky to navigate UI, which is welcome compared to other self-hosted alternatives like Dokku, which don’t come with a UI by default.
Getting started
I span up the cheapest VPS I could find, and installed it. The installation process is pretty straightforward, you just copy and run a command and it will automatically install it on your server.
Once Coolify is installed, you’ll be able to access it in your browser by going to the VPS ip address:8000. From there you’ll need to setup an admin account and go through the on-boarding process, which is pretty straightforward so I won’t go into details here. One important thing to note is if you plan to deploy your applications on the same server that is running Coolify, then make sure to select ‘Localhost’ during onboarding and not ‘remote server’.
Coolify organises your apps into ‘Projects’. In order to deploy something, you need to define a project first. A project can have one or more resources tied to it. These resources can range from databases, cache services, headless browsers, to a whole host of various open source tools. You can of course also provide your own Dockerfiles or docker-compose files to spin up the resources you need. Coolify also has a GitHub integration that allows you to deploy your applications (provided they have at least a Dockerfile in the repository) automatically everytime you push to the main branch.
If you want to use a custom domain for your app, you’ll need to add an A record in your domains DNS provider that points to the IPv4 address of the VPS that Coolify is running on (and/or an AAAA record if you’re using IPv6). I’d recommend defining a wildcard route (*) when doing this to save yourself time when deploying apps in the future. The end result is you can then deploy apps on Coolify, and setup a custom domain in the form of app-name.your-domain.com to access them.
Deploying a Hugo static site
I tried running this blog on Coolify, after much trial and error, I did manage to get it running. I had to create a nixpacks.toml file (I also had to specify my ‘hugo.toml’ file in the ‘hugo’ build command, if you have called it ‘config.toml’ instead, then it should detect it automatically),then configure the app to run via nixpacks in Coolify rather than as a simple static app. Nixpacks simply takes your application, and builds it into a docker image.
Once the app was running and accessible, I setup automated health checks (once enabled, you can also setup notifications to alert you when the service goes down), as well as some basic metrics, like CPU and memory usage. The built in metrics in Coolify were a little disappointing if I’m honest, but it is beta software afterall, and FOSS, so I can’t complain too much.
Closing thoughts
I’ve only had a brief tinker with Coolify over the weekend, I haven’t had nearly enough time to try all the features it has to offer, but from what I have seen so far, it’s pretty cool (no pun intended)! The UI is intuitive enough, I only had to do some research whilst trying to deploy this blog onto Coolify, as the default static site deployment approach was just not working for me. I also deployed a .NET API that I’m currently working on as another test, and it worked pretty well for the most part. It was easy to deploy, (due to the project having a docker-compose file), but I had trouble getting SSL support running with my custom domain, so unfortunately I couldn’t access the app in the browser. Given more time, I’m sure I would get it working, it’s just disappointing that it didn’t work for me out of the gate :(
I’ll keep playing around with this over the coming weeks as I wish to self host more of my apps, as well as make use of more of the features that Coolify has to offer. I’ll probably come back to this post with more findings in the future. I’ll also look to try some other alternatives that I found like Dokku and Kamal, and compare the pros and cons of each.