Here’s a comprehensive list of commands used in the Coolify setup process. Each step includes the appropriate commands:
1. Initial VPS Setup
SSH Key Setup
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<your-server-ip>
Update and Upgrade the System
sudo apt update && sudo apt upgrade -y
Add a New User
sudo adduser username
sudo usermod -aG sudo username
Configure SSH for Security
sudo nano /etc/ssh/sshd_config
Change:
PermitRootLogin no
PasswordAuthentication no
Restart SSH:
sudo systemctl restart ssh
2. Install Coolify
Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
Install Coolify
curl -fsSL https://get.coolify.io | bash
3. Set Up a Firewall
Install UFW and Enable Ports
sudo apt install ufw -y
sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
4. Domain and HTTPS Configuration
Update DNS Records
Set A records pointing to your VPS IP:
@ -> IP_ADDRESS* -> IP_ADDRESS
Set Up Caddy Proxy (optional)
docker stop coolify-proxy
docker run -d --name coolify-proxy caddy
5. Deploy a Static Website
Add the Repository
git clone https://github.com/<your-username>/<your-repo>.git
6. Configure GitHub Application
Create a GitHub App for Webhooks
# Follow the GitHub interface to generate client ID and secret.
Add Webhooks
Add webhook URL in GitHub:
https://<your-domain>/webhook
7. Manage Database
Start PostgreSQL Container
docker run -d \
--name postgres \
-e POSTGRES_USER=your_user \
-e POSTGRES_PASSWORD=your_password \
-e POSTGRES_DB=your_db \
-p 5432:5432 postgres
Backup Database with PGDump
pg_dump -U your_user -d your_db > backup.sql
8. Use Docker Compose
Create a docker-compose.yml File
version: "3.8"
services:
app:
image: node:16
ports:
- "3000:3000"
volumes:
- .:/app
Run Docker Compose
docker-compose up -d
9. Deploy MinIO (S3-Compatible Storage)
Run MinIO Container
docker run -d \
--name minio \
-p 9000:9000 \
-p 9001:9001 \
-e "MINIO_ROOT_USER=your_user" \
-e "MINIO_ROOT_PASSWORD=your_password" \
minio/minio server /data --console-address ":9001"
10. Monitor VPS with Glances
Run Glances
docker run -d \
--name glances \
-p 61208:61208 \
--pid="host" \
docker.io/nicolargo/glances
11. Secure Services with Basic Auth
Generate a Hashed Password (Caddy)
docker run --rm caddy caddy hash-password --plaintext 'your_password'
Add Labels for HTTP Basic Auth
In Docker Compose:
labels:
- caddy.auth.basicauth.username=<username>
- caddy.auth.basicauth.password=<hashed_password>
12. Update Coolify
Upgrade Coolify
docker exec coolify /app/coolify upgrade