Skip to content

Commit 9ebbd5e

Browse files
authored
Merge pull request #1 from tommerty/copilot/fix-03f9fda8-b640-4e83-8a31-e6335af7a663
Add Coolify deployment configuration with Docker Compose and GitHub Actions
2 parents bca9d45 + c9ad3a9 commit 9ebbd5e

File tree

10 files changed

+475
-24
lines changed

10 files changed

+475
-24
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

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Environment Configuration for Production
2+
NODE_ENV=production
3+
PORT=3000
4+
5+
# Optional: Add any additional environment variables here
6+
# DATABASE_URL=your_database_url
7+
# API_KEY=your_api_key

.github/workflows/deploy.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy
1+
name: Deploy to Coolify
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build:
10+
deploy:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
@@ -45,13 +45,13 @@ jobs:
4545
run: pnpm build
4646

4747
- name: Deploy to Coolify
48-
# This is a placeholder for your Coolify deployment.
49-
# You will need to configure a webhook in your Coolify instance
50-
# and call it here to trigger a deployment.
51-
#
52-
# Example using curl:
53-
# run: curl -X POST ${{ secrets.COOLIFY_WEBHOOK_URL }}
54-
#
55-
# You need to add COOLIFY_WEBHOOK_URL as a secret in your GitHub repository settings.
56-
# Go to your Coolify project > Settings > Webhooks to get the URL.
57-
run: echo "Deployment to Coolify would happen here."
48+
if: github.ref == 'refs/heads/main'
49+
run: |
50+
curl -X POST \
51+
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" \
52+
-H "Content-Type: application/json" \
53+
-d '{"force": true}' \
54+
"${{ secrets.COOLIFY_WEBHOOK_URL }}"
55+
env:
56+
COOLIFY_WEBHOOK_URL: ${{ secrets.COOLIFY_WEBHOOK_URL }}
57+
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}

COOLIFY.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Coolify Configuration for Stream Deck Icons
2+
3+
## This app is designed to run on Coolify with the following settings:
4+
5+
### Build Configuration
6+
- **Build Command**: `pnpm install && pnpm build`
7+
- **Start Command**: `pnpm start`
8+
- **Port**: 3000
9+
- **Docker Build**: Uses the included Dockerfile
10+
11+
### Environment Variables
12+
- `NODE_ENV=production`
13+
- `PORT=3000`
14+
15+
### Health Check
16+
- **Path**: `/`
17+
- **Interval**: 30s
18+
- **Timeout**: 10s
19+
- **Retries**: 5
20+
21+
### Docker Compose
22+
The included `docker-compose.yml` can be used for local testing or as a reference for Coolify deployment.
23+
24+
### Resource Requirements
25+
- **Memory**: 512MB minimum (1GB recommended)
26+
- **CPU**: 1 core minimum
27+
- **Storage**: 2GB minimum
28+
29+
### Build Time
30+
- Typical build time: 2-5 minutes
31+
- Build requires Node.js 22 and pnpm
32+
33+
### Notes
34+
- This is a React Router application with SSR
35+
- Uses pnpm as package manager
36+
- Includes health checks for better reliability
37+
- Optimized for production deployment

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

Dockerfile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1+
# Use Node.js 22 image with pnpm pre-installed
2+
FROM node:22-alpine AS base
3+
RUN corepack enable pnpm
4+
15
# Install dependencies
2-
FROM node:22-alpine AS deps
3-
RUN npm install -g pnpm
6+
FROM base AS deps
47
WORKDIR /app
58
COPY package.json pnpm-lock.yaml ./
6-
RUN pnpm fetch
7-
RUN pnpm install -r --offline --prod
9+
RUN pnpm install --frozen-lockfile --prod
810

911
# Build the app
10-
FROM node:22-alpine AS builder
11-
RUN npm install -g pnpm
12+
FROM base AS builder
1213
WORKDIR /app
13-
COPY --from=deps /app/node_modules /app/node_modules
14+
COPY package.json pnpm-lock.yaml ./
15+
RUN pnpm install --frozen-lockfile
1416
COPY . .
1517
RUN pnpm build
1618

1719
# Production image
18-
FROM node:22-alpine AS runner
20+
FROM base AS runner
21+
RUN apk add --no-cache curl
1922
WORKDIR /app
2023
COPY --from=builder /app/build ./build
21-
COPY --from=builder /app/node_modules ./node_modules
24+
COPY --from=deps /app/node_modules ./node_modules
2225
COPY --from=builder /app/package.json ./package.json
2326

27+
# Set environment variables
28+
ENV NODE_ENV=production
29+
ENV PORT=3000
30+
31+
# Expose port
32+
EXPOSE 3000
33+
34+
# Health check
35+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
36+
CMD curl -f http://localhost:3000/ || exit 1
37+
2438
CMD ["pnpm", "start"]

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,57 @@ npm run build
4444

4545
## Deployment
4646

47+
### Coolify Deployment
48+
49+
This project is configured for deployment on [Coolify](https://coolify.io). Follow these steps:
50+
51+
1. **Setup Coolify Project**:
52+
- Create a new project in your Coolify instance
53+
- Connect your GitHub repository
54+
- Select "Docker Compose" as the deployment method
55+
56+
2. **Configure Build Settings**:
57+
- Build Command: `pnpm install && pnpm build`
58+
- Start Command: `pnpm start`
59+
- Port: 3000
60+
- Use the included `docker-compose.yml` or `Dockerfile`
61+
62+
3. **Environment Variables**:
63+
- `NODE_ENV=production`
64+
- `PORT=3000`
65+
66+
4. **GitHub Actions Deployment**:
67+
- Add the following secrets to your GitHub repository:
68+
- `COOLIFY_WEBHOOK_URL`: Your Coolify webhook URL
69+
- `COOLIFY_TOKEN`: Your Coolify API token (optional)
70+
- The workflow will automatically deploy on pushes to `main`
71+
72+
5. **Health Checks**:
73+
- The app includes built-in health checks at `/`
74+
- Coolify will automatically monitor the application
75+
76+
For detailed configuration, see [COOLIFY.md](./COOLIFY.md).
77+
4778
### Docker Deployment
4879

4980
To build and run using Docker:
5081

5182
```bash
52-
docker build -t my-app .
83+
docker build -t streamdeck-icons .
5384

5485
# Run the container
55-
docker run -p 3000:3000 my-app
86+
docker run -p 3000:3000 streamdeck-icons
87+
```
88+
89+
Or use Docker Compose:
90+
91+
```bash
92+
docker-compose up -d
5693
```
5794

5895
The containerized application can be deployed to any platform that supports Docker, including:
5996

97+
- Coolify (recommended)
6098
- AWS ECS
6199
- Google Cloud Run
62100
- Azure Container Apps

0 commit comments

Comments
 (0)