@panoptic-it-solutions/coolify-setup 1.1.33 → 1.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +21 -2
- package/dist/templates/claude-rules.js +115 -4
- package/dist/templates/workflow.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -206,6 +206,24 @@ async function main() {
|
|
|
206
206
|
console.log(' • Add environment variables in Coolify');
|
|
207
207
|
console.log(' • Generate domain (replace random string with app name)');
|
|
208
208
|
console.log(' • Deploy\n');
|
|
209
|
+
// Show important tip about Docker networking if services are included
|
|
210
|
+
if (response.includePostgres || response.includeRedis || response.includeMinio) {
|
|
211
|
+
console.log(chalk.bgYellow.black.bold(' ⚠️ IMPORTANT: Docker Networking '));
|
|
212
|
+
console.log(chalk.yellow('\n Use SERVICE NAMES, not localhost, in environment variables:\n'));
|
|
213
|
+
if (response.includePostgres) {
|
|
214
|
+
console.log(chalk.red(' ❌ DATABASE_URL=postgresql://user:pass@localhost:5432/db'));
|
|
215
|
+
console.log(chalk.green(' ✅ DATABASE_URL=postgresql://user:pass@postgres:5432/db\n'));
|
|
216
|
+
}
|
|
217
|
+
if (response.includeRedis) {
|
|
218
|
+
console.log(chalk.red(' ❌ REDIS_URL=redis://localhost:6379'));
|
|
219
|
+
console.log(chalk.green(' ✅ REDIS_URL=redis://redis:6379\n'));
|
|
220
|
+
}
|
|
221
|
+
if (response.includeMinio) {
|
|
222
|
+
console.log(chalk.red(' ❌ MINIO_ENDPOINT=http://localhost:9000'));
|
|
223
|
+
console.log(chalk.green(' ✅ MINIO_ENDPOINT=http://minio:9000\n'));
|
|
224
|
+
}
|
|
225
|
+
console.log(chalk.yellow(' Docker containers use service names for internal DNS resolution.\n'));
|
|
226
|
+
}
|
|
209
227
|
console.log(chalk.bold('Branching Strategy:\n'));
|
|
210
228
|
console.log(' develop → Default branch, main development');
|
|
211
229
|
console.log(' feature/** → New features');
|
|
@@ -214,8 +232,9 @@ async function main() {
|
|
|
214
232
|
console.log(' staging → Staging deployment (auto-deploy on merge)');
|
|
215
233
|
console.log(' main → Production deployment (merge PR to deploy)\n');
|
|
216
234
|
console.log(chalk.bold('Deployment Flow:\n'));
|
|
217
|
-
console.log('
|
|
218
|
-
console.log('
|
|
235
|
+
console.log(' feature/** → PR to develop → merge');
|
|
236
|
+
console.log(' develop → PR to staging → merge → staging deploys');
|
|
237
|
+
console.log(' staging → PR to main → merge → prod deploys\n');
|
|
219
238
|
}
|
|
220
239
|
main().catch((error) => {
|
|
221
240
|
console.error(chalk.red('Error:'), error);
|
|
@@ -27,19 +27,42 @@ This project uses a trunk-based development workflow with deployment branches:
|
|
|
27
27
|
- Fixes: \`fix/bug-description\`
|
|
28
28
|
- Hotfixes: \`hotfix/urgent-fix\`
|
|
29
29
|
|
|
30
|
-
2. **
|
|
30
|
+
2. **Feature Development**: Push feature/fix/hotfix branches
|
|
31
31
|
- Builds Docker image
|
|
32
32
|
- Pushes to private registry
|
|
33
|
+
- Creates PR to \`develop\` branch
|
|
34
|
+
|
|
35
|
+
3. **Integration**: Merge PR to \`develop\`
|
|
36
|
+
- Builds Docker image
|
|
33
37
|
- Creates PR to \`staging\` branch
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
4. **Staging Deployment**: Merge PR to \`staging\`
|
|
36
40
|
- Coolify auto-deploys to staging server
|
|
37
|
-
- GitHub Actions
|
|
41
|
+
- GitHub Actions runs semantic versioning workflow
|
|
42
|
+
- Creates \`staging-v*\` tags based on conventional commits
|
|
43
|
+
- Creates PR to \`main\` branch
|
|
38
44
|
- Test changes in staging environment
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
5. **Production Deployment**: Merge PR to \`main\`
|
|
41
47
|
- Coolify auto-deploys to production server
|
|
42
48
|
|
|
49
|
+
### Conventional Commits
|
|
50
|
+
|
|
51
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automatic semantic versioning on the staging branch:
|
|
52
|
+
|
|
53
|
+
| Commit Type | Version Bump | Example |
|
|
54
|
+
|-------------|--------------|---------|
|
|
55
|
+
| \`feat:\` | Minor (0.X.0) | \`feat: add user authentication\` |
|
|
56
|
+
| \`feat!:\` or \`BREAKING CHANGE:\` | Major (X.0.0) | \`feat!: redesign API endpoints\` |
|
|
57
|
+
| \`fix:\` | Patch (0.0.X) | \`fix: resolve login timeout\` |
|
|
58
|
+
| Other | Patch (0.0.X) | \`chore: update dependencies\` |
|
|
59
|
+
|
|
60
|
+
The staging version workflow automatically:
|
|
61
|
+
- Detects version bump type from commit messages since last staging tag
|
|
62
|
+
- Bumps version in package.json
|
|
63
|
+
- Creates a \`staging-v*\` tag
|
|
64
|
+
- Generates changelog with features, fixes, and other changes
|
|
65
|
+
|
|
43
66
|
### Branch Protection Rules
|
|
44
67
|
|
|
45
68
|
- \`develop\` is the default branch
|
|
@@ -164,6 +187,94 @@ When adding services that need baked-in configs:
|
|
|
164
187
|
- Sync the new Dockerfile to the deploy branch
|
|
165
188
|
- Update image tags in docker-compose.yml via sed
|
|
166
189
|
|
|
190
|
+
## Docker Compose Port Configuration
|
|
191
|
+
|
|
192
|
+
### Use \`expose\` Instead of \`ports\`
|
|
193
|
+
|
|
194
|
+
Coolify handles port mapping and domain routing automatically. Services should use \`expose\` to make ports available to Coolify without binding directly to host ports:
|
|
195
|
+
|
|
196
|
+
\`\`\`yaml
|
|
197
|
+
# CORRECT - Let Coolify handle port mapping
|
|
198
|
+
app:
|
|
199
|
+
image: registry/app:latest
|
|
200
|
+
expose:
|
|
201
|
+
- "3000"
|
|
202
|
+
|
|
203
|
+
minio:
|
|
204
|
+
image: minio/minio:latest
|
|
205
|
+
expose:
|
|
206
|
+
- "9000"
|
|
207
|
+
- "9001"
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
\`\`\`yaml
|
|
211
|
+
# AVOID - Direct port binding conflicts with Coolify
|
|
212
|
+
app:
|
|
213
|
+
ports:
|
|
214
|
+
- "3000:3000"
|
|
215
|
+
\`\`\`
|
|
216
|
+
|
|
217
|
+
### Internal-Only Services
|
|
218
|
+
|
|
219
|
+
Services like PostgreSQL and Redis should have no \`ports\` or \`expose\` directives. They communicate internally via Docker networking.
|
|
220
|
+
|
|
221
|
+
## Docker Networking - Service Names vs localhost
|
|
222
|
+
|
|
223
|
+
**CRITICAL**: In Docker Compose, containers communicate using **service names**, NOT \`localhost\`.
|
|
224
|
+
|
|
225
|
+
| Variable | ❌ WRONG | ✅ CORRECT |
|
|
226
|
+
|----------|----------|-----------|
|
|
227
|
+
| \`DATABASE_URL\` | \`@localhost:5432\` | \`@postgres:5432\` |
|
|
228
|
+
| \`REDIS_URL\` | \`redis://localhost:6379\` | \`redis://redis:6379\` |
|
|
229
|
+
| \`MINIO_ENDPOINT\` | \`http://localhost:9000\` | \`http://minio:9000\` |
|
|
230
|
+
|
|
231
|
+
### Why?
|
|
232
|
+
|
|
233
|
+
- **\`localhost\`** inside a container refers to **that container itself** - useless for cross-container communication
|
|
234
|
+
- **Service names** (e.g., \`postgres\`, \`redis\`, \`minio\`) are resolved by Docker's internal DNS to the correct container IP
|
|
235
|
+
|
|
236
|
+
### Service Names from docker-compose.yml
|
|
237
|
+
|
|
238
|
+
\`\`\`yaml
|
|
239
|
+
services:
|
|
240
|
+
app: # Other containers reach this as "app"
|
|
241
|
+
postgres: # Other containers reach this as "postgres"
|
|
242
|
+
redis: # Other containers reach this as "redis"
|
|
243
|
+
minio: # Other containers reach this as "minio"
|
|
244
|
+
\`\`\`
|
|
245
|
+
|
|
246
|
+
### Common Mistakes in Coolify Environment Variables
|
|
247
|
+
|
|
248
|
+
When setting environment variables in Coolify, ensure you use service names:
|
|
249
|
+
|
|
250
|
+
\`\`\`bash
|
|
251
|
+
# ❌ WRONG - will fail to connect
|
|
252
|
+
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
|
|
253
|
+
|
|
254
|
+
# ✅ CORRECT - uses Docker service name
|
|
255
|
+
DATABASE_URL=postgresql://user:pass@postgres:5432/mydb
|
|
256
|
+
\`\`\`
|
|
257
|
+
|
|
258
|
+
### Internal Services Configuration
|
|
259
|
+
|
|
260
|
+
\`\`\`yaml
|
|
261
|
+
# PostgreSQL - internal only (most secure)
|
|
262
|
+
postgres:
|
|
263
|
+
image: postgres:16-alpine
|
|
264
|
+
volumes:
|
|
265
|
+
- postgres-data:/var/lib/postgresql/data
|
|
266
|
+
healthcheck:
|
|
267
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
268
|
+
# No ports or expose - only accessible within Docker network
|
|
269
|
+
|
|
270
|
+
# Redis - internal only
|
|
271
|
+
redis:
|
|
272
|
+
image: redis:7-alpine
|
|
273
|
+
volumes:
|
|
274
|
+
- redis-data:/data
|
|
275
|
+
# No ports or expose - only accessible within Docker network
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
167
278
|
## Private Registry Configuration
|
|
168
279
|
|
|
169
280
|
This project uses a private registry at \`10.0.0.2:5000\`. The staging server has \`insecure-registries\` configured, but Coolify's helper container may not inherit this. Pre-pulling images on the target server can help avoid registry issues.
|
|
@@ -46,11 +46,21 @@ jobs:
|
|
|
46
46
|
- name: Determine target branch
|
|
47
47
|
id: target
|
|
48
48
|
run: |
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
SOURCE_BRANCH="\${{ github.ref_name }}"
|
|
50
|
+
|
|
51
|
+
# Feature/fix/hotfix branches target develop
|
|
52
|
+
if [[ "\\$SOURCE_BRANCH" == feature/* ]] || [[ "\\$SOURCE_BRANCH" == fix/* ]] || [[ "\\$SOURCE_BRANCH" == hotfix/* ]]; then
|
|
53
|
+
echo "branch=develop" >> \\$GITHUB_OUTPUT
|
|
54
|
+
# Develop targets staging
|
|
55
|
+
elif [[ "\\$SOURCE_BRANCH" == "develop" ]]; then
|
|
56
|
+
echo "branch=staging" >> \\$GITHUB_OUTPUT
|
|
57
|
+
# Staging/other branches don't create PRs (staging->main handled separately)
|
|
58
|
+
else
|
|
59
|
+
echo "branch=" >> \\$GITHUB_OUTPUT
|
|
60
|
+
fi
|
|
52
61
|
|
|
53
62
|
- name: Create deploy PR
|
|
63
|
+
if: steps.target.outputs.branch != ''
|
|
54
64
|
uses: actions/github-script@v7
|
|
55
65
|
with:
|
|
56
66
|
script: |
|