suthep 0.1.0 → 0.2.0-beta.1
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 +172 -71
- package/dist/commands/deploy.js +251 -37
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/down.js +179 -0
- package/dist/commands/down.js.map +1 -0
- package/dist/commands/redeploy.js +59 -0
- package/dist/commands/redeploy.js.map +1 -0
- package/dist/commands/up.js +213 -0
- package/dist/commands/up.js.map +1 -0
- package/dist/index.js +36 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/certbot.js +40 -3
- package/dist/utils/certbot.js.map +1 -1
- package/dist/utils/config-loader.js +30 -0
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/deployment.js +49 -16
- package/dist/utils/deployment.js.map +1 -1
- package/dist/utils/docker.js +396 -25
- package/dist/utils/docker.js.map +1 -1
- package/dist/utils/nginx.js +167 -8
- package/dist/utils/nginx.js.map +1 -1
- package/docs/README.md +25 -49
- package/docs/english/01-introduction.md +84 -0
- package/docs/english/02-installation.md +200 -0
- package/docs/english/03-quick-start.md +256 -0
- package/docs/english/04-configuration.md +358 -0
- package/docs/english/05-commands.md +363 -0
- package/docs/english/06-examples.md +456 -0
- package/docs/english/07-troubleshooting.md +417 -0
- package/docs/english/08-advanced.md +411 -0
- package/docs/english/README.md +48 -0
- package/docs/thai/01-introduction.md +84 -0
- package/docs/thai/02-installation.md +200 -0
- package/docs/thai/03-quick-start.md +256 -0
- package/docs/thai/04-configuration.md +358 -0
- package/docs/thai/05-commands.md +363 -0
- package/docs/thai/06-examples.md +456 -0
- package/docs/thai/07-troubleshooting.md +417 -0
- package/docs/thai/08-advanced.md +411 -0
- package/docs/thai/README.md +48 -0
- package/example/README.md +286 -53
- package/example/suthep-complete.yml +103 -0
- package/example/suthep-docker-only.yml +71 -0
- package/example/suthep-no-docker.yml +51 -0
- package/example/suthep-path-routing.yml +62 -0
- package/example/suthep.example.yml +89 -0
- package/package.json +1 -1
- package/src/commands/deploy.ts +322 -50
- package/src/commands/down.ts +240 -0
- package/src/commands/redeploy.ts +78 -0
- package/src/commands/up.ts +271 -0
- package/src/index.ts +62 -1
- package/src/types/config.ts +25 -24
- package/src/utils/certbot.ts +68 -6
- package/src/utils/config-loader.ts +40 -0
- package/src/utils/deployment.ts +61 -36
- package/src/utils/docker.ts +634 -30
- package/src/utils/nginx.ts +187 -4
- package/suthep-0.1.0-beta.1.tgz +0 -0
- package/suthep-0.1.1.tgz +0 -0
- package/suthep.example.yml +34 -0
- package/suthep.yml +39 -0
- package/test +0 -0
- package/docs/api-reference.md +0 -545
- package/docs/architecture.md +0 -367
- package/docs/commands.md +0 -273
- package/docs/configuration.md +0 -347
- package/docs/examples.md +0 -537
- package/docs/getting-started.md +0 -197
- package/docs/troubleshooting.md +0 -441
- package/example/docker-compose.yml +0 -72
- package/example/suthep.yml +0 -31
package/example/README.md
CHANGED
|
@@ -1,81 +1,314 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Suthep Configuration Examples
|
|
2
2
|
|
|
3
|
-
This directory contains
|
|
3
|
+
This directory contains comprehensive examples showing how to configure Suthep for various deployment scenarios.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Directory Structure
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```
|
|
8
|
+
example/
|
|
9
|
+
├── services/ # Individual service configurations
|
|
10
|
+
│ ├── api-no-docker.yml # Service without Docker container
|
|
11
|
+
│ ├── webapp-docker.yml # Service with Docker image
|
|
12
|
+
│ ├── dashboard-docker.yml # Service with Docker + environment variables
|
|
13
|
+
│ ├── database-proxy.yml # Connecting to existing Docker container
|
|
14
|
+
│ ├── api-path-routing.yml # API service with path-based routing
|
|
15
|
+
│ └── ui-path-routing.yml # UI service with path-based routing
|
|
16
|
+
├── configs/ # Complete configuration files
|
|
17
|
+
│ ├── suthep-complete.yml # All service types combined
|
|
18
|
+
│ ├── suthep-no-docker.yml # Services without Docker
|
|
19
|
+
│ ├── suthep-docker-only.yml # All Docker services
|
|
20
|
+
│ └── suthep-path-routing.yml # Path-based routing example
|
|
21
|
+
├── nginx/ # Nginx configuration examples
|
|
22
|
+
│ ├── nginx-template.conf # Single service template
|
|
23
|
+
│ └── nginx-multi-service.conf # Multi-service template
|
|
24
|
+
├── docker/ # Docker-related examples
|
|
25
|
+
│ ├── docker-compose.example.yml # Docker Compose example
|
|
26
|
+
│ └── Dockerfile.example # Example Dockerfile
|
|
27
|
+
└── README.md # This file
|
|
28
|
+
```
|
|
9
29
|
|
|
10
|
-
##
|
|
30
|
+
## Service Types
|
|
11
31
|
|
|
12
|
-
|
|
32
|
+
### 1. Services Without Docker
|
|
13
33
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
These services run directly on the host machine (managed by PM2, systemd, supervisor, etc.).
|
|
35
|
+
|
|
36
|
+
**Example:** `services/api-no-docker.yml`
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
- name: api
|
|
40
|
+
port: 3000
|
|
41
|
+
domains:
|
|
42
|
+
- api.example.com
|
|
43
|
+
healthCheck:
|
|
44
|
+
path: /health
|
|
45
|
+
interval: 30
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Use Cases:**
|
|
49
|
+
- Node.js apps managed by PM2
|
|
50
|
+
- Python apps with Gunicorn/systemd
|
|
51
|
+
- Go binaries running as systemd services
|
|
52
|
+
- Any process listening on a specific port
|
|
53
|
+
|
|
54
|
+
### 2. Services With Docker Image
|
|
17
55
|
|
|
18
|
-
|
|
19
|
-
docker-compose logs -f
|
|
56
|
+
Suthep will pull the image and create a new container.
|
|
20
57
|
|
|
21
|
-
|
|
22
|
-
docker-compose down
|
|
58
|
+
**Example:** `services/webapp-docker.yml`
|
|
23
59
|
|
|
24
|
-
|
|
25
|
-
|
|
60
|
+
```yaml
|
|
61
|
+
- name: webapp
|
|
62
|
+
port: 8080
|
|
63
|
+
docker:
|
|
64
|
+
image: nginx:latest
|
|
65
|
+
container: webapp-container
|
|
66
|
+
port: 80
|
|
67
|
+
domains:
|
|
68
|
+
- example.com
|
|
26
69
|
```
|
|
27
70
|
|
|
28
|
-
|
|
71
|
+
**Use Cases:**
|
|
72
|
+
- Applications packaged as Docker images
|
|
73
|
+
- Third-party services from Docker Hub
|
|
74
|
+
- Services that need containerization
|
|
29
75
|
|
|
30
|
-
|
|
76
|
+
### 3. Services Connecting to Existing Containers
|
|
31
77
|
|
|
32
|
-
|
|
33
|
-
- Image: `nginx:latest`
|
|
34
|
-
- Container: `webapp-container`
|
|
35
|
-
- Maps to container port 80
|
|
78
|
+
Connect to containers already running (e.g., from docker-compose).
|
|
36
79
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
**Example:** `services/database-proxy.yml`
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- name: database-proxy
|
|
84
|
+
port: 5432
|
|
85
|
+
docker:
|
|
86
|
+
container: postgres-container
|
|
87
|
+
port: 5432
|
|
88
|
+
domains:
|
|
89
|
+
- db.example.com
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Use Cases:**
|
|
93
|
+
- Containers managed by docker-compose
|
|
94
|
+
- Pre-existing containers
|
|
95
|
+
- Infrastructure services (databases, Redis, etc.)
|
|
96
|
+
|
|
97
|
+
### 4. Path-Based Routing
|
|
98
|
+
|
|
99
|
+
Multiple services on the same domain using different paths.
|
|
100
|
+
|
|
101
|
+
**Example:** `services/api-path-routing.yml` + `services/ui-path-routing.yml`
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
# API on /api path
|
|
105
|
+
- name: api
|
|
106
|
+
port: 3001
|
|
107
|
+
path: /api
|
|
108
|
+
domains:
|
|
109
|
+
- muacle.com
|
|
110
|
+
|
|
111
|
+
# UI on root path
|
|
112
|
+
- name: ui
|
|
113
|
+
port: 3000
|
|
114
|
+
path: /
|
|
115
|
+
domains:
|
|
116
|
+
- muacle.com
|
|
117
|
+
```
|
|
41
118
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- Default credentials: `postgres/postgres`
|
|
119
|
+
**Use Cases:**
|
|
120
|
+
- Monorepo deployments
|
|
121
|
+
- Microservices on single domain
|
|
122
|
+
- API + UI on same domain
|
|
47
123
|
|
|
48
|
-
|
|
49
|
-
- Image: `redis:latest`
|
|
50
|
-
- Container: `redis-container`
|
|
124
|
+
## Complete Configuration Examples
|
|
51
125
|
|
|
52
|
-
|
|
126
|
+
### Complete Example
|
|
127
|
+
**File:** `configs/suthep-complete.yml`
|
|
53
128
|
|
|
54
|
-
|
|
55
|
-
- All services are connected via a Docker network named `suthep-network`
|
|
56
|
-
- The dashboard service depends on postgres and redis, so they will start in order
|
|
57
|
-
- PostgreSQL data is persisted in a Docker volume
|
|
129
|
+
Combines all service types in a single configuration. Great for understanding all options.
|
|
58
130
|
|
|
59
|
-
|
|
131
|
+
### No Docker Example
|
|
132
|
+
**File:** `configs/suthep-no-docker.yml`
|
|
60
133
|
|
|
61
|
-
|
|
134
|
+
All services run directly on the host. Perfect for traditional deployments without containerization.
|
|
135
|
+
|
|
136
|
+
### Docker Only Example
|
|
137
|
+
**File:** `configs/suthep-docker-only.yml`
|
|
138
|
+
|
|
139
|
+
All services are Docker containers. Ideal for fully containerized architectures.
|
|
140
|
+
|
|
141
|
+
### Path Routing Example
|
|
142
|
+
**File:** `configs/suthep-path-routing.yml`
|
|
143
|
+
|
|
144
|
+
Shows how to route multiple services on the same domain using paths.
|
|
145
|
+
|
|
146
|
+
## Using the Examples
|
|
147
|
+
|
|
148
|
+
### Option 1: Copy a Complete Config
|
|
62
149
|
|
|
63
150
|
```bash
|
|
64
|
-
#
|
|
65
|
-
|
|
151
|
+
# Copy a complete example
|
|
152
|
+
cp example/configs/suthep-complete.yml suthep.yml
|
|
153
|
+
|
|
154
|
+
# Edit with your settings
|
|
155
|
+
nano suthep.yml
|
|
66
156
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
# build: ./path-to-dashboard
|
|
70
|
-
# ...
|
|
157
|
+
# Deploy
|
|
158
|
+
suthep deploy
|
|
71
159
|
```
|
|
72
160
|
|
|
73
|
-
|
|
161
|
+
### Option 2: Build from Individual Services
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Create your config file
|
|
165
|
+
cat > suthep.yml << EOF
|
|
166
|
+
project:
|
|
167
|
+
name: my-app
|
|
168
|
+
version: 1.0.0
|
|
169
|
+
|
|
170
|
+
services:
|
|
171
|
+
EOF
|
|
172
|
+
|
|
173
|
+
# Add services from examples
|
|
174
|
+
cat example/services/api-no-docker.yml >> suthep.yml
|
|
175
|
+
cat example/services/webapp-docker.yml >> suthep.yml
|
|
176
|
+
|
|
177
|
+
# Add nginx and certbot config
|
|
178
|
+
cat >> suthep.yml << EOF
|
|
179
|
+
|
|
180
|
+
nginx:
|
|
181
|
+
configPath: /etc/nginx/sites-available
|
|
182
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
183
|
+
|
|
184
|
+
certbot:
|
|
185
|
+
email: admin@example.com
|
|
186
|
+
staging: false
|
|
187
|
+
|
|
188
|
+
deployment:
|
|
189
|
+
strategy: rolling
|
|
190
|
+
healthCheckTimeout: 30000
|
|
191
|
+
EOF
|
|
192
|
+
|
|
193
|
+
# Deploy
|
|
194
|
+
suthep deploy
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Option 3: Mix and Match
|
|
198
|
+
|
|
199
|
+
Combine individual service examples to create your custom configuration:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Start with project header
|
|
203
|
+
cat > suthep.yml << EOF
|
|
204
|
+
project:
|
|
205
|
+
name: my-custom-app
|
|
206
|
+
version: 1.0.0
|
|
207
|
+
|
|
208
|
+
services:
|
|
209
|
+
EOF
|
|
210
|
+
|
|
211
|
+
# Add specific services you need
|
|
212
|
+
cat example/services/api-no-docker.yml >> suthep.yml
|
|
213
|
+
cat example/services/database-proxy.yml >> suthep.yml
|
|
214
|
+
|
|
215
|
+
# Add standard config
|
|
216
|
+
cat >> suthep.yml << EOF
|
|
217
|
+
|
|
218
|
+
nginx:
|
|
219
|
+
configPath: /etc/nginx/sites-available
|
|
220
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
221
|
+
|
|
222
|
+
certbot:
|
|
223
|
+
email: your-email@example.com
|
|
224
|
+
staging: false
|
|
225
|
+
|
|
226
|
+
deployment:
|
|
227
|
+
strategy: rolling
|
|
228
|
+
healthCheckTimeout: 30000
|
|
229
|
+
EOF
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Additional Files
|
|
233
|
+
|
|
234
|
+
### Nginx Templates
|
|
235
|
+
|
|
236
|
+
The `nginx/` directory contains example configurations that Suthep generates automatically. You typically don't need to edit these manually, but they're useful for understanding how Suthep configures Nginx.
|
|
237
|
+
|
|
238
|
+
### Docker Examples
|
|
239
|
+
|
|
240
|
+
The `docker/` directory contains:
|
|
241
|
+
- `docker-compose.example.yml`: Shows how to run containers that Suthep can connect to
|
|
242
|
+
- `Dockerfile.example`: Example Dockerfile for building your application images
|
|
243
|
+
|
|
244
|
+
## Configuration Reference
|
|
245
|
+
|
|
246
|
+
### Service Configuration
|
|
247
|
+
|
|
248
|
+
| Property | Required | Description |
|
|
249
|
+
|----------|----------|-------------|
|
|
250
|
+
| `name` | ✅ | Unique identifier for the service |
|
|
251
|
+
| `port` | ✅ | Port number the service runs on (host port) |
|
|
252
|
+
| `domains` | ✅ | Array of domain names or subdomains |
|
|
253
|
+
| `docker` | ❌ | Docker configuration (see below) |
|
|
254
|
+
| `path` | ❌ | Path prefix (e.g., `/api`, `/`). Defaults to `/` |
|
|
255
|
+
| `healthCheck` | ❌ | Health check configuration |
|
|
256
|
+
| `environment` | ❌ | Environment variables (key-value pairs) |
|
|
257
|
+
|
|
258
|
+
### Docker Configuration
|
|
259
|
+
|
|
260
|
+
When using Docker:
|
|
261
|
+
|
|
262
|
+
```yaml
|
|
263
|
+
docker:
|
|
264
|
+
image: nginx:latest # Image to pull (required if creating new container)
|
|
265
|
+
container: my-container # Container name (required)
|
|
266
|
+
port: 80 # Internal container port (required)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
- **With image**: Suthep creates a new container from the image
|
|
270
|
+
- **Without image**: Suthep connects to an existing container
|
|
271
|
+
|
|
272
|
+
### Health Check Configuration
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
healthCheck:
|
|
276
|
+
path: /health # HTTP endpoint path
|
|
277
|
+
interval: 30 # Check interval in seconds
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Deployment Configuration
|
|
281
|
+
|
|
282
|
+
```yaml
|
|
283
|
+
deployment:
|
|
284
|
+
strategy: rolling # Options: rolling, blue-green
|
|
285
|
+
healthCheckTimeout: 30000 # Timeout in milliseconds
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Quick Start
|
|
289
|
+
|
|
290
|
+
1. **Choose an example** from `configs/` or build from `services/`
|
|
291
|
+
2. **Copy to `suthep.yml`** in your project root
|
|
292
|
+
3. **Edit the configuration** with your actual domains and settings
|
|
293
|
+
4. **Run setup** (first time only):
|
|
294
|
+
```bash
|
|
295
|
+
suthep setup
|
|
296
|
+
```
|
|
297
|
+
5. **Deploy**:
|
|
298
|
+
```bash
|
|
299
|
+
suthep deploy
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Tips
|
|
74
303
|
|
|
75
|
-
|
|
304
|
+
- **Testing**: Set `certbot.staging: true` when testing to avoid rate limits
|
|
305
|
+
- **Path Routing**: Order matters - most specific paths should be defined first
|
|
306
|
+
- **Existing Containers**: Ensure containers are running and accessible before deployment
|
|
307
|
+
- **Port Conflicts**: Each service must use a unique port
|
|
308
|
+
- **Container Names**: Each Docker container must have a unique name
|
|
76
309
|
|
|
77
|
-
|
|
78
|
-
- Dashboard: http://localhost:5000
|
|
79
|
-
- PostgreSQL: localhost:5432
|
|
80
|
-
- Redis: localhost:6379
|
|
310
|
+
## Need Help?
|
|
81
311
|
|
|
312
|
+
- Check the main [README.md](../README.md) for command reference
|
|
313
|
+
- Review the [suthep.example.yml](../suthep.example.yml) in the project root
|
|
314
|
+
- See individual service examples in `services/` for specific use cases
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Complete Example Configuration
|
|
2
|
+
# This combines all service types for a comprehensive deployment
|
|
3
|
+
|
|
4
|
+
project:
|
|
5
|
+
name: my-app
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
|
|
8
|
+
services:
|
|
9
|
+
# Service 1: Simple API without Docker (runs directly on host)
|
|
10
|
+
- name: api
|
|
11
|
+
port: 3000
|
|
12
|
+
domains:
|
|
13
|
+
- api.example.com
|
|
14
|
+
- www.api.example.com
|
|
15
|
+
healthCheck:
|
|
16
|
+
path: /health
|
|
17
|
+
interval: 30
|
|
18
|
+
environment:
|
|
19
|
+
NODE_ENV: production
|
|
20
|
+
PORT: 3000
|
|
21
|
+
|
|
22
|
+
# Service 2: Web application with Docker image
|
|
23
|
+
- name: webapp
|
|
24
|
+
port: 8080
|
|
25
|
+
docker:
|
|
26
|
+
image: nginx:latest
|
|
27
|
+
container: webapp-container
|
|
28
|
+
port: 80
|
|
29
|
+
domains:
|
|
30
|
+
- example.com
|
|
31
|
+
- www.example.com
|
|
32
|
+
healthCheck:
|
|
33
|
+
path: /
|
|
34
|
+
interval: 30
|
|
35
|
+
|
|
36
|
+
# Service 3: Dashboard with Docker and environment variables
|
|
37
|
+
- name: dashboard
|
|
38
|
+
port: 5000
|
|
39
|
+
docker:
|
|
40
|
+
image: myapp/dashboard:latest
|
|
41
|
+
container: dashboard-container
|
|
42
|
+
port: 5000
|
|
43
|
+
domains:
|
|
44
|
+
- dashboard.example.com
|
|
45
|
+
- admin.example.com
|
|
46
|
+
healthCheck:
|
|
47
|
+
path: /api/health
|
|
48
|
+
interval: 60
|
|
49
|
+
environment:
|
|
50
|
+
DATABASE_URL: postgresql://localhost:5432/dashboard
|
|
51
|
+
REDIS_URL: redis://localhost:6379
|
|
52
|
+
|
|
53
|
+
# Service 4: Connect to existing Docker container
|
|
54
|
+
- name: database-proxy
|
|
55
|
+
port: 5432
|
|
56
|
+
docker:
|
|
57
|
+
container: postgres-container
|
|
58
|
+
port: 5432
|
|
59
|
+
domains:
|
|
60
|
+
- db.example.com
|
|
61
|
+
|
|
62
|
+
# Service 5: Path-based routing - API on /api path
|
|
63
|
+
- name: api-v2
|
|
64
|
+
port: 3001
|
|
65
|
+
path: /api
|
|
66
|
+
domains:
|
|
67
|
+
- muacle.com
|
|
68
|
+
docker:
|
|
69
|
+
image: myapp/api:latest
|
|
70
|
+
container: api-v2-container
|
|
71
|
+
port: 3001
|
|
72
|
+
healthCheck:
|
|
73
|
+
path: /health
|
|
74
|
+
interval: 30
|
|
75
|
+
|
|
76
|
+
# Service 6: Path-based routing - UI on root path
|
|
77
|
+
- name: ui
|
|
78
|
+
port: 3000
|
|
79
|
+
path: /
|
|
80
|
+
domains:
|
|
81
|
+
- muacle.com
|
|
82
|
+
docker:
|
|
83
|
+
image: myapp/ui:latest
|
|
84
|
+
container: ui-container
|
|
85
|
+
port: 3000
|
|
86
|
+
healthCheck:
|
|
87
|
+
path: /
|
|
88
|
+
interval: 30
|
|
89
|
+
|
|
90
|
+
# Nginx Configuration
|
|
91
|
+
nginx:
|
|
92
|
+
configPath: /etc/nginx/sites-available
|
|
93
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
94
|
+
|
|
95
|
+
# Certbot Configuration (SSL/TLS certificates)
|
|
96
|
+
certbot:
|
|
97
|
+
email: admin@example.com
|
|
98
|
+
staging: false # Set to true for testing
|
|
99
|
+
|
|
100
|
+
# Deployment Strategy
|
|
101
|
+
deployment:
|
|
102
|
+
strategy: rolling # Options: rolling, blue-green
|
|
103
|
+
healthCheckTimeout: 30000 # milliseconds
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Example: Configuration with Docker Only
|
|
2
|
+
# All services are deployed as Docker containers
|
|
3
|
+
|
|
4
|
+
project:
|
|
5
|
+
name: docker-app
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
|
|
8
|
+
services:
|
|
9
|
+
# Frontend application
|
|
10
|
+
- name: frontend
|
|
11
|
+
port: 3000
|
|
12
|
+
docker:
|
|
13
|
+
image: myapp/frontend:latest
|
|
14
|
+
container: frontend-container
|
|
15
|
+
port: 3000
|
|
16
|
+
domains:
|
|
17
|
+
- example.com
|
|
18
|
+
- www.example.com
|
|
19
|
+
healthCheck:
|
|
20
|
+
path: /
|
|
21
|
+
interval: 30
|
|
22
|
+
|
|
23
|
+
# Backend API
|
|
24
|
+
- name: backend
|
|
25
|
+
port: 4000
|
|
26
|
+
docker:
|
|
27
|
+
image: myapp/backend:latest
|
|
28
|
+
container: backend-container
|
|
29
|
+
port: 4000
|
|
30
|
+
domains:
|
|
31
|
+
- api.example.com
|
|
32
|
+
healthCheck:
|
|
33
|
+
path: /api/health
|
|
34
|
+
interval: 30
|
|
35
|
+
environment:
|
|
36
|
+
NODE_ENV: production
|
|
37
|
+
DATABASE_URL: postgresql://db:5432/mydb
|
|
38
|
+
|
|
39
|
+
# Worker service
|
|
40
|
+
- name: worker
|
|
41
|
+
port: 5000
|
|
42
|
+
docker:
|
|
43
|
+
image: myapp/worker:latest
|
|
44
|
+
container: worker-container
|
|
45
|
+
port: 5000
|
|
46
|
+
domains:
|
|
47
|
+
- worker.example.com
|
|
48
|
+
healthCheck:
|
|
49
|
+
path: /health
|
|
50
|
+
interval: 60
|
|
51
|
+
|
|
52
|
+
# Redis proxy (connecting to existing container)
|
|
53
|
+
- name: redis-proxy
|
|
54
|
+
port: 6379
|
|
55
|
+
docker:
|
|
56
|
+
container: redis-container
|
|
57
|
+
port: 6379
|
|
58
|
+
domains:
|
|
59
|
+
- redis.example.com
|
|
60
|
+
|
|
61
|
+
nginx:
|
|
62
|
+
configPath: /etc/nginx/sites-available
|
|
63
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
64
|
+
|
|
65
|
+
certbot:
|
|
66
|
+
email: admin@example.com
|
|
67
|
+
staging: false
|
|
68
|
+
|
|
69
|
+
deployment:
|
|
70
|
+
strategy: rolling
|
|
71
|
+
healthCheckTimeout: 30000
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Example: Configuration without Docker
|
|
2
|
+
# All services run directly on the host machine
|
|
3
|
+
# Useful for services managed by PM2, systemd, supervisor, etc.
|
|
4
|
+
|
|
5
|
+
project:
|
|
6
|
+
name: my-app
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
|
|
9
|
+
services:
|
|
10
|
+
# Node.js API service (e.g., running with PM2)
|
|
11
|
+
- name: api
|
|
12
|
+
port: 3000
|
|
13
|
+
domains:
|
|
14
|
+
- api.example.com
|
|
15
|
+
healthCheck:
|
|
16
|
+
path: /health
|
|
17
|
+
interval: 30
|
|
18
|
+
environment:
|
|
19
|
+
NODE_ENV: production
|
|
20
|
+
PORT: 3000
|
|
21
|
+
|
|
22
|
+
# Python web service (e.g., running with Gunicorn)
|
|
23
|
+
- name: web
|
|
24
|
+
port: 8000
|
|
25
|
+
domains:
|
|
26
|
+
- example.com
|
|
27
|
+
- www.example.com
|
|
28
|
+
healthCheck:
|
|
29
|
+
path: /health
|
|
30
|
+
interval: 30
|
|
31
|
+
|
|
32
|
+
# Go microservice
|
|
33
|
+
- name: auth
|
|
34
|
+
port: 4000
|
|
35
|
+
domains:
|
|
36
|
+
- auth.example.com
|
|
37
|
+
healthCheck:
|
|
38
|
+
path: /status
|
|
39
|
+
interval: 60
|
|
40
|
+
|
|
41
|
+
nginx:
|
|
42
|
+
configPath: /etc/nginx/sites-available
|
|
43
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
44
|
+
|
|
45
|
+
certbot:
|
|
46
|
+
email: admin@example.com
|
|
47
|
+
staging: false
|
|
48
|
+
|
|
49
|
+
deployment:
|
|
50
|
+
strategy: rolling
|
|
51
|
+
healthCheckTimeout: 30000
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Example: Path-based Routing Configuration
|
|
2
|
+
# Multiple services on the same domain using different paths
|
|
3
|
+
# This is useful for monorepo deployments or microservices
|
|
4
|
+
|
|
5
|
+
project:
|
|
6
|
+
name: path-routing-app
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
|
|
9
|
+
services:
|
|
10
|
+
# API service on /api path
|
|
11
|
+
- name: api
|
|
12
|
+
port: 3001
|
|
13
|
+
path: /api
|
|
14
|
+
domains:
|
|
15
|
+
- muacle.com
|
|
16
|
+
docker:
|
|
17
|
+
image: myapp/api:latest
|
|
18
|
+
container: api-container
|
|
19
|
+
port: 3001
|
|
20
|
+
healthCheck:
|
|
21
|
+
path: /health
|
|
22
|
+
interval: 30
|
|
23
|
+
|
|
24
|
+
# UI service on root path
|
|
25
|
+
- name: ui
|
|
26
|
+
port: 3000
|
|
27
|
+
path: /
|
|
28
|
+
domains:
|
|
29
|
+
- muacle.com
|
|
30
|
+
docker:
|
|
31
|
+
image: myapp/ui:latest
|
|
32
|
+
container: ui-container
|
|
33
|
+
port: 3000
|
|
34
|
+
healthCheck:
|
|
35
|
+
path: /
|
|
36
|
+
interval: 30
|
|
37
|
+
|
|
38
|
+
# Admin service on /admin path
|
|
39
|
+
- name: admin
|
|
40
|
+
port: 3002
|
|
41
|
+
path: /admin
|
|
42
|
+
domains:
|
|
43
|
+
- muacle.com
|
|
44
|
+
docker:
|
|
45
|
+
image: myapp/admin:latest
|
|
46
|
+
container: admin-container
|
|
47
|
+
port: 3002
|
|
48
|
+
healthCheck:
|
|
49
|
+
path: /health
|
|
50
|
+
interval: 30
|
|
51
|
+
|
|
52
|
+
nginx:
|
|
53
|
+
configPath: /etc/nginx/sites-available
|
|
54
|
+
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
55
|
+
|
|
56
|
+
certbot:
|
|
57
|
+
email: admin@example.com
|
|
58
|
+
staging: false
|
|
59
|
+
|
|
60
|
+
deployment:
|
|
61
|
+
strategy: rolling
|
|
62
|
+
healthCheckTimeout: 30000
|