We used Netlify & Heroku for our applications when we started our small project.
This duo is pretty popular due they are free, easy to learn & you can spin up your hobby / small project within minutes - even in seconds!
Unfortunately, they are running on AWS - which does not match with our mission.
So we need our own Netlify-ish / Heroku-ish service, with the same awesome & simple development experience.
- What we devs ❤️️ to do? Push code, no matter what happens.
- What should happen afterward? The new code should be redeployed!
- How? Magically. 🧙♂️
Sounds cool & simple.
After reading lots of docs, the following process seems the simplest one for the MVP:
- Push code to Git.
- Git commits triggers a webhook.
- The webhook caught on our backend.
- Important details parsed.
- Clone the repository in a temporary directory.
- Check the codebase and look for exact clues. (Is it frontend/backend?)
- Trigger Docker Engine through API to build an image based on the collected details.
- Start a container with the new image in a secure, isolated environment. (No ports exposed to the internet)
- Catch the Docker Engine event of a new container started and trigger the function which will configure and serve it through a reverse proxy (Nginx). Only the reverse proxy is exposed to the world.
I'm sure there are lots of better, easier ways to do it, but still, I think it's pretty clean.
Just one more important thing needs to be figured out...
I'm using one IaaS provider for years now and I'm totally satisfied with them. Super API, not pricey, pretty good services.
Edit 2019.12.22: We are not using Digitalocean anymore. We are on a dedicated server hosted by a way smaller company. :)
The plan is clear, so let's start coding.
After 3 days of coding, the initial version was done. The very last thing we need to do is to name this little piece of code something cool.
From that day, we are not using Netlify & Heroku, we deploy everything with Coolify, our Node.js backends, and our Angular or Vue.js frontends.
We have the same development experience as before, we even receive a notification from our lovely coolBot (what a unique name, right?), if there is something happened within Coolify.
Yes, 2 secs of redeployment. How? One word.
This fast process rates highly rely on Docker's cache mechanism. Coolify creates building stages during the first trigger and uses it later on as a cache.
Of course, if a change occurs in one of the cached stages, for example, a new package added to package.json, the deployment takes longer:
Still acceptable, in my opinion.
As our application containers are not reachable from the internet, we need something which will be used as a tunnel.
We should control most (or not every) security options and configurations in a single spot. Changing in that single spot will protect all of our applications.
These are easily done with a reverse proxy like Nginx.
Also, it can handle the significant load, pretty easily.
It sounds like we have a fully functioning, autoMagically deploying service, which is secure & fast, does not rely on the big five, also we did not spend weeks/months on its development and we only need to code our apps from now on. Cool!
We have plans with the code, but not sure which path we will take.
It is so small to offer it as a service - but it should be so cool.
That's all for now. If you would like to know deeper technical details of Coolify - with code snippets - send us reactions and/or comments below!
Thank you for reading our blog and spending your time with us!
Happy & cool coding! ❤️️
Cover photo credit goes to Jesse Orrico.