This content originally appeared on DEV Community and was authored by AIRabbit
I've got loads of apps in Python and JavaScript running in containers! I find it really helpful for keeping my host clean and separate from my development. But we all know that managing multiple Python and JavaScript applications can be a bit of a challenge, especially when it comes to ports and address mapping in Docker.
Why?
Forwarding specific ports and mapping them to localhost in Docker can quickly become a bit of a headache. While Kubernetes is a great solution for orchestrating containers (and exposing them using Services), there's another exciting option: Coolify.
In a nutshell, Coolify is similar to Vercel, but can be run entirely on your local machine, making it an attractive solution for security-conscious developers.
Outline
Why run Coolify in Docker?
Setting up Docker-in-Docker for Coolify
Install Coolify
Deploy applications using Coolify
Deploying a public GitHub repository
Deploy a private GitHub repository using deployment keys
Accessing deployed applications
Wrap-up
Why run Coolify in Docker
I prefer to isolate all applications in containers to keep my host machine clean and secure. Typically, my host only runs office applications, Docker and VSCode. This approach keeps the environment clean and improves security.
However, deploying an application that needs to create its own containers can be challenging when you run it directly on the host (my Mac). To sandbox this Docker-based application, I decided to deploy Coolify in a Docker-in-Docker Container.
You can read more about Docker in Docker here .
After some trial and error, I managed to get it up and running and successfully deployed two applications: one from a public GitHub repository and another from a private GitHub repository.
With this setup, I can deploy anything I develop locally using the Coolify CLI with a single click after testing it locally.
This eliminates the hassle of managing ports and allows me to configure and deploy all applications from a single pane of glass.
Setting up Docker-in-Docker for Coolify
Let's explore how to deploy Coolify in Docker, deploy applications and access them using this infrastructure.
We should have a setup similar to the one below:
Port 81 is reserved for the Coolify dashboard. With Docker port forwarding, port 81 on the Docker-in-Docker container points to port 8000 on Coolify.
Port 80 points to Coolify's port 80, which is the Traefik container inside the Coolify container.
This can get a bit confusing with many containers, but essentially the hierarchy is as follows:
Docker (Mac)
Coolify container (Docker-in-Docker image + installed Coolify): Mapping Port 81 to 8000 and Port 80 to 80
├── Dashboard Container (Port 8000)
├── Traefik container (mapped to port 80)
├── App1 (routed through Traefik)
│ └── App2 (routed through Traefik)
Read more in my blog post
This content originally appeared on DEV Community and was authored by AIRabbit
AIRabbit | Sciencx (2024-11-02T19:25:25+00:00) Simplify local application deployment with Coolify – The Kubernetes Alternative (Part 1). Retrieved from https://www.scien.cx/2024/11/02/simplify-local-application-deployment-with-coolify-the-kubernetes-alternative-part-1/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.