📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Coolify: The Ultimate Self-Hosted Platform as a Service?

Christian Lempa35:40

Transcription

Hey guys, it's Christian and in today's video I'm going to show you Koolifi.

This is an open-source platform that lets you easily deploy any type of applications, services or databases on your own hardware. It's actually in the same category as something like Heroku or Versal, which are both developer platforms that take your replications plus some settings and turn them into live deployments.

Don't worry if you're not familiar with any of these platforms at all. In practice, it simply just means that you bring your application, which often is a NodeJS, Python or Go project. And these of course all need an environment with runtime dependencies, environment variables, sometimes a database. And that is exactly where these platforms like Hioko or Versal became so popular because instead of manually setting up servers or dealing with deployment steps and release workflows, you typically just connect a git repository where you upload the source code of your application and these platforms will handle all the other steps for you.

So they will build your application often in a container image and then deploy it in a large scaled cloud infrastructure and they often also take care of domains, HTTPS certificates, versionings, roll backs and stuff like that. Cutify is something like this too, but with a few important differences that make it especially interesting for HomeLab fans or self-hosting nerds like us.

First of all is that you keep control of everything. So the applications actually run on your own servers. So you get the convenience of a modern platform as a service or serverless architecture but without handing everything over to a third party cloud vendor. And that isn't just great for privacy and data sovereignty. In most cases, it is also simply much cheaper to run applications on your own servers at home or even on your preferred and super cheap VPS provider instead of having to pay the huge cloud vendor bills.

So that's why I thought it might be super interesting to take a look at it together. So let's install Coolify on two of my testing servers. After all, I've also got so many things to say about it. Many good things, but also a few not so good things. So let's just run through the basics together. And at the end of the video, you will have a good understanding about what Cudify actually is and whether you want to give it a try in your home lab as well.

Now, before we jump right in, I also want to show you another amazing tool that helps you to manage all of your tech and home lab projects. Because if you're trying to balance multiple projects and tasks like I do, it is really easy to lose track. And simple tools like spreadsheets or notebooks, they just don't do the job. And that is exactly where monday.com jumps in. It's an all-in-one work platform for managing complex projects for easy collaboration and also automating repetitive work.

monday.com is incredibly easy to use. Yeah, you can very intuitively create any type of to-do lists, add custom fields or change priorities and so many other things of your tasks and projects. What I personally absolutely love are the canban boards because they provide you a great high-level overview of all the tasks and their status where you can easily drag and drop items and you can even create advanced workflows by linking boards and setting dependencies. This is really perfect for tracking open issuers, prioritizing or delegating tasks across technical teams. And what tech people will also love is that you can easily write markdown based documentation files directly in monday.com and share this with your technical team.

With the free plan of monday.com, you already get up to two seats with free boards, unlimited docs, and eight column types, which is great for smaller projects. But of course, if your project grows over time or you want to use it in larger teams and organizations, you can easily upgrade to higher plans as well to increase the features and integrate monday.com into other systems like use it for coordinating emails or sending out files and Slack messages. So to get started, you can try out monday.com completely for free by heading to the link in the description box down below to get your projects organized today.

Okay guys, so now let's get started with setting up CIFI. By the way, if you want to get more information about this project, then head over to the official website koolifi.io. So there you can read all about the features, about the capabilities. There's also a nice page that explains the open source philosophy of the development and what that means to the project as a whole. There's of course also a link to the official documentation that we will later use to install this application.

And uh by the way, there's one thing that I probably should explain at first because when you're reading this website and you're reading all the good news about the open source philosophy, the self-hosting, running everything on your own hardware, you might be a little confused by seeing this button cloud here next to self-hosted. And you might be wondering how is this then different from something like a Hoko or Versal where you also have a cloud service offering. where the important difference is that although Koolifi has a cloud service version is that this actually just runs the main controlling platform of Koolifi.

So the cloud service just costs $5 a month where you can easily connect two of your servers plus $3 per month for each additional server. So that means the main Coolifi platform runs on a managed infrastructure. But for the actual applications to be deployed and running, you always have to bring your own servers. So there's no way in the cloud version of Koolifi to deploy applications in a managed infrastructure. You always have to set up either your own servers or connect any virtual or dedicated servers you might be running on your favorite VPS provider. This might probably be the easiest way to run everything because that of course makes things like the certificate management and stuff like that easier.

