Skip to content

Commit c9ad3a9

Browse files
Copilottommerty
andcommitted
Complete Coolify deployment setup with validation scripts and documentation
Co-authored-by: tommerty <[email protected]>
1 parent b14ca62 commit c9ad3a9

File tree

4 files changed

+337
-1
lines changed

4 files changed

+337
-1
lines changed

.dockerignore

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,49 @@
1+
# React Router build artifacts
12
.react-router
23
build
4+
5+
# Dependencies
36
node_modules
4-
README.md
7+
8+
# Environment files
9+
.env
10+
.env.local
11+
.env.production
12+
.env.test
13+
14+
# Logs
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
pnpm-debug.log*
19+
20+
# Git
21+
.git
22+
.gitignore
23+
24+
# IDE
25+
.vscode
26+
.idea
27+
*.swp
28+
*.swo
29+
30+
# OS
31+
.DS_Store
32+
Thumbs.db
33+
34+
# Testing
35+
coverage
36+
37+
# Temporary files
38+
.tmp
39+
temp
40+
41+
# Documentation (not needed in container)
42+
README.md
43+
DEPLOYMENT.md
44+
COOLIFY.md
45+
46+
# Docker
47+
Dockerfile
48+
docker-compose.yml
49+
.dockerignore

DEPLOYMENT.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Coolify Deployment Guide
2+
3+
This guide will help you deploy the Stream Deck Icons application to Coolify.
4+
5+
## Prerequisites
6+
7+
- Coolify instance running and accessible
8+
- GitHub repository with the Stream Deck Icons code
9+
- Admin access to your GitHub repository (for setting secrets)
10+
11+
## Step 1: Setup GitHub Secrets
12+
13+
1. Go to your GitHub repository
14+
2. Navigate to Settings > Secrets and Variables > Actions
15+
3. Add the following secrets:
16+
- `COOLIFY_WEBHOOK_URL`: Your Coolify webhook URL (get from Coolify project settings)
17+
- `COOLIFY_TOKEN`: Your Coolify API token (optional, for enhanced security)
18+
19+
## Step 2: Create Coolify Project
20+
21+
1. Log into your Coolify instance
22+
2. Create a new project
23+
3. Choose "Git Repository" as the source
24+
4. Connect your GitHub repository
25+
26+
## Step 3: Configure Deployment
27+
28+
### Option A: Using Docker Compose (Recommended)
29+
1. In Coolify, select "Docker Compose" as the deployment method
30+
2. Use the provided `docker-compose.yml` file
31+
3. Set the build context to the repository root
32+
33+
### Option B: Using Dockerfile
34+
1. In Coolify, select "Dockerfile" as the deployment method
35+
2. Use the provided `Dockerfile`
36+
3. Set the build context to the repository root
37+
38+
## Step 4: Environment Configuration
39+
40+
Set the following environment variables in Coolify:
41+
- `NODE_ENV=production`
42+
- `PORT=3000`
43+
44+
## Step 5: Build Settings
45+
46+
Configure the following in Coolify:
47+
- **Build Command**: `pnpm install && pnpm build`
48+
- **Start Command**: `pnpm start`
49+
- **Port**: 3000
50+
- **Health Check Path**: `/`
51+
52+
## Step 6: Deploy
53+
54+
### Automatic Deployment (Recommended)
55+
- Push changes to the `main` branch
56+
- GitHub Actions will automatically trigger deployment
57+
58+
### Manual Deployment
59+
- Use the Coolify dashboard to manually trigger deployment
60+
- Or use the webhook URL directly
61+
62+
## Troubleshooting
63+
64+
### Common Issues
65+
66+
1. **Build fails with pnpm not found**
67+
- Ensure the Dockerfile is being used correctly
68+
- Check that Node.js 22 is available
69+
70+
2. **Health check fails**
71+
- Verify the application is running on port 3000
72+
- Check application logs in Coolify
73+
74+
3. **GitHub Actions deployment fails**
75+
- Verify webhook URL and token are correctly set
76+
- Check GitHub Actions logs for specific errors
77+
78+
### Logs
79+
80+
To view logs:
81+
1. Go to your Coolify project
82+
2. Navigate to the "Logs" tab
83+
3. Check both build and runtime logs
84+
85+
## Additional Configuration
86+
87+
### Custom Domain
88+
1. In Coolify, go to your project settings
89+
2. Add your custom domain in the "Domains" section
90+
3. Configure SSL certificate (automatic with Let's Encrypt)
91+
92+
### Resource Limits
93+
- **Memory**: 512MB minimum (1GB recommended)
94+
- **CPU**: 1 core minimum
95+
- **Storage**: 2GB minimum
96+
97+
## Support
98+
99+
If you encounter issues:
100+
1. Check the Coolify documentation
101+
2. Review the application logs
102+
3. Verify all environment variables are set correctly
103+
4. Ensure the webhook URL is correct and accessible

deploy.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# Production deployment script for Coolify
4+
# This script can be used to trigger deployment via webhook
5+
6+
set -e
7+
8+
# Configuration
9+
WEBHOOK_URL="${COOLIFY_WEBHOOK_URL:-}"
10+
TOKEN="${COOLIFY_TOKEN:-}"
11+
12+
# Colors for output
13+
RED='\033[0;31m'
14+
GREEN='\033[0;32m'
15+
YELLOW='\033[1;33m'
16+
NC='\033[0m' # No Color
17+
18+
# Function to print colored output
19+
print_status() {
20+
echo -e "${GREEN}[INFO]${NC} $1"
21+
}
22+
23+
print_warning() {
24+
echo -e "${YELLOW}[WARNING]${NC} $1"
25+
}
26+
27+
print_error() {
28+
echo -e "${RED}[ERROR]${NC} $1"
29+
}
30+
31+
# Check if webhook URL is set
32+
if [[ -z "$WEBHOOK_URL" ]]; then
33+
print_error "COOLIFY_WEBHOOK_URL environment variable is not set"
34+
exit 1
35+
fi
36+
37+
print_status "Starting deployment to Coolify..."
38+
39+
# Prepare the curl command
40+
CURL_CMD="curl -X POST"
41+
42+
# Add authorization header if token is provided
43+
if [[ -n "$TOKEN" ]]; then
44+
CURL_CMD="$CURL_CMD -H \"Authorization: Bearer $TOKEN\""
45+
fi
46+
47+
# Add content type and data
48+
CURL_CMD="$CURL_CMD -H \"Content-Type: application/json\""
49+
CURL_CMD="$CURL_CMD -d '{\"force\": true}'"
50+
CURL_CMD="$CURL_CMD \"$WEBHOOK_URL\""
51+
52+
# Execute the deployment
53+
print_status "Triggering deployment..."
54+
if eval $CURL_CMD; then
55+
print_status "Deployment triggered successfully!"
56+
print_status "Check your Coolify dashboard for deployment status."
57+
else
58+
print_error "Failed to trigger deployment"
59+
exit 1
60+
fi

validate-deployment.sh

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/bin/bash
2+
3+
# Deployment validation script
4+
# Validates that all deployment files are properly configured
5+
6+
set -e
7+
8+
# Colors for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
NC='\033[0m' # No Color
13+
14+
# Function to print colored output
15+
print_status() {
16+
echo -e "${GREEN}[✓]${NC} $1"
17+
}
18+
19+
print_warning() {
20+
echo -e "${YELLOW}[⚠]${NC} $1"
21+
}
22+
23+
print_error() {
24+
echo -e "${RED}[✗]${NC} $1"
25+
}
26+
27+
print_info() {
28+
echo -e "${NC}[i]${NC} $1"
29+
}
30+
31+
echo "=== Coolify Deployment Validation ==="
32+
echo ""
33+
34+
# Check if required files exist
35+
echo "Checking required files..."
36+
37+
required_files=(
38+
"Dockerfile"
39+
"docker-compose.yml"
40+
".github/workflows/deploy.yml"
41+
"package.json"
42+
"pnpm-lock.yaml"
43+
"COOLIFY.md"
44+
"DEPLOYMENT.md"
45+
".env.example"
46+
"deploy.sh"
47+
)
48+
49+
for file in "${required_files[@]}"; do
50+
if [[ -f "$file" ]]; then
51+
print_status "Found: $file"
52+
else
53+
print_error "Missing: $file"
54+
exit 1
55+
fi
56+
done
57+
58+
echo ""
59+
echo "Checking file contents..."
60+
61+
# Check Dockerfile
62+
if grep -q "EXPOSE 3000" Dockerfile; then
63+
print_status "Dockerfile exposes port 3000"
64+
else
65+
print_error "Dockerfile does not expose port 3000"
66+
fi
67+
68+
if grep -q "HEALTHCHECK" Dockerfile; then
69+
print_status "Dockerfile includes health check"
70+
else
71+
print_warning "Dockerfile does not include health check"
72+
fi
73+
74+
# Check docker-compose.yml
75+
if grep -q "ports:" docker-compose.yml && grep -q "3000:3000" docker-compose.yml; then
76+
print_status "docker-compose.yml maps port 3000"
77+
else
78+
print_error "docker-compose.yml does not map port 3000"
79+
fi
80+
81+
# Check GitHub Actions workflow
82+
if grep -q "COOLIFY_WEBHOOK_URL" .github/workflows/deploy.yml; then
83+
print_status "GitHub Actions workflow includes Coolify webhook"
84+
else
85+
print_error "GitHub Actions workflow missing Coolify webhook"
86+
fi
87+
88+
# Check package.json scripts
89+
if grep -q '"start"' package.json; then
90+
print_status "package.json includes start script"
91+
else
92+
print_error "package.json missing start script"
93+
fi
94+
95+
if grep -q '"build"' package.json; then
96+
print_status "package.json includes build script"
97+
else
98+
print_error "package.json missing build script"
99+
fi
100+
101+
echo ""
102+
echo "Checking environment configuration..."
103+
104+
# Check .env.example
105+
if [[ -f ".env.example" ]]; then
106+
if grep -q "NODE_ENV=production" .env.example; then
107+
print_status ".env.example includes NODE_ENV"
108+
else
109+
print_warning ".env.example missing NODE_ENV"
110+
fi
111+
112+
if grep -q "PORT=3000" .env.example; then
113+
print_status ".env.example includes PORT"
114+
else
115+
print_warning ".env.example missing PORT"
116+
fi
117+
fi
118+
119+
echo ""
120+
echo "=== Validation Complete ==="
121+
echo ""
122+
print_info "Next steps:"
123+
print_info "1. Add GitHub secrets: COOLIFY_WEBHOOK_URL and COOLIFY_TOKEN"
124+
print_info "2. Configure Coolify project with Docker Compose or Dockerfile"
125+
print_info "3. Set environment variables in Coolify"
126+
print_info "4. Deploy via GitHub Actions or manual trigger"
127+
echo ""
128+
print_info "For detailed instructions, see DEPLOYMENT.md"

0 commit comments

Comments
 (0)