@panoptic-it-solutions/coolify-setup 1.1.33 → 1.1.34
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 +18 -0
- package/dist/templates/claude-rules.js +109 -2
- 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');
|
|
@@ -34,12 +34,31 @@ This project uses a trunk-based development workflow with deployment branches:
|
|
|
34
34
|
|
|
35
35
|
3. **Staging Deployment**: Merge PR to \`staging\`
|
|
36
36
|
- Coolify auto-deploys to staging server
|
|
37
|
-
- GitHub Actions
|
|
37
|
+
- GitHub Actions runs semantic versioning workflow
|
|
38
|
+
- Creates \`staging-v*\` tags based on conventional commits
|
|
38
39
|
- Test changes in staging environment
|
|
39
40
|
|
|
40
|
-
4. **Production Deployment**:
|
|
41
|
+
4. **Production Deployment**: Create PR from \`staging\` to \`main\`
|
|
42
|
+
- Review changes and merge
|
|
41
43
|
- Coolify auto-deploys to production server
|
|
42
44
|
|
|
45
|
+
### Conventional Commits
|
|
46
|
+
|
|
47
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automatic semantic versioning on the staging branch:
|
|
48
|
+
|
|
49
|
+
| Commit Type | Version Bump | Example |
|
|
50
|
+
|-------------|--------------|---------|
|
|
51
|
+
| \`feat:\` | Minor (0.X.0) | \`feat: add user authentication\` |
|
|
52
|
+
| \`feat!:\` or \`BREAKING CHANGE:\` | Major (X.0.0) | \`feat!: redesign API endpoints\` |
|
|
53
|
+
| \`fix:\` | Patch (0.0.X) | \`fix: resolve login timeout\` |
|
|
54
|
+
| Other | Patch (0.0.X) | \`chore: update dependencies\` |
|
|
55
|
+
|
|
56
|
+
The staging version workflow automatically:
|
|
57
|
+
- Detects version bump type from commit messages since last staging tag
|
|
58
|
+
- Bumps version in package.json
|
|
59
|
+
- Creates a \`staging-v*\` tag
|
|
60
|
+
- Generates changelog with features, fixes, and other changes
|
|
61
|
+
|
|
43
62
|
### Branch Protection Rules
|
|
44
63
|
|
|
45
64
|
- \`develop\` is the default branch
|
|
@@ -164,6 +183,94 @@ When adding services that need baked-in configs:
|
|
|
164
183
|
- Sync the new Dockerfile to the deploy branch
|
|
165
184
|
- Update image tags in docker-compose.yml via sed
|
|
166
185
|
|
|
186
|
+
## Docker Compose Port Configuration
|
|
187
|
+
|
|
188
|
+
### Use \`expose\` Instead of \`ports\`
|
|
189
|
+
|
|
190
|
+
Coolify handles port mapping and domain routing automatically. Services should use \`expose\` to make ports available to Coolify without binding directly to host ports:
|
|
191
|
+
|
|
192
|
+
\`\`\`yaml
|
|
193
|
+
# CORRECT - Let Coolify handle port mapping
|
|
194
|
+
app:
|
|
195
|
+
image: registry/app:latest
|
|
196
|
+
expose:
|
|
197
|
+
- "3000"
|
|
198
|
+
|
|
199
|
+
minio:
|
|
200
|
+
image: minio/minio:latest
|
|
201
|
+
expose:
|
|
202
|
+
- "9000"
|
|
203
|
+
- "9001"
|
|
204
|
+
\`\`\`
|
|
205
|
+
|
|
206
|
+
\`\`\`yaml
|
|
207
|
+
# AVOID - Direct port binding conflicts with Coolify
|
|
208
|
+
app:
|
|
209
|
+
ports:
|
|
210
|
+
- "3000:3000"
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
### Internal-Only Services
|
|
214
|
+
|
|
215
|
+
Services like PostgreSQL and Redis should have no \`ports\` or \`expose\` directives. They communicate internally via Docker networking.
|
|
216
|
+
|
|
217
|
+
## Docker Networking - Service Names vs localhost
|
|
218
|
+
|
|
219
|
+
**CRITICAL**: In Docker Compose, containers communicate using **service names**, NOT \`localhost\`.
|
|
220
|
+
|
|
221
|
+
| Variable | ❌ WRONG | ✅ CORRECT |
|
|
222
|
+
|----------|----------|-----------|
|
|
223
|
+
| \`DATABASE_URL\` | \`@localhost:5432\` | \`@postgres:5432\` |
|
|
224
|
+
| \`REDIS_URL\` | \`redis://localhost:6379\` | \`redis://redis:6379\` |
|
|
225
|
+
| \`MINIO_ENDPOINT\` | \`http://localhost:9000\` | \`http://minio:9000\` |
|
|
226
|
+
|
|
227
|
+
### Why?
|
|
228
|
+
|
|
229
|
+
- **\`localhost\`** inside a container refers to **that container itself** - useless for cross-container communication
|
|
230
|
+
- **Service names** (e.g., \`postgres\`, \`redis\`, \`minio\`) are resolved by Docker's internal DNS to the correct container IP
|
|
231
|
+
|
|
232
|
+
### Service Names from docker-compose.yml
|
|
233
|
+
|
|
234
|
+
\`\`\`yaml
|
|
235
|
+
services:
|
|
236
|
+
app: # Other containers reach this as "app"
|
|
237
|
+
postgres: # Other containers reach this as "postgres"
|
|
238
|
+
redis: # Other containers reach this as "redis"
|
|
239
|
+
minio: # Other containers reach this as "minio"
|
|
240
|
+
\`\`\`
|
|
241
|
+
|
|
242
|
+
### Common Mistakes in Coolify Environment Variables
|
|
243
|
+
|
|
244
|
+
When setting environment variables in Coolify, ensure you use service names:
|
|
245
|
+
|
|
246
|
+
\`\`\`bash
|
|
247
|
+
# ❌ WRONG - will fail to connect
|
|
248
|
+
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
|
|
249
|
+
|
|
250
|
+
# ✅ CORRECT - uses Docker service name
|
|
251
|
+
DATABASE_URL=postgresql://user:pass@postgres:5432/mydb
|
|
252
|
+
\`\`\`
|
|
253
|
+
|
|
254
|
+
### Internal Services Configuration
|
|
255
|
+
|
|
256
|
+
\`\`\`yaml
|
|
257
|
+
# PostgreSQL - internal only (most secure)
|
|
258
|
+
postgres:
|
|
259
|
+
image: postgres:16-alpine
|
|
260
|
+
volumes:
|
|
261
|
+
- postgres-data:/var/lib/postgresql/data
|
|
262
|
+
healthcheck:
|
|
263
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
264
|
+
# No ports or expose - only accessible within Docker network
|
|
265
|
+
|
|
266
|
+
# Redis - internal only
|
|
267
|
+
redis:
|
|
268
|
+
image: redis:7-alpine
|
|
269
|
+
volumes:
|
|
270
|
+
- redis-data:/data
|
|
271
|
+
# No ports or expose - only accessible within Docker network
|
|
272
|
+
\`\`\`
|
|
273
|
+
|
|
167
274
|
## Private Registry Configuration
|
|
168
275
|
|
|
169
276
|
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.
|