loading...
Cover image for Farewell Netlify & Heroku after 3 days of coding? 🀯
coolLabs

Farewell Netlify & Heroku after 3 days of coding? 🀯

andrasbacsai profile image Andras Bacsai Updated on ・3 min read

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!

I would like to point out again, I ❀️️ what they are doing, this is not against them. I've highly recommended them for everybody who wants to start a new project.

What's the problem then?

Unfortunately, they are running on AWS - which does not match with our mission.

sad

So we need our own Netlify-ish / Heroku-ish service, with the same awesome & simple development experience.

What experience exactly?

  • 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.


This magic needs a plan and lots of thinking!

need a plan

After reading lots of docs, the following process seems the simplest one for the MVP:

  1. Push code to Git.
  2. Git commits triggers a webhook.
  3. The webhook caught on our backend.
  4. Important details parsed.
  5. Clone the repository in a temporary directory.
  6. Check the codebase and look for exact clues. (Is it frontend/backend?)
  7. Trigger Docker Engine through API to build an image based on the collected details.
  8. Start a container with the new image in a secure, isolated environment. (No ports exposed to the internet)
  9. 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.
  10. πŸŽ‰

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...

Where we host it?

I'm using one IaaS provider for years now and I'm totally satisfied with them. Super API, not pricey, pretty good services.

You are thinking what I'm thinking?

Yes, DigitalOcean!

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.

coding madness

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.

Coolify - Sounds 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.

coolBot

Yes, 2 secs of redeployment. How? One word.

Cache

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:

coolBot still cool

Still acceptable, in my opinion.

Nginx reverse proxy? Why?

  • 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.

Hmm...

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!

tadaaa

Future of Coolify?

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.

Posted on by:

andrasbacsai profile

Andras Bacsai

@andrasbacsai

DevOps @codesandbox β€’ ex-@IBM β€’ 1x husband & 2x dad β€’ building http://coollabs.io

coolLabs

Control your digital footprint | Open source & self hostable applications and services built for your online safety.

Discussion

markdown guide
 

What part of your mission are they against, exactly?

 

From their mission:

"A Place For Hope πŸ™Œ
We are building a magical place of Progressive Web Applications where you can find all your everyday applications (and services) without any data concerns, without the 'big five'."

So basically, they think by using AWS, your data is being sold off to other places? 😡

 

I mean, hopefully they learn some lessons (good or bad) from this path they're about to go down.

I hope the same!

We learnt a lot (good and bad) since we are "online", so it's a clear win for us. πŸŽ‰

 

We think, everyone should have an opportunity to choose applications/services which are not related to Amazon/AWS or similar companies which primary income is based on your data - maybe not AWS directly, but as AWS is their secondary revenue stream after online retail store...

We never said they are 'the pure evil' - and probably never will πŸ˜„.

 

The static website or application will be served from an AWS server in the end - probably from AWS EC2. So they are against only indirectly.

But still β™₯️ what they are doing.

 

I'm not sure that really answers the question.

Then I missunderstood your question, sorry.

The 2 companies are not against us or our mission. We used their service initially, but after our mission was crystal clear, we decided to create our own version.

Hope this answers your question. If not, please try to ask in a different way. 😊

Seems riskier long term to roll your own solution. But more power to you.

 

Cool project! You can do the same thing with a single node kubernetes cluster, and then that gives you the ability to add more nodes to it later if needed. There's a small amount of lost system resources due to kubernetes overhead, but it's not much. If you are looking for a friendly UI for management, I really like Rancher 2.x

 

Thank you! πŸ˜„

Currently we are using one server/docker engine for all of the apps/services, but the next version of Coolify, will support Docker Swarm and/or Kubernetes cluster, that's sure.

But it's not our primary focus at the moment as all of our frontends are Progressive Web Applications - the clients only downloads them once / released version - so the most resources (CPU/Memory/Network, etc..) are used by our backend code. We are fine with one server, but definietly will be changed to a scalable one.

We are focusing on extending our repertoire of applications.

Never used Rancher before, only read about it. Thanks for the suggestion!

 

Is there any open source solution that turns the Digital ocean into Heroku like deployment?

 

Dokku and caprover immediately come to mind and are available as deployable apps when creating droplets directly.

Other options include Flynn which is super powerful but docs are a little cumbersome, and the official stable release is rather old.

Dokku is best if you only need a single repo support, caprover if you will have multiple apps, and or multiple servers.

Both easy to setup and use.

 
 

I'm not sure if there is any, but it would be awesome to work on it as an open source project.

 
 

It is hard to diff the two because Coolify is pretty small atm and I never used Dokku, but:

  • Does not need a remote git where you need to push your code.
  • Does not have buildpacks, it discovers the type of the application from the codebase.
  • The only one thing you need to do is to add the URL of your Coolify service as a Git Webhook to your repository.
  • It determines the domain name of the application you are deploying based on the Git repository name, like for us github.com/coollabsio/note.coollab... -> the subdomain in all configurations (e.g: reverse proxy) will be note.coollabs.io.

As it does not have any frontend code, lots of things are predefined, like the domain name question. If it will have, that's a totally different story. πŸ˜„

 

We are looking for a similar solution for small projects. Something that can take a git repo and deploy every branch while still having full access to the machine.