docker.recipes

Coolify Self-hosted PaaS

intermediate

Open-source Heroku/Netlify alternative for deploying applications.

Overview

Coolify is an open-source, self-hosted Platform-as-a-Service (PaaS) that provides an alternative to cloud services like Heroku, Netlify, and Vercel. Developed by Coollabs, it enables developers and organizations to deploy applications, databases, and services on their own infrastructure while maintaining the simplicity of modern PaaS offerings. Coolify supports multiple deployment methods including Git repositories, Docker images, and static sites, with built-in SSL management, monitoring, and scaling capabilities. This deployment creates a complete Coolify instance using three essential services: the main Coolify application server, a PostgreSQL database for storing application metadata and configurations, and Redis for caching and real-time features. The Coolify container handles the web interface, API, and deployment orchestration, while PostgreSQL maintains persistent data about projects, deployments, and user configurations. Redis provides session management, job queuing, and WebSocket support for real-time updates in the dashboard. This stack is ideal for development teams seeking complete control over their deployment pipeline, organizations with compliance requirements that prevent cloud PaaS usage, and infrastructure engineers building internal developer platforms. The combination provides enterprise-grade deployment capabilities while remaining cost-effective compared to managed PaaS solutions, especially for teams managing multiple applications and environments.

Key Features

  • Multi-application deployment supporting Node.js, Python, PHP, Go, Rust, and static sites
  • Git-based continuous deployment with webhook integration for GitHub, GitLab, and Bitbucket
  • Built-in database provisioning for PostgreSQL, MySQL, MongoDB, and Redis instances
  • Automatic SSL certificate management with Let's Encrypt integration
  • Real-time deployment logs and application monitoring through WebSocket connections
  • Docker Compose and Dockerfile support for complex multi-container applications
  • Environment variable management with per-branch configuration support
  • Team collaboration features with role-based access control and project sharing

Common Use Cases

  • 1Development teams replacing Heroku due to pricing changes or feature limitations
  • 2Enterprises requiring on-premises application deployment for compliance or security
  • 3Startups building multiple microservices needing centralized deployment management
  • 4Educational institutions providing students with self-hosted development platforms
  • 5DevOps teams creating internal developer platforms for streamlined CI/CD
  • 6Agencies managing client applications on dedicated infrastructure
  • 7Open-source projects requiring free, scalable hosting without vendor lock-in

Prerequisites

  • Minimum 2GB RAM and 10GB disk space for the complete stack
  • Docker and Docker Compose installed on the host system
  • Access to port 8000 for the web interface and ports 6001-6002 for WebSocket connections
  • Domain name and DNS configuration for SSL certificate generation (optional but recommended)
  • Understanding of Git workflows and Docker concepts for application deployment
  • SSH access to target deployment servers if deploying to remote infrastructure

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 coolify:
3 image: ghcr.io/coollabsio/coolify:latest
4 container_name: coolify
5 environment:
6 - APP_ID=${APP_ID}
7 - APP_KEY=${APP_KEY}
8 - APP_NAME=Coolify
9 - DB_USERNAME=coolify
10 - DB_PASSWORD=${DB_PASSWORD}
11 - REDIS_PASSWORD=${REDIS_PASSWORD}
12 - PUSHER_APP_ID=${PUSHER_APP_ID}
13 - PUSHER_APP_KEY=${PUSHER_APP_KEY}
14 - PUSHER_APP_SECRET=${PUSHER_APP_SECRET}
15 volumes:
16 - /var/run/docker.sock:/var/run/docker.sock
17 - coolify-data:/data/coolify
18 ports:
19 - "8000:80"
20 - "6001:6001"
21 - "6002:6002"
22 depends_on:
23 - db
24 - redis
25 networks:
26 - coolify-network
27 restart: unless-stopped
28
29 db:
30 image: postgres:15-alpine
31 container_name: coolify-db
32 environment:
33 - POSTGRES_USER=coolify
34 - POSTGRES_PASSWORD=${DB_PASSWORD}
35 - POSTGRES_DB=coolify
36 volumes:
37 - postgres-data:/var/lib/postgresql/data
38 networks:
39 - coolify-network
40 restart: unless-stopped
41
42 redis:
43 image: redis:7-alpine
44 container_name: coolify-redis
45 command: redis-server --requirepass ${REDIS_PASSWORD}
46 volumes:
47 - redis-data:/data
48 networks:
49 - coolify-network
50 restart: unless-stopped
51
52volumes:
53 coolify-data:
54 postgres-data:
55 redis-data:
56
57networks:
58 coolify-network:
59 driver: bridge

.env Template

.env
1# Coolify
2DB_PASSWORD=secure_coolify_password
3REDIS_PASSWORD=secure_redis_password
4
5# Generate with: openssl rand -hex 16
6APP_ID=random_app_id
7
8# Generate with: openssl rand -base64 32
9APP_KEY=base64:your_app_key
10
11# Pusher (for real-time updates)
12PUSHER_APP_ID=coolify
13PUSHER_APP_KEY=coolify
14PUSHER_APP_SECRET=coolify_secret

