Skip to main content
Automation February 14, 2026 9 min read

Tutorial: Deploy Applications with Docker and Coolify for SMBs

Learn to deploy applications with Coolify and Docker. A practical guide for small businesses looking to reduce cloud costs.

M
Mohamed Boukri

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:

Terminal window
ssh root@your-server.com

Update the system:

Terminal window
apt update && apt upgrade -y

Coolify provides an installation script that configures Docker, Docker Compose, and all necessary components in a single command:

Terminal window
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

The 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
Installation requires at least 2 GB of RAM. On smaller servers, add 2 GB of swap.

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.

Enable two-factor authentication in security settings immediately after first login.

Configuring Your First Project

In the Coolify dashboard, click New Project. Give it a descriptive name like “app-production”.

Connect your Git repository:

  1. Go to Sources > Add Source
  2. Choose GitHub, GitLab, or Gitea
  3. Authorize Coolify to access your repositories
  4. 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:

Terminal window
DATABASE_URL=postgresql://user:password@postgres:5432/myapp
JWT_SECRET=your-super-secure-secret
NODE_ENV=production

Configure 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: Build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --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:
Key Takeaway
Multi-stage builds drastically reduce Docker image size and improve production security.

In Coolify, return to your project and click Deploy. Coolify:

  1. Clones your repository
  2. Detects the Dockerfile or docker-compose.yml
  3. Builds the Docker image
  4. Launches the containers
  5. 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:

  1. Copy the webhook URL from Settings > Webhooks
  2. Add it to your GitHub/GitLab repository settings
  3. 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: /health
interval: 30s
timeout: 5s
retries: 3

If your application exposes a /health route, Coolify checks every 30 seconds that it responds. After 3 failed attempts, Coolify automatically restarts the container.

Always implement a /health route that verifies database connection and critical services.

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-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: myapp
POSTGRES_USER: appuser
POSTGRES_PASSWORD: ${DB_PASSWORD}

Redis 7 for cache and sessions:

version: 7-alpine
volumes:
- redis_data:/data
command: redis-server --appendonly yes

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

Never expose PostgreSQL or Redis directly to the Internet. Always use the internal Docker network.

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:

SolutionMonthly CostComplexity
Vercel Pro + Planetscale€200+Medium
AWS (EC2 + RDS + Load Balancer)€300+High
Coolify (Hetzner 8 GB VPS)€25Low

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.

Related articles

Automation

Tutorial: Setting Up CI/CD with GitHub Actions and Docker for SMBs

Learn to automate your deployments with GitHub Actions and Docker. Practical guide with complete, cost-effective CI/CD pipeline for small businesses.

February 18, 2026 9 min read
#CI-CD #GitHub Actions #Docker +2
Automation

Tutorial: Self-Hosting Make to Optimize Automation Costs for SMBs

Learn to self-host Make with Docker on VPS to reduce automation costs. Practical guide for SMBs seeking SaaS independence.

February 13, 2026 16 min read
#self-hosting #Make #Docker +2
Available for new projects

Need help with this topic?

Contact us to discuss your project and see how we can help.

Free quote
No commitment
24h response