Contents
Install via Docker image & Coolify
Coolify is a Docker manager. It can control your VPS and install applications for you.
Here’s a video on setting up Operational via Coolify:
Steps
-
Setup a VPS
-
Connect Coolify to VPS
-
Setup a Coolify project
-
Create a mysql database Save the connection string for env vars
-
Setup a Docker image Get the Docker image url from here.
-
Enter env vars You’ll need these vars:
- APP_URL: set this to the default url Coolify assigns(you can change this later on)
- DATABASE_URL: set this as the connection string of the mysql database you’ve setup earlier
- PORT: set this to 2000
- VITE_API_URL: set this to the backend url
You’ll need to also create a backend url manually. In the video, I couldn’t get this to work via Coolify’s UI so I manually added container labels.
But you don’t need to do that. All you need to do is to add two domains in the domains input inside Coolify. One domain will be for your frontend, other will be for your backend. In the second domain, append :4337
port to the end of the domain. This will map the backend url to port 4337
which is used by the dockerfile for the backend.
If Coolify’s UI barfs, paste this code at the end of the container labels and replace api-yourfrontendurl with your backend:
traefik.http.routers.backend-4337.rule=Host(`api-yourfrontendurl`)
traefik.http.routers.backend-4337.entryPoints=http
traefik.http.routers.backend-4337.service=backend-4337
traefik.http.services.backend-4337.loadbalancer.server.port=4337
CopyAnd paste the backend url in the VITE_API_URL env var as the value.
- Deploy your docker container.
Keeping your database seperate from the Docker application is a good idea because you can easily update your docker image in the future if needed, and your database will be intact.
If you’re using something like Dokploy, Komo.do, etc, the steps are almost same. What differs between these platforms is how they handle urls and ports.