Usage Notes

  1. 1Web UI at http://localhost:8000
  2. 2Register first admin account
  3. 3Deploy apps from Git repos
  4. 4Supports Docker, static sites, databases
  5. 5Auto SSL with Let's Encrypt

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

coolify
coolify:
  image: ghcr.io/coollabsio/coolify:latest
  container_name: coolify
  environment:
    - APP_ID=${APP_ID}
    - APP_KEY=${APP_KEY}
    - APP_NAME=Coolify
    - DB_USERNAME=coolify
    - DB_PASSWORD=${DB_PASSWORD}
    - REDIS_PASSWORD=${REDIS_PASSWORD}
    - PUSHER_APP_ID=${PUSHER_APP_ID}
    - PUSHER_APP_KEY=${PUSHER_APP_KEY}
    - PUSHER_APP_SECRET=${PUSHER_APP_SECRET}
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - coolify-data:/data/coolify
  ports:
    - "8000:80"
    - "6001:6001"
    - "6002:6002"
  depends_on:
    - db
    - redis
  networks:
    - coolify-network
  restart: unless-stopped
db
db:
  image: postgres:15-alpine
  container_name: coolify-db
  environment:
    - POSTGRES_USER=coolify
    - POSTGRES_PASSWORD=${DB_PASSWORD}
    - POSTGRES_DB=coolify
  volumes:
    - postgres-data:/var/lib/postgresql/data
  networks:
    - coolify-network
  restart: unless-stopped
redis
redis:
  image: redis:7-alpine
  container_name: coolify-redis
  command: redis-server --requirepass ${REDIS_PASSWORD}
  volumes:
    - redis-data:/data
  networks:
    - coolify-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 coolify:
5 image: ghcr.io/coollabsio/coolify:latest
6 container_name: coolify
7 environment:
8 - APP_ID=${APP_ID}
9 - APP_KEY=${APP_KEY}
10 - APP_NAME=Coolify
11 - DB_USERNAME=coolify
12 - DB_PASSWORD=${DB_PASSWORD}
13 - REDIS_PASSWORD=${REDIS_PASSWORD}
14 - PUSHER_APP_ID=${PUSHER_APP_ID}
15 - PUSHER_APP_KEY=${PUSHER_APP_KEY}
16 - PUSHER_APP_SECRET=${PUSHER_APP_SECRET}
17 volumes:
18 - /var/run/docker.sock:/var/run/docker.sock
19 - coolify-data:/data/coolify
20 ports:
21 - "8000:80"
22 - "6001:6001"
23 - "6002:6002"
24 depends_on:
25 - db
26 - redis
27 networks:
28 - coolify-network
29 restart: unless-stopped
30
31 db:
32 image: postgres:15-alpine
33 container_name: coolify-db
34 environment:
35 - POSTGRES_USER=coolify
36 - POSTGRES_PASSWORD=${DB_PASSWORD}
37 - POSTGRES_DB=coolify
38 volumes:
39 - postgres-data:/var/lib/postgresql/data
40 networks:
41 - coolify-network
42 restart: unless-stopped
43
44 redis:
45 image: redis:7-alpine
46 container_name: coolify-redis
47 command: redis-server --requirepass ${REDIS_PASSWORD}
48 volumes:
49 - redis-data:/data
50 networks:
51 - coolify-network
52 restart: unless-stopped
53
54volumes:
55 coolify-data:
56 postgres-data:
57 redis-data:
58
59networks:
60 coolify-network:
61 driver: bridge
62EOF
63
64# 2. Create the .env file
65cat > .env << 'EOF'
66# Coolify
67DB_PASSWORD=secure_coolify_password
68REDIS_PASSWORD=secure_redis_password
69
70# Generate with: openssl rand -hex 16
71APP_ID=random_app_id
72
73# Generate with: openssl rand -base64 32
74APP_KEY=base64:your_app_key
75
76# Pusher (for real-time updates)
77PUSHER_APP_ID=coolify
78PUSHER_APP_KEY=coolify
79PUSHER_APP_SECRET=coolify_secret
80EOF
81
82# 3. Start the services
83docker compose up -d
84
85# 4. View logs
86docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/coolify-paas/run | bash

Troubleshooting

  • Coolify container fails to start with permission errors: Ensure Docker socket has proper permissions with 'sudo chmod 666 /var/run/docker.sock'
  • Database connection failed during initial setup: Verify DB_PASSWORD environment variable matches between coolify and db services
  • Redis authentication errors in application logs: Check REDIS_PASSWORD is set and consistent across services
  • SSL certificate generation fails: Verify domain DNS points to server and port 80/443 are accessible from internet
  • Git webhook deployments not triggering: Confirm PUSHER_* environment variables are configured and ports 6001-6002 are accessible
  • Out of disk space errors during deployment: Monitor Docker volumes and implement log rotation for coolify-data volume

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space