But if you prefer to run completely everything on your own hardware, not just the application servers, but also the main Coolifi platform, you can also choose to use the self-hosted version, which is by the way what we are doing in this video. So there you have full access to all features. There are no limitations or restrictions, but of course you need your own infrastructure for Koolifi, which means you need one server for the main Koolifi platform. Plus, you need at least one or more servers for the application deployments.

Before you begin, you should check if your server meets the requirements. So, you need a server with SSH access. That could be a virtual private server somewhere on a cloud provider. It could be dedicated server virtual machine maybe running on your Proxmox environment. It could be even a Raspberry Pi or basically any other uh Linux-based operating system with SSH. The Linux distribution supported are mentioned here as well. So, anything that is Debian based. So Ubuntu, Debian, that will all work. Also, Reddit based, Zoua, Arch, Linux, Alpine, and even Raspberry Pi OS are supported with AMD 64 or ARM 64 uh CPU architecture. So that is good news.

For the main CIFI server, you need at least two CPU cores, 2 gigs of RAM, and 30 GB of storage. So these are the minimum hardware uh requirements. Of course, more is better, but yeah, that's what your server needs at least. And this is only for the main CIFFy platform server where you theoretically could also deploy applications on. But this is not really recommended. Recommended is that you have separate servers which also could be virtual servers, Raspberry Pies or whatever for running the actual production applications. And these usually need a little more resources. That of course very much depends on the resources that the actual applications require. So in this example setup, it's mentioned like 8 gigs of memory, four CPU cores, and 150 GB of storage would be enough for these type of projects. So that is what you typically would want to run on a server like this.

And there are also different installation methods. So you could run the quick installation script, which is what we're doing in this video. But if you prefer a more manual installation, if you want to have a little more control or customized setup, you could also just download the actual Docker Compose files. And then you can also customize them a little if you want. But honestly, I think it is better to run the quick installation script. That's also recommended uh by the documentation because this will set up everything for you. So it will prepare the server. You just have to log in as root user configure SSH by following these guides and set up your firewall and then it's installing the Docker engine. It's downloading all the files completely for you.

For this demo project, I have prepared these two virtual servers on my Proxmox environment. So here is the Coolifi test server. So this will become the main controlling part with the minimum requirements mentioned in the documentation. And I've also added one virtual machine that is a little more powerful. That will later be the deployment server. Let's first of all start these virtual machines. By the way, these are both Ubuntu Linux servers, but of course, you probably could also use any other operating system mentioned in the documentation.

Okay guys, so first of all, I want to connect over SSH to the Coolifi test server. And the next step is actually pretty simple. I will just copy this installation script and run it. Oh no, there's one thing that is super super important for my setup. And this probably will only happen to just a few of you guys. But the main issue I had with Koolifi is that this installation script will create a new Docker network. So for the uh containers that the Koolifi server will need to run and it will use a 10008/8 network for this, which is super dumb because my internal network uses the same IP range. So all of my servers are in the 10.x x 000016 networks and this of course doesn't work if there is an internal Docker network in the same uh subnet than my physical networks. I know that probably not many of you will use a 10.x network in their home labs. Most of you will have 1921 168 blah blah blah and then it probably will never be a problem. However, if you have kind of a similar setup and you might fall in this trap, then you need to customize some of these settings here.

So, here in this documentation, it is described what you have to do. You just need to copy this here, modify the Docker address pool base. So, in my case, I'm just going to set this to the default Docker IP pool size 172600 /12. And then the Docker address pool size is yeah you can set up 10 20 depending on if if you need more uh networks for your applications. And then you pass these variables to the installation script. Uh of course I forgot to set this as root user. So I'm going to log in with uh root and then execute this here.

