Introduction: Why Coolify for Your Business?
Cloud costs are spiraling out of control for small businesses. Between AWS, Azure, and Vercel, monthly bills quickly exceed €500-1000 for modest applications. Not to mention the complexity of their interfaces and surprise billing.
Coolify changes the game. It’s an open-source platform that transforms any VPS server into an alternative to Heroku or Vercel. You maintain complete control over your infrastructure, your data stays where you want it, and costs are predictable: the server price, period.
The advantages of self-hosting are clear:
- Complete control: you manage your data and infrastructure
- Fixed costs: a €20/month OVH VPS vs €200+ on managed clouds
- Data sovereignty: your data stays hosted where you decide
- Simplicity: visual interface to manage Docker without command-line
This tutorial is for CTOs of small businesses, developers, and technical leaders who want to take back control of their infrastructure. We’ll deploy a complete application from A to Z, with database and automatic SSL.
Technical Prerequisites
Before starting, here’s what you need:
VPS server: a server from OVH, Scaleway, or Hetzner with minimum 2 GB RAM and Ubuntu 22.04. Budget €10-20/month depending on resources.
Access and domain: root SSH access to the server and a domain name pointed to the server’s IP (A and AAAA records configured).
Basic skills: ability to connect via SSH and execute Linux commands. No need to be a Docker expert, Coolify handles everything.
Application to deploy: a Dockerized application or Git repository. We’ll use a Node.js example in this tutorial.
Installing Coolify on Your Server
Connect to your server via SSH:
ssh root@your-server.comUpdate the system:
apt update && apt upgrade -yCoolify provides an installation script that configures Docker, Docker Compose, and all necessary components in a single command:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bashThe script takes 2-3 minutes. It installs:
- Docker Engine 24.x
- Docker Compose v2
- Coolify v4 and its dependencies
- Traefik as reverse proxy
- PostgreSQL for the internal database
Once complete, access the web interface at http://your-ip:8000. Create your admin account with a strong password.
First step in the interface: configure your primary domain in Settings > Configuration. Coolify automatically generates a Let’s Encrypt SSL certificate. After a few minutes, access Coolify at https://coolify.your-domain.com.
Configuring Your First Project
In the Coolify dashboard, click New Project. Give it a descriptive name like “app-production”.
Connect your Git repository:
- Go to Sources > Add Source
- Choose GitHub, GitLab, or Gitea
- Authorize Coolify to access your repositories
- Select your application’s repository
For sensitive environment variables (API keys, secrets), use the project’s Environment Variables section. These values are encrypted and injected at runtime:
DATABASE_URL=postgresql://user:password@postgres:5432/myappJWT_SECRET=your-super-secure-secretNODE_ENV=productionConfigure your domain in the Domains section. Add app.your-domain.com. Coolify automatically configures:
- Let’s Encrypt SSL certificate
- Automatic renewal every 90 days
- HTTP to HTTPS redirect
Choose your deployment type. Two options:
- Dockerfile: Coolify detects and builds your Dockerfile
- docker-compose.yml: for multi-service applications
For a simple application, the Dockerfile is sufficient. For a complete stack (app + database + Redis), use docker-compose.
Deploying a Node.js Application with Docker
Here’s a production-optimized Dockerfile with multi-stage build:
# Stage 1: BuildFROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./RUN npm ci --only=production
COPY . .RUN npm run build
# Stage 2: ProductionFROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./distCOPY --from=builder /app/node_modules ./node_modulesCOPY --from=builder /app/package.json ./
EXPOSE 3000
CMD ["node", "dist/index.js"]This Dockerfile reduces the final image size from 1.2 GB to 150 MB by excluding development dependencies.
For a complete stack, create a docker-compose.yml:
version: '3.8'
services: app: build: . ports: - "3000:3000" environment: - REDIS_URL=redis://redis:6379 - NODE_ENV=production depends_on: - redis restart: unless-stopped
redis: image: redis:7-alpine volumes: - redis_data:/data restart: unless-stopped
volumes: redis_data:In Coolify, return to your project and click Deploy. Coolify:
- Clones your repository
- Detects the Dockerfile or docker-compose.yml
- Builds the Docker image
- Launches the containers
- Configures the Traefik reverse proxy
Monitor logs in real-time in the Logs tab. The first deployment takes 3-5 minutes depending on your application size.
Once complete, test your application at https://app.your-domain.com. Verify SSL works and the application responds correctly.
Automation and Continuous Deployment
Configure Git webhooks to trigger automatic deployment on every push to the main branch. In your Coolify project:
- Copy the webhook URL from Settings > Webhooks
- Add it to your GitHub/GitLab repository settings
- Choose the “Push” event
On every commit to main, Coolify automatically rebuilds and redeploys. Deployment happens with zero downtime thanks to rolling updates.
Health checks monitor your application’s health. Configure them in Settings > Health Checks:
path: /healthinterval: 30stimeout: 5sretries: 3If your application exposes a /health route, Coolify checks every 30 seconds that it responds. After 3 failed attempts, Coolify automatically restarts the container.
If a deployment fails, Coolify keeps the previous version active. You can manually rollback in the Deployments tab with one click.
Configure notifications to stay informed:
- Email for deployment failures
- Discord or Slack for all events
- Custom webhook for integration with your tools
Managing Databases and Additional Services
Coolify simplifies database deployment. In Services > Add Service, choose:
PostgreSQL 16 for a relational database:
version: 16-alpinevolumes: - postgres_data:/var/lib/postgresql/dataenvironment: POSTGRES_DB: myapp POSTGRES_USER: appuser POSTGRES_PASSWORD: ${DB_PASSWORD}Redis 7 for cache and sessions:
version: 7-alpinevolumes: - redis_data:/datacommand: redis-server --appendonly yesCoolify automatically generates credentials and injects them into your environment variables. The connection URL becomes available via ${DATABASE_URL}.
Configure automatic backups in Database > Backups:
- Frequency: daily at 3 AM
- Retention: 7 days
- Destination: local storage or S3-compatible
Services communicate via a private Docker network. Your application accesses PostgreSQL at postgres:5432 and Redis at redis:6379. No public exposure, maximum security.
Conclusion and Next Steps
You just deployed a complete application to production with Coolify. From zero to a functional stack with SSL, database, and continuous deployment in under an hour.
The savings are significant. Monthly comparison:
| Solution | Monthly Cost | Complexity |
|---|---|---|
| Vercel Pro + Planetscale | €200+ | Medium |
| AWS (EC2 + RDS + Load Balancer) | €300+ | High |
| Coolify (Hetzner 8 GB VPS) | €25 | Low |
That’s a savings of €175-275 per month, €2100-3300 per year. For a small business, that’s a marketing budget or a part-time junior developer.
Next steps to go further:
- Horizontal scaling with multiple application instances
- Advanced monitoring with Grafana and Prometheus
- Automated testing before deployment
- Multiple environment configuration (staging, production)
The Coolify documentation covers these topics in detail. The Discord community is active and responsive for support.
Need help migrating your infrastructure or optimizing your deployments? At Kodixar, I help small businesses transition to self-hosting and optimize their cloud costs.
In the next article, we’ll explore how to set up complete monitoring with Grafana, Prometheus, and Loki to monitor your applications in real-time.