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/docs/configuration.md
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
# Configuration Reference
|
|
2
|
-
|
|
3
|
-
Suthep uses a YAML configuration file (default: `suthep.yml`) to define your deployment. This document describes all available configuration options.
|
|
4
|
-
|
|
5
|
-
## Configuration File Structure
|
|
6
|
-
|
|
7
|
-
```yaml
|
|
8
|
-
project:
|
|
9
|
-
name: string
|
|
10
|
-
version: string
|
|
11
|
-
|
|
12
|
-
services:
|
|
13
|
-
- name: string
|
|
14
|
-
port: number
|
|
15
|
-
domains: string[]
|
|
16
|
-
docker?: DockerConfig
|
|
17
|
-
healthCheck?: HealthCheckConfig
|
|
18
|
-
environment?: Record<string, string>
|
|
19
|
-
|
|
20
|
-
nginx:
|
|
21
|
-
configPath: string
|
|
22
|
-
reloadCommand: string
|
|
23
|
-
|
|
24
|
-
certbot:
|
|
25
|
-
email: string
|
|
26
|
-
staging: boolean
|
|
27
|
-
|
|
28
|
-
deployment:
|
|
29
|
-
strategy: 'rolling' | 'blue-green'
|
|
30
|
-
healthCheckTimeout: number
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Project Configuration
|
|
34
|
-
|
|
35
|
-
### `project.name`
|
|
36
|
-
|
|
37
|
-
- **Type**: `string`
|
|
38
|
-
- **Required**: Yes
|
|
39
|
-
- **Description**: Name of your project
|
|
40
|
-
|
|
41
|
-
```yaml
|
|
42
|
-
project:
|
|
43
|
-
name: my-awesome-app
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### `project.version`
|
|
47
|
-
|
|
48
|
-
- **Type**: `string`
|
|
49
|
-
- **Required**: Yes
|
|
50
|
-
- **Description**: Version of your project
|
|
51
|
-
|
|
52
|
-
```yaml
|
|
53
|
-
project:
|
|
54
|
-
version: 1.0.0
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Service Configuration
|
|
58
|
-
|
|
59
|
-
Each service represents an application or service that will be deployed and exposed via Nginx.
|
|
60
|
-
|
|
61
|
-
### `services[].name`
|
|
62
|
-
|
|
63
|
-
- **Type**: `string`
|
|
64
|
-
- **Required**: Yes
|
|
65
|
-
- **Description**: Unique name for the service. Used for Nginx configuration files and Docker containers.
|
|
66
|
-
|
|
67
|
-
```yaml
|
|
68
|
-
services:
|
|
69
|
-
- name: api
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### `services[].port`
|
|
73
|
-
|
|
74
|
-
- **Type**: `number`
|
|
75
|
-
- **Required**: Yes
|
|
76
|
-
- **Description**: Port number where the service is listening (1-65535)
|
|
77
|
-
|
|
78
|
-
```yaml
|
|
79
|
-
services:
|
|
80
|
-
- name: api
|
|
81
|
-
port: 3000
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### `services[].domains`
|
|
85
|
-
|
|
86
|
-
- **Type**: `string[]`
|
|
87
|
-
- **Required**: Yes
|
|
88
|
-
- **Description**: Array of domain names or subdomains that will route to this service
|
|
89
|
-
|
|
90
|
-
```yaml
|
|
91
|
-
services:
|
|
92
|
-
- name: api
|
|
93
|
-
domains:
|
|
94
|
-
- api.example.com
|
|
95
|
-
- www.api.example.com
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### `services[].docker` (Optional)
|
|
99
|
-
|
|
100
|
-
Docker configuration for containerized services.
|
|
101
|
-
|
|
102
|
-
#### `docker.image`
|
|
103
|
-
|
|
104
|
-
- **Type**: `string`
|
|
105
|
-
- **Required**: No
|
|
106
|
-
- **Description**: Docker image to use. If omitted, Suthep will connect to an existing container.
|
|
107
|
-
|
|
108
|
-
```yaml
|
|
109
|
-
services:
|
|
110
|
-
- name: webapp
|
|
111
|
-
docker:
|
|
112
|
-
image: nginx:latest
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
#### `docker.container`
|
|
116
|
-
|
|
117
|
-
- **Type**: `string`
|
|
118
|
-
- **Required**: Yes (if `docker` is specified)
|
|
119
|
-
- **Description**: Name of the Docker container
|
|
120
|
-
|
|
121
|
-
```yaml
|
|
122
|
-
services:
|
|
123
|
-
- name: webapp
|
|
124
|
-
docker:
|
|
125
|
-
container: webapp-container
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
#### `docker.port`
|
|
129
|
-
|
|
130
|
-
- **Type**: `number`
|
|
131
|
-
- **Required**: Yes (if `docker` is specified)
|
|
132
|
-
- **Description**: Port inside the container that the service listens on
|
|
133
|
-
|
|
134
|
-
```yaml
|
|
135
|
-
services:
|
|
136
|
-
- name: webapp
|
|
137
|
-
port: 8080
|
|
138
|
-
docker:
|
|
139
|
-
port: 80 # Container's internal port
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Note**: The `service.port` is the host port, and `docker.port` is the container port. Suthep will map `service.port:docker.port`.
|
|
143
|
-
|
|
144
|
-
### `services[].healthCheck` (Optional)
|
|
145
|
-
|
|
146
|
-
Health check configuration for the service.
|
|
147
|
-
|
|
148
|
-
#### `healthCheck.path`
|
|
149
|
-
|
|
150
|
-
- **Type**: `string`
|
|
151
|
-
- **Required**: Yes (if `healthCheck` is specified)
|
|
152
|
-
- **Description**: HTTP path to the health check endpoint
|
|
153
|
-
|
|
154
|
-
```yaml
|
|
155
|
-
services:
|
|
156
|
-
- name: api
|
|
157
|
-
healthCheck:
|
|
158
|
-
path: /health
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
#### `healthCheck.interval`
|
|
162
|
-
|
|
163
|
-
- **Type**: `number`
|
|
164
|
-
- **Required**: Yes (if `healthCheck` is specified)
|
|
165
|
-
- **Description**: Health check interval in seconds
|
|
166
|
-
|
|
167
|
-
```yaml
|
|
168
|
-
services:
|
|
169
|
-
- name: api
|
|
170
|
-
healthCheck:
|
|
171
|
-
interval: 30
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### `services[].environment` (Optional)
|
|
175
|
-
|
|
176
|
-
- **Type**: `Record<string, string>`
|
|
177
|
-
- **Required**: No
|
|
178
|
-
- **Description**: Environment variables to pass to Docker containers
|
|
179
|
-
|
|
180
|
-
```yaml
|
|
181
|
-
services:
|
|
182
|
-
- name: api
|
|
183
|
-
docker:
|
|
184
|
-
image: myapp/api:latest
|
|
185
|
-
container: api-container
|
|
186
|
-
port: 3000
|
|
187
|
-
environment:
|
|
188
|
-
NODE_ENV: production
|
|
189
|
-
DATABASE_URL: postgresql://localhost:5432/mydb
|
|
190
|
-
API_KEY: secret-key
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Nginx Configuration
|
|
194
|
-
|
|
195
|
-
### `nginx.configPath`
|
|
196
|
-
|
|
197
|
-
- **Type**: `string`
|
|
198
|
-
- **Required**: Yes
|
|
199
|
-
- **Default**: `/etc/nginx/sites-available`
|
|
200
|
-
- **Description**: Path where Nginx configuration files will be stored
|
|
201
|
-
|
|
202
|
-
```yaml
|
|
203
|
-
nginx:
|
|
204
|
-
configPath: /etc/nginx/sites-available
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### `nginx.reloadCommand`
|
|
208
|
-
|
|
209
|
-
- **Type**: `string`
|
|
210
|
-
- **Required**: Yes
|
|
211
|
-
- **Description**: Command to test and reload Nginx configuration
|
|
212
|
-
|
|
213
|
-
```yaml
|
|
214
|
-
nginx:
|
|
215
|
-
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
## Certbot Configuration
|
|
219
|
-
|
|
220
|
-
### `certbot.email`
|
|
221
|
-
|
|
222
|
-
- **Type**: `string`
|
|
223
|
-
- **Required**: Yes
|
|
224
|
-
- **Description**: Email address for Let's Encrypt certificate notifications
|
|
225
|
-
|
|
226
|
-
```yaml
|
|
227
|
-
certbot:
|
|
228
|
-
email: admin@example.com
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### `certbot.staging`
|
|
232
|
-
|
|
233
|
-
- **Type**: `boolean`
|
|
234
|
-
- **Required**: Yes
|
|
235
|
-
- **Description**: Use Let's Encrypt staging environment (for testing). Set to `true` during development to avoid rate limits.
|
|
236
|
-
|
|
237
|
-
```yaml
|
|
238
|
-
certbot:
|
|
239
|
-
staging: false # Use production certificates
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
**Important**: Set `staging: true` when testing to avoid hitting Let's Encrypt rate limits.
|
|
243
|
-
|
|
244
|
-
## Deployment Configuration
|
|
245
|
-
|
|
246
|
-
### `deployment.strategy`
|
|
247
|
-
|
|
248
|
-
- **Type**: `'rolling' | 'blue-green'`
|
|
249
|
-
- **Required**: Yes
|
|
250
|
-
- **Description**: Deployment strategy to use
|
|
251
|
-
|
|
252
|
-
```yaml
|
|
253
|
-
deployment:
|
|
254
|
-
strategy: rolling
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Options**:
|
|
258
|
-
- `rolling`: Gradually replaces old instances with new ones (default)
|
|
259
|
-
- `blue-green`: Maintains two identical environments and switches between them
|
|
260
|
-
|
|
261
|
-
### `deployment.healthCheckTimeout`
|
|
262
|
-
|
|
263
|
-
- **Type**: `number`
|
|
264
|
-
- **Required**: Yes
|
|
265
|
-
- **Description**: Maximum time (in milliseconds) to wait for a service to become healthy
|
|
266
|
-
|
|
267
|
-
```yaml
|
|
268
|
-
deployment:
|
|
269
|
-
healthCheckTimeout: 30000 # 30 seconds
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## Complete Example
|
|
273
|
-
|
|
274
|
-
```yaml
|
|
275
|
-
project:
|
|
276
|
-
name: my-awesome-app
|
|
277
|
-
version: 1.0.0
|
|
278
|
-
|
|
279
|
-
services:
|
|
280
|
-
# Simple Node.js API
|
|
281
|
-
- name: api
|
|
282
|
-
port: 3000
|
|
283
|
-
domains:
|
|
284
|
-
- api.example.com
|
|
285
|
-
healthCheck:
|
|
286
|
-
path: /health
|
|
287
|
-
interval: 30
|
|
288
|
-
environment:
|
|
289
|
-
NODE_ENV: production
|
|
290
|
-
|
|
291
|
-
# Docker-based web application
|
|
292
|
-
- name: webapp
|
|
293
|
-
port: 8080
|
|
294
|
-
docker:
|
|
295
|
-
image: nginx:latest
|
|
296
|
-
container: webapp-container
|
|
297
|
-
port: 80
|
|
298
|
-
domains:
|
|
299
|
-
- example.com
|
|
300
|
-
- www.example.com
|
|
301
|
-
healthCheck:
|
|
302
|
-
path: /
|
|
303
|
-
interval: 30
|
|
304
|
-
|
|
305
|
-
# Connect to existing Docker container
|
|
306
|
-
- name: database-proxy
|
|
307
|
-
port: 5432
|
|
308
|
-
docker:
|
|
309
|
-
container: postgres-container
|
|
310
|
-
port: 5432
|
|
311
|
-
domains:
|
|
312
|
-
- db.example.com
|
|
313
|
-
|
|
314
|
-
nginx:
|
|
315
|
-
configPath: /etc/nginx/sites-available
|
|
316
|
-
reloadCommand: sudo nginx -t && sudo systemctl reload nginx
|
|
317
|
-
|
|
318
|
-
certbot:
|
|
319
|
-
email: admin@example.com
|
|
320
|
-
staging: false
|
|
321
|
-
|
|
322
|
-
deployment:
|
|
323
|
-
strategy: rolling
|
|
324
|
-
healthCheckTimeout: 30000
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## Configuration Validation
|
|
328
|
-
|
|
329
|
-
Suthep validates your configuration file when you run `suthep deploy`. Common validation errors:
|
|
330
|
-
|
|
331
|
-
- Missing required fields
|
|
332
|
-
- Invalid port numbers (must be 1-65535)
|
|
333
|
-
- Invalid email format
|
|
334
|
-
- Duplicate service names
|
|
335
|
-
- Missing Docker container name when Docker is enabled
|
|
336
|
-
|
|
337
|
-
## Environment Variables
|
|
338
|
-
|
|
339
|
-
You can use environment variables in your configuration file by using `${VAR_NAME}` syntax (if your YAML parser supports it), or by using a templating tool before deployment.
|
|
340
|
-
|
|
341
|
-
## Best Practices
|
|
342
|
-
|
|
343
|
-
1. **Use staging mode during development**: Set `certbot.staging: true` to avoid rate limits
|
|
344
|
-
2. **Always configure health checks**: Helps ensure services are ready before traffic is routed
|
|
345
|
-
3. **Use descriptive service names**: Makes Nginx configs easier to manage
|
|
346
|
-
4. **Keep configuration in version control**: Track changes to your deployment configuration
|
|
347
|
-
5. **Test locally first**: Use staging certificates and test domains before production
|