All right. So now it's running the CIFI installer. This script will do everything for you. Sit back and relax. It will also tell you funny jokes or not so funny jokes. Honestly, I prefer more professional application installers. I think this is a little silly, but yeah. All right. So, this went through all of the installation steps, checking the Docker configuration, downloading required files from the CDN, setting up environment variables. So, it's doing many things in the background. And then it's installing Cudify. It's currently running the version 400 beta. So, we are getting the latest and greatest at least uh at the time of recording this video. So this might take a few minutes depending uh on my internet connection.

Okay, so that has been finished. Now it's starting the containers and yeah, so I think everything should work fine. By the way, if you want to modify the compos project for whatever reason, you find all the files in the / data directory. So here's a new directory with coolify where you find the applications, backups, databases. I think it's in source. So yeah. So here you have the docker compos files that will start the project and an upgrade script if you need that. But yeah, usually you don't have to touch the main CUDIF server or the project at all. So I will just exit and then you can simply access this platform by opening a new browser window and head over to the IP address or the DNS name of your server on the port 8,000.

All right, let's continue. Now you have to create your admin account. set up an email address and type in a secure password. And now you can set up your first application server. You can choose a server type to deploy your applications and databases on. So I'm going to choose remote server. And now we of course need to set up SSH authentication. You could use an existing key if you already have a secure SSH key or you could create a new key pair that you have to upload on your deploy server. So I think I'm just going to say generate new key pair. Going to give this a name. Deploy server key. I think that's fine. Created by Koolifi. And this is a private RSA key and the public key that you can use. So the public key um you have to upload to your deployment server. The private key is stored inside the Koolifi application server. Of course, you need both key pairs to set up a secure SSH authentication. Uh, so let's just copy this one here and let's connect to my deploy server. I'm just going to open a secondary tab. Coolify test deploy server home.crave.de. Uh, yes. So I'm also going to log in as root and navigate to the /root directory. So here here you should see the SSH directory cd into this. And usually there is an authorized key file already existing here. If it isn't, then just create this file. Yeah, then it can be empty. That's fine. But in the case of uh an Ubuntu Linux distribution, you will have this in here. So this line here that um prevents the root user uh from logging in over SSH directly. If you try that, you will get this error message here. So that you have to log in with that user here. So just remove the beginning line if it's existing and then in the second line or below your other public SSH keys just paste the coolify generated SSH key and save the changes to the file. And then I'm just going to click save key.

And now we need to set up the server configuration. So here you need to give the server a name. Of course, I'm going to set this to coolify test deploy server and the IP address of the server. I don't know. I'm just going to check that out. I think it is 10223. Ah, yeah. Okay. 223. That's fine. Let's uh click on validate connection. So here the Koolifi uh server will automatically install the docker engine if it is not present on the remote server because any application that you deploy uh will usually be created in a docker container. Therefore it obviously requires the docker engine. So let's click on start validation. Oh yeah. So server is not reachable. Permission denied. Public key password. Oh yeah I forgot to do a few other things here. It's not so easy to log in with root user to a remote server. You just need to edit the etc. SSH ssh_config files. So here usually are your SSH server settings where I can change the port, the listening address and stuff like that. It might be recommended if this is a cloud server that you set up something like a firewall so that only the public IP address or the internal IP address of your Koolifi server can actually connect. But yeah, I'm not going to discuss this topic right now. I'm just going to set the permit root login and set this to yes. And now we just need to restart the SSH service by using systemctl restart ssh. And then let's go back to the cooly server. Click on retry validation. And that now should work. So it's so now it's checking a few things if the operating system is supported. uh if the prerequisites are installed and stuff like that and then it starts installing the docker engine, docker compose and once that is done you can start creating your first project and deploy your first resource or just continue go to the dashboard and now you're logged into the main Koolifi platform.

Okay guys, so now that we have a running setup, we could theoretically already start deploying applications, building container images and connect our Git repositories and stuff like that. But before we do that, I want to show you around and show you some important configuration settings in the Cudifi platform because Kudify does many many things under the hood and it assumes that you're doing these things in a specific way. If you don't, you might have some conflicts with existing setups. I will show you later how to fix some of these problems I ran into. But at first, I think we should tweak our self-hosted installation of Coolify because um one thing that really uh annoyed me at first was that we are uh still using an unencrypted connection on port 8000 to manage the main Coolifi setup. Of course, if you're using the cloud hosted version of Koolifi and just connect your local servers for application deployments, you will not have this issue because they will manage HTTPS and all of that stuff for you. But if you like to run this completely on your own infrastructure, I think this is not a good setup by default. So therefore, we need to tweak a few settings here.

