Self Host 101 - Set up Coolify | Self Hosted PaaS with Zero Config Deployments
Vložit
- čas přidán 19. 05. 2024
- In this video CJ shows you what Coolify is, what it does, how to choose a server to deploy it to, how to lock it down with https, how to deploy several types of applications on it, how to setup s3 compatible storage for file uploads / backups and more.
View all the Self Host 101 videos here: • Self Host 101
00:00 Intro
00:56 What can you do with Coolify?
02:09 Coolify minimum specs required
02:59 Create a VPS with Hetzner and Set Up with Cloud Config
06:16 ssh into VPS as root and update / upgrade
07:18 Install Coolify
08:29 Coolify: localhost vs remote server
10:25 Update VPS user passwords
11:51 Set up Coolify https instance domain and https wildcard domain
16:04 Why not Cloudflare?
16:41 Create a firewall and lock down all unused ports
17:47 Update Coolify user password and setup 2fa
18:49 Deploy a static website to Coolify with an https subdomain
20:55 www redirects and custom Caddy configs
25:25 Create dynamic proxy configurations
27:04 Create a basic Next.js project in Coolify
28:09 What is nixpacks?
29:37 Deploy a basic Next.js application with nixpacks
31:38 Create a Github application in Coolify
33:31 Deploy a Next.js app with auto deploy
35:41 Create a postgres database for a t3 application
37:10 Create a Dockerfile to push the db schema to our database
40:35 Create a Dockerfile to push the db schema from a private repo
44:46 Deploy a t3 app
47:10 Set up http basic auth with Caddy
51:01 Upgrade Coolify
52:06 Deploy a git repo with an existing docker compose file
59:26 VPS status dashboards
01:00:56 Deploy a service with docker compose
01:04:13 Deploy supabase and monitor VPS status during deploy
01:07:00 Set up minIO / s3 compatible storage
01:10:42 Configure database backups
01:15:17 Coolify cloud demo
01:18:37 Where and how to get help with Coolify
01:22:22 CJ's opinions and final thoughts about Coolify
01:28:20 Thanks!
List to episode 730 of Syntax: syntax.fm/show/730/own-your-o...
Coolify: coolify.io/
Learn more about hetzner: www.hetzner.com/cloud/
Sign up for hetzner with coolify affiliate link (supports the coolify creator): coolify.io/hetzner
Cloud Config Example: gist.github.com/w3cj/cdd447b1...
Cloud init documentation: cloudinit.readthedocs.io/en/l...
Learn about DNS in the Self Host Series: • Self Host 101 - Run Mu...
Read the Caddy docs: caddyserver.com/
Read the caddy-docker-proxy docs: github.com/lucaslorentz/caddy...
Caddy redir directive: caddyserver.com/docs/caddyfil...
nixpacks: github.com/railwayapp/nixpacks
How nixpacks works: nixpacks.com/docs/how-it-works
nixpacks custom file: nixpacks.com/docs/configurati...
Learn Docker: • Start Using Docker Tod...
Dockerfile to clone from private repo with SSH key: gist.github.com/w3cj/8b510e32...
Caddy basicauth directive: caddyserver.com/docs/caddyfil...
glances: github.com/nicolargo/glances
glances docker docs: github.com/nicolargo/glances/...
grafana: grafana.com
prometheus: prometheus.io/docs/introducti...
node_exporter: github.com/prometheus/node_ex...
Monitoring a Linux host with Prometheus, Node Exporter, and Docker Compose: grafana.com/docs/grafana-clou...
minio: min.io/docs/minio/linux/index...
Coolify cloud: coolify.io/pricing
Join the Coolify discord: coolify.io/discord
Open an issue on Coolify: github.com/coollabsio/coolify...
Have a discussion about Coolify: github.com/coollabsio/coolify...
Corrections:
5:08 Since v4.0.0-beta.259 - coolify allows for a non root user with sudo NOPASSWD privileges. See description for link to docs: coolify.io/docs/knowledge-bas...
------------------------------------------------------------------------------
Hit us up on Socials!
www.syntax.fm/links
Brought to you by Sentry - Use code "tastytreats" to get 2 months free - sentry.io/syntax
#vps #webdevelopment #selfhosted - Věda a technologie
00:00 Intro
00:56 What can you do with Coolify?
02:09 Coolify minimum specs required
02:59 Create a VPS with Hetzner and Set Up with Cloud Config
06:16 ssh into VPS as root and update / upgrade
07:18 Install Coolify
08:29 Coolify: localhost vs remote server
10:25 Update VPS user passwords
11:51 Set up Coolify https instance domain and https wildcard domain
16:04 Why not Cloudflare?
16:41 Create a firewall and lock down all unused ports
17:47 Update Coolify user password and setup 2fa
18:49 Deploy a static website to Coolify with an https subdomain
20:55 www redirects and custom Caddy configs
25:25 Create dynamic proxy configurations
27:04 Create a basic Next.js project in Coolify
28:09 What is nixpacks?
29:37 Deploy a basic Next.js application with nixpacks
31:38 Create a Github application in Coolify
33:31 Deploy a Next.js app with auto deploy
35:41 Create a postgres database for a t3 application
37:10 Create a Dockerfile to push the db schema to our database
40:35 Create a Dockerfile to push the db schema from a private repo
44:46 Deploy a t3 app
47:10 Set up http basic auth with Caddy
51:01 Upgrade Coolify
52:06 Deploy a git repo with an existing docker compose file
59:26 VPS status dashboards
01:00:56 Deploy a service with docker compose
01:04:13 Deploy supabase and monitor VPS status during deploy
01:07:00 Set up minIO / s3 compatible storage
01:10:42 Configure database backups
01:15:17 Coolify cloud demo
01:18:37 Where and how to get help with Coolify
01:22:22 CJ's opinions and final thoughts about Coolify
01:28:20 Thanks!
Thank you, CJ, for making this video! 💜 (the dev behind Coolify here)
great work, looking forward to having a play with it soon :)
I also want to thank you to for this great project Coolify. Are there any plans on an example for how to configure SvelteKit for Coolify?
hi , i am using Coolify as a remote server to deploy a git repo with docker-compose file , and it it not loading the docker-compose.yaml, but when I do it in local server it is working fine.
@@kumardeepanshu8503 can you please open a github issue?
@@user-vk9in7qg4b you can find the required conf for sveltekit in the docs, but I will add one to the example repo. 🙂
Hey CJ and Syntax team, thanks for putting this outstanding video together. It's very thorough and easy to follow. I've set up my Coolify before this video came out and had some difficulties understanding all the different configurations and settings within Coolify. This video shed some light on that and helped me understand how and what I can do with Coolify.
I think this is the best series I've seen in a while. So many opportunities...
I've watched some home labs setups but nothing so deep. Thanks a lot for sharing.
Thanks for watching!
Thanks CJ! Another great video. Also appreciate the opinions at the end. You've covered so much already, but maybe it could be interesting to make a video covering the considerations and best practices when self hosting a production app with 2-3 services (like a service, db and a message queue). This could be like a summary or overview video for the series, tying it together.
I like this idea! I think a general multi-tier architecture overview would be good to cover at some point.
@@syntaxfm I'd like to see this as well. Thanks!
Coolify is fantastic! I really appreciate this video. I'm looking forward to hearing your thoughts on Dokku next, it's such an amazing project. Plus, the person maintaining it, Jose Gonzalez, is super cool too!
Coolify is absolutely good tool. Thank you for making this video. Would love to see more tutorials about Coolify when it got stable version. 😊
I appreciate the opinion section. I use docker, docker-compose, and traefik for my personal server. While watching, i had the urge to get coolify up and running just for that pretty front end. I might still do it. Either way, for people just getting started with these technologies, im jealous that you have something like Coolify. Very cool tool and very informative video.
I'm feeling a bit stupid for asking but I have just recently installed on my proxmox a Ubuntu server instance and there I would like to run docker containers and within those docker containers for example databases. I could now install coolify and don't really have much of the hassle of managing the containers but I could easily spin up databases with the click of a button. Is my understanding correct? What about things like passing through GPU?
You should be able to use coolify for this. Pass through GPU would need to be handled within proxmox.
Loved every second of this video. I’ve been waiting for it to drop. I was ready to go all in on coolify but after cj thoughts might be going manual for my upcoming production migration. Was really hoping to use this for that 😢
I've been looking at assembling some open source tools to get a coolify like experience.
dockge is a docker compose web dashboard - github.com/louislam/dockge
portainer is a docker compose dashboard (with predefined stacks like coolify) but the community edition is limited in features - docs.portainer.io/
There are a bunch of other web dashboards for docker listed here - github.com/veggiemonk/awesome-docker?tab=readme-ov-file#web
caddy-docker-proxy makes creating caddy configs for containers much easier: github.com/lucaslorentz/caddy-docker-proxy
webhook could be used for auto builds / deploys on merge - github.com/adnanh/webhook
-CJ
This is an amazing and thorough tutorial video! 🥰
Finally is here!! Thanks! 🚀
Perfect video for my use case. Thanks a ton.
Yeeeeeeees thank youuuu CJ ❤❤
Great video, what I want to see from you additionally ıs setting up cloudflare tunnels(which they are free) and additionally for coolify to use tunnels. Love your work man.
I wasn't able to test this, but coolify has some built in options for working with tunnels: coolify.io/docs/knowledge-base/cloudflare/tunnels
@@syntaxfm thank you, I tried to set it up but couldn’t manage to make it work especially remote servers
Thank you. I've only used Railway and Vercel so far, so this video really helped me understand what setting up my own server looks like. Could you set up two servers in a future video to show us an example of how to work with multiple servers and synchronize them with multiple databases?
Gold mine! Thanks you for content.
Great job man 🎉
Thanks CJ
Thanks very nice guide.
Any chance of covering Ansible in the future maybe for either basic vps setup or even local dev machine.
I am trying coolify right now. So, this tutorial helped me in a lot of ways. Also, would it make sense to bring docker (I have watched your other video) into this series and make a video about hosting multiple containers (for different stack like express app, nextjs, etc) in a VPS and setting them up with Caddy (with different domain name)? Plus CI/CD etc
Hi CJ,
Great job on this video!
After listening to the syntax episode I tried coolifiy and I agree with your views at the end. I am very interested in how you would do this manually with just a server from 0 to production and what tools you depend on for this.
If you already have videos on this I would love to view them. Thanks
I show the basics in these 2 videos:
Setting up caddy - czcams.com/video/mLznVlBAtcg/video.html
Ways to get CI/CD on a VPS - czcams.com/video/ZG76DYUlCEs/video.html
I have not gotten into more complex production tasks like load balancing, stress testing, log drains, monitoring / alerts, backups etc. but if there is enough interest, I might start to cover these types of things over on the Coding Garden channel.
-CJ
@@syntaxfm thanks a lot. I'll watch the series. BTW this video finally got me to check out sentry
Bro, your mustache has pierced my heart :D
Awesome content, I want to cry for the quality of the content.
47:00 Can you please show how to add a MFA like Authelia? I don't trust username/password combination. They're open to brute force attacks.
I actually got authelia up and running while testing! This is possible with the caddy forward_auth directive: caddyserver.com/docs/caddyfile/directives/forward_auth#authelia
It was a bit too involved to show in this tutorial, but I might start doing more self host content over on the Coding Garden channel.
-CJ
@@syntaxfm Yes! Yes! Yes! I won the CZcams lottery.
Thank you
Thanks CJ!! Is it possible to also teach us how to set up load balance on coolify?
I love Coolify
How does it compare to Dokploy can you do a video?
awesome content
Thanks cj. For the redirect part of this video, can I use cloudflare page rule (forwarding)? Do they work the same way? Or do I need to set up both?
You only need to set up redirects in one place. If your users are accessing your instance via cloudflare, it is perfectly fine to set them up there only.
If users are accessing your coolify instance directly without cloudflare, you'd need to set them up in coolify.
I think I would use coolify locally to manage a bunch of server. That way resources are not a problem and I can have multiple instances of my app on-premise but still have a way to control them.
That was my thought too, but wasn't totally sure if it needs to be always available or not. Either way, this is far more interesting than I thought it was!
I agree about managing docker compose and caddy. What would you say is the best way to do deploys on pr merging? I think that is the last magic I would consider using coolify on.
You could write some custom scripts or use something like Ansible and write playbooks that will run all the commands you need to deploy a certain PR, but compared to using Coolify that would be way more work.
It's definitely interesting to explore and learn, but if you are not interested in doing something so manual, then yeah Coolify might be a better way to do.
This project makes it pretty easy to setup webhooks that can run a script in response to a received webhook:
github.com/adnanh/webhook
Another option is to create a github action that ssh's into a server to re-build / restart the app:
github.com/appleboy/ssh-action
your tache is ridiculous and awesome in equal measure. assume that's the look you're going for :D
which one is better for bun-sveltekit apps, coolify or caprover?? thanks🙃
EDIT: never mind. I was trying to find it by scrubbing the video but then I found it w/ the bookmarks in the pinned comment.
In what section is the firewall configured?
I'm unfamiliar with Hertzner, is there a firewall to configure at that level or just a firewall on the machine itself?
I tried Coolify long time ago in 2022 and had some issues and tried it recently few months ago and had some issues immediately after installing it. Can't remember, but I'll give it another try soon because I actually want it to succeed and I actually want to use it mostly for Preview Deployments feature.
I think it's just too prone to breaking from version to version (yes yes I know it's in beta), but it also being dependent on a single person is also quite problematic in my opinion.
I think coolify has a bright future. Especially once it hits stable v4.
@@syntaxfm we'll see. I'm looking forward to it.
this video started simiple, then it got really complicted really fast !
I did my best to keep it approachable for beginners, but there are a lot of considerations to make when working with a VPS, so things can start to get complicated!
If you want more foundational videos, definitely check out the earlier videos in this series: czcams.com/play/PLLnpHn493BHHAxTeLNUZEDLYc8uUwqGXa.html
And also checkout my video on using Docker: czcams.com/video/RHjXPN_h1YA/video.html
@@syntaxfm I will, Thanks !!
Yey Coolify!
Why didnt I hear about this before spending weeks setting up the infrastructure myself 😭
I'm a bit confused about the SSL part. You got a valid SSL certificate, where is the cert coming from? I didn't see any letsencrypt or any dns validation config. Is it a namecheap feature like cloudflare has?
It’s coming from let’s encrypt but that’s managed entirely by coolify
I'm only about halfway through but I'm noticing that all new projects are hosted as subdomains of your general apps.gdn domain. Are you able to deploy projects with completely different domains or do they all have to be subdomains?
As long as the correct DNS records are set, you can set the project domains to anything, the proxy will pickup the labels and attempt to auto-acquire a TLS certificate (using a DNS challenge).
Projects will default to using the wildcard instance domain set in settings when you create them.
@@syntaxfm many thanks. I figured as much but just wanted to double check
Does coolify need 2 CPUs or 2 “cores”? Because coolify’s website also says it can be run on a raspberry pi which makes me think they are saying it needs 2 “cores”.
2 cores
is there an api in coolify that i can use to resell deployments to some clients as a PAAS ?
Not that I know of. You might try asking in the coolify discord.
how to deploy docker file? I don't know where to input the command.
I'm looking at moving over all my side-projects to be hosted on a VPS instead of serverless/cloud providers. I think it would be straightforward with docker-compose + caddy (all of the apps are containerised), without needing something like Coolify. But the one thing that wouldn't work is that deployment would have to be mostly manual (SSH into the server, update the version in the docker-compose file, docker-compose up). Does anyone have a good system for automatically deploying on push (on the master branch) in Github?
I talk about how to do this in this office hours video: czcams.com/video/ZG76DYUlCEs/video.html
-CJ
Is this free or cripple-ware if you self host it.
i have a contabo server they don't have a ui for setting up firewall . I tried using ufw but seems like the port is still open and haven't managed to close it .Can you help out ?
I see you got help with this in the coolify discord! I didn't realize this, but docker on linux changes the iptables, so you need to add your iptable rules before any docker rules to get this working.
There is a good description of how to solve this here: stackoverflow.com/a/51741599
This project tries to solve it automatically: github.com/chaifeng/ufw-docker
How to use Coolify with existing Traefik instance. I am struggling with this issue for few weeks. Can someone help me? 🙏🏻🙏🏻🙏🏻
I figured it out. I can migrate my existing Traefik to Coolify's Traefik.
how did you get a dark mode for namcheap😂😂
I use this extension: darkreader.org/
@@syntaxfm cool thanks🙏
Coolify is really annoying, I just get 404 on services with no way to debug or understand why
I do think coolify could do better job surfacing the logs and could provide an easier way to share those logs to get help when things go wrong.
Within coolify, the server -> proxy -> logs section is a good place to find issues related to the proxy (which is typically the culprit when it comes to 404s/ 502s)
Great vid, but face and branding doesn't need to take up 30% of the screen. Way too big and compromises legibility of the important content for those of us with smaller screens.
That’s what I’ve been waiting for! Thanks CJ! And thanks @heyandras for an awesome product!
No easter egg in the video 🥲Why just why CJ ?!
Are you sure? 🥚
@@syntaxfm this is devious
@@syntaxfm wait, I haven't been looking for those!
@@SRG-Learn-Code I mention it in this video: czcams.com/video/mLznVlBAtcg/video.html
@@syntaxfm I rechecked by downloading the SRT (subtitle file) for the video and searched for the terms 'shirt' and 't-shirt.' However, I didn't find any matches. 😎
I even looked into exif data of not-the-droids-you-are-looking-for.webp 😂