So first of all, go to the main settings. So this is the instantwide setting for Koolifi where you could set up a domain and give this Koolifi platform a name. You also have the instance public IP address if you're running this on a VPS in the cloud. And you can also set some advanced settings like configuring DNS servers for validation and stuff like that. Here uh we need to enter the fully qualified domain name of the instance including HTTPS if we want to secure the dashboard with HTTPS. So let's hit enter https and then just use this name here coolest.home.ccreative. Let's just call it schoolify test and the instance time zone. We're also going to update to Europe Berlin. All right. Okay. So validating DNS failed. Make sure you have added DNS records correctly. Uh okay. So that of course is a problem because um I didn't add this to my um DNS server. But we can easily change this by going in here this DNS validation and [snorts] add a custom DNS server. In my case I'm using my local bind 9 DNS server where this record should be existing. Then you by the way should also change the instance public IP address if this is only routed locally. So I'm going to change this to 10 uh 222. I think that's the IP address of that server here. Click on save and then that should work. All right. So now I think we could open a new connection using HTTPS instead. Let's try this. All right. So the certificate is still not valid. But the reason for this is that it's by using a default HTTP challenge. So we didn't configure DNS challenge yet. But even though this is now throwing a certificate error, it is still using HTTPS correctly. So the data is at least encrypted.

The next thing that you should also take a closer look at is the servers configuration. So on the left side you have the dashboard, you have your projects and your S3 storage uh keys, tokens and stuff like that. We will later go through some of these areas but the servers configuration is also pretty important. Here you can configure both the local host so the server where Koolifi is running and the Koolifi's test deploy server. Here you can see that by default Kify is using traffic under the hood. And below here uh this is the configuration file for the traffic reverse proxy of Koolifi which you could customize if you want. You could also switch the proxy from traffic to I think caddy is also supported or you could completely turn it off which might be useful in scenarios where you already have an existing traffic reverse proxy running on your deployment server and you don't want to use uh the Koolifi traffic reverse proxy. can also change other configuration settings of this server uh like configuring the disk usage check uh change the number of concurrent builds change the private key you can also import uh a CA certificate uh if you don't want to use let's encrypt and what is also super cool you can use cloudflare tunnel if you want to make some applications that you're running locally behind your firewall easy accessible on the public internet with trusted TLS certificates so then cloudflare tunnel is a nice addition to this.

And there are also some other nice maintenance scripts like docker cleanup. This will automatically remove any of the unused docker images because they usually eat up a lot of space and from time to time you might get some notification your server's root disk is going to be full. So therefore it is recommended to run a regular docker cleanup job. You can manage this completely with coolify and you can also uh set up log drains uh to send service logs to third party tools and also what is super interesting you can manage existing resources here then you have to switch uh from the manage resources to unmanaged so then you would see all the docker services that are running on your existing server but are not managed by kifi only for visibility so you can't do much with that but at least you can um see them and you can of course also open a terminal connection easily to your server, add experimental server patching and terminal access. So there are really many utility features that are not just practical for application deployments and building container images but also for managing infrastructure which I think is in some ways great and in others it might be a bit annoying because if you're using an existing setup like your own reverse proxy then you have to find out ways how to disable that and how to make this work with existing configurations or if you for example like the DNS challenge to get trusted certificates. So yeah, there are pros and cons with uh this setup. I will tell you in the end what my personal opinion is on this. Let's first of all go through actually deploying applications and managing resources.

Yeah, one thing that is really important before you start deploying applications is that you set up a wild card domain. This of course require a DNS server with a wild card record that just forwards everything to your deployment server. So where the traffic reverse proxy will pick it up and forward it to the application container. So this way we can use the Koolifi test deploy server with HTTPS. As a wildcard domain. So then all of your applications that you deploy on this server will get a random or a customdefined subdomain or host entry on this domain. and your DNS server should automatically forward this to the correct IP address. So this is the first project that was already created by Koolifi and then we can create resources. A resource can be anything uh like it could be a git based application. So that means you store your source code of the application in a git repository and then coolify will build a new container image from the source code of your application deploy that to one of the deploy servers so that you as a developer you don't have to care about infrastructure management and stuff like that. Can also create databases if your application need a Postgress, MySQL, Reddis or MongoDB database. Yeah, you can just deploy them with easy one-click solution similar like you know it from any cloud vendor. It's super easy. You could also create Docker based application with a Docker file. So then you choose a server and start typing anything in here. You could also create a Docker compos files directly in here. So start typing your compos file that you want to deploy or you can deploy a Docker image. So I think this is really great because it could replace something like Portainer for example. So even if you're not a software developer and you don't create your own applications, you can still uh deploy docker composbased projects and manage them with Koolifi. If you prefer to store your Docker Compost files in a Git repository, it's even easier uh because then you just click on public private repository with GitHub apps or private repository with a deploy key and then you can start adding your Git repository, your branch and your build packs. So here you can see it supports static applications, Nix packs and docker file or docker compos projects. So if you have a docker compos file stored on your git repository uh you can just uh yeah refer to it here and then kudify starts building the application.

Now let me demonstrate how that would work. Let's go to my personal projects here. So there I have created a coolify test application. So this contains not a docker compose file but a docker file and the source code of an application. This is a very simple demo app that I've just written with AI. So I vcoded it of course. Yeah. And uh there you can see all the necessary package files like the JavaScript stuff, the source code. This is a simple swelter uh web based application using Node.js. And yeah, that of course requires a few source code files for creating certain UI elements and creating some cool and fancy animations and stuff like that. And here in the docker file you can see that describes building the application from a simple NodeJS Alpine image. So this makes sure that the application dependencies and all the requirements are installed. Yeah, it will run the npm install and create the application from that source code. So again, this is a custom application, but you could also in theory just refer to a Docker compos file that uses a public docker image for example would also work the same way because Koolifi will always try to deploy or build the container application. So yeah, I think this is what we can use. We will use this here. This we will copy and go back to Kify.

Now we need to paste it in the repository URL. So this can be an HTTPS or git at address. Uh of course you need to select the branch. So this way you could also simply just deploy separate testing or staging branches on a different application. So if you want to test new features and later deploy them to production super useful but of course uh we only have a main branch in here and we want to select docker files. So here the base directory uh we don't need that because it's by default root. So that will search for a docker file in the root directory. So when the docker file is somewhere else, just define the base directory and that should be fine. All right. So you can see that this application is still exited because we need or we can customize the few other settings here. For example, give this application a name. So I'm just going to pick that here test app. And then you can also change settings like the domain. Again, this refers to what we have configured on the deploy server. Our wildcard domain that will point to the IP address of the server where we're deploying this application and a traffic reverse proxy will pick it up. We could also customize this random generated name to Koolifi test app. I think that is much better. And then we can also customize a few other settings in here. We could automatically push the built image to a container registry. We could also customize the docker options here or we could protect this application with an HTTP basic authentication also nice or run any post or pre-eployment commands. So that is also super useful. So it has really a lot of interesting uh settings in here. But I think for now let's just click on deploy and see what it's doing.

So now it's connecting to the GitLab repository. It's cloning the source code and it's preparing the container build with a helper image. All right. So that was already successful. You can see that the application is already running. So if we go to the logs here, you can also um check the application logs server running at localhost port 3000. And here is the latest deployment of the application. All right. So now that the test application is up and running, let's try to open it. When we go to links, you can see that link that should point to the app. Let's uh continue. And yeah, let's ignore the certificate warning for now. That's again dependent on the traffic reverse proxy that doesn't work with the HTTP challenge. Let's ignore it for now. And this is my amazing hello world test application. So this is just a simple click counter where you can reset. So nothing really special. But yeah, it's fine. Um, this demonstrates how you can easily just deploy any type of web- based application on your own hardware infrastructure. Super cool. And of course, this also works with existing Docker compos files where you're not creating any source code, but where you're storing configuration settings or where you want to deploy other type of applications in your home lab as well. So you can use the same uh principle here.

What is also super nice if you go to advanced you see an autodeploy uh function here that can automatically deploy new commits based on git web hooks. That means when I'm changing the source code of my application and I push the changes to gitlab then coolify can automatically pick this up and create a new deployment and automatically inject the code changes into the production uh deployment app. So that is really nice and this of course also works really great if you're working with separate branches because then you again can create a staging environment for certain code changes before you merge them into the production main branch and stuff like that. By the way um how that works I haven't really tested this but this you can easily configure uh when going to web hooks. This is a deploy web hook where an authentication is required. So that requires you to enable the API in Koolifi and probably would also work better with trusted TLS certificates. So then you can tell your Git application to execute the new deployment on Koolifi as well. And then your application is automatically getting updated. That also works great with version updators like Renovate for example. So if you're already familiar with Git and GitOps processes, you might embrace the uh features of Koolifi. And you can also add schedule tasks where you run a specific command with a crown job inside the application container. I think this is also super super practical for any database backups. Yeah, for example, if you want to regularly take a database dump to store all your entire database configuration or the database entries to to a SQL file or something like this. Yeah. Uh because then you don't need a sidecar container or any other backup job or something like this. You can easily just run the simple MySQL dump or pg dump command uh inside a schedule task. Also great. And yeah, of course, uh you can configure health checks, you can configure resource limits, resource operations, metrics, you can configure roll backs and you can even easily deploy this from your primary server to a secondary server. So um if you have multiple deployment servers connected to Koolifi, you can easily just distribute your app wherever you need it. So there are many many great things in this Koolifi application and you can really do a lot with that. I think we could just go on and create like a second, a third, a fourth video about this app because it has so many features and this was just a simple demonstration, but I think I showed you enough to easily get started. And if you want to see something more specific in more detail, then please let me know in the comments and I can easily create a second or third video on coolify as well.

Yeah, this of course requires further testing from my side which by the way brings me to the last topic I quickly want to talk about before um wrapping up because the question is really CIFI does a lot of great things but would I personally use this for my production setup? Honestly, I have mixed feelings on this because I really like this application. It does a lot of great things. It tries to be this GitHubs docker Swiss Army knife with powerful audio deployment for applications. You can easily build and deploy and ship any type of app on any of your custom hardware. Yeah. And it comes with really practical features for maintenance like creating schedule tasks, uh creating auto deployments, roll backs, and uh docker cleanup tasks and stuff like that. and it could probably be the perfect all-in-one solution that you might be looking for in a home lab.

However, if you're working with Cudify, you also have to accept that this literally becomes your one and only management layer. So, when you're deploying any app on your infrastructure, you always have to do it the Koolifi way. And if you're like me, you like to work a lot with infrastructure as code tools like GitLab CI or Terraform and Anible, you likely will already have processes for these features already in place. And sure, you could think about replacing these with coolify, but why should you? It's not declarative. Everything you have to do, you have to do through the UI. Or maybe, yeah, you can use the API. But honestly guys, if you already have GitOps like with GitLabci or Terraform in place, you can literally do all this stuff on your own. So it really depends on the type of person you are. Yeah, if you're looking for an all-in-one solution where you can do everything, but you have to do it the way the application defines or if you like a little more freedom and juggle a little more around with scripts and config files and stuff like that. But you can literally do this all on your own if you would like.

So yeah, that's my final decision. I probably will keep using my current workflow by using GitLab CI Terraform instead of using Koolifi. But hey, who knows? I will still continue running this on my testing servers. And whenever you want to see something or you want me to jump into a specific topic, I can do some researching and do another tutorial if you like. So please tell me your opinion and your suggestions in the comments. or maybe there's another platform that is similar to Coolifi and you want to see comparison video, let me know. And thank you so much for watching. Thanks to all the supporters and members of our community. You guys are amazing and make these videos possible. And of course, I'm going to catch you in the next one. Take care. Bye-bye.