suthep 0.1.0-beta.1 → 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.
Files changed (69) hide show
  1. package/README.md +167 -69
  2. package/dist/commands/down.js +179 -0
  3. package/dist/commands/down.js.map +1 -0
  4. package/dist/commands/redeploy.js +59 -0
  5. package/dist/commands/redeploy.js.map +1 -0
  6. package/dist/commands/up.js +213 -0
  7. package/dist/commands/up.js.map +1 -0
  8. package/dist/index.js +28 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/utils/deployment.js +10 -1
  11. package/dist/utils/deployment.js.map +1 -1
  12. package/dist/utils/docker.js +35 -0
  13. package/dist/utils/docker.js.map +1 -1
  14. package/dist/utils/nginx.js +10 -0
  15. package/dist/utils/nginx.js.map +1 -1
  16. package/docs/README.md +25 -82
  17. package/docs/english/01-introduction.md +84 -0
  18. package/docs/english/02-installation.md +200 -0
  19. package/docs/english/03-quick-start.md +256 -0
  20. package/docs/english/04-configuration.md +358 -0
  21. package/docs/english/05-commands.md +363 -0
  22. package/docs/english/06-examples.md +456 -0
  23. package/docs/english/07-troubleshooting.md +417 -0
  24. package/docs/english/08-advanced.md +411 -0
  25. package/docs/english/README.md +48 -0
  26. package/docs/thai/01-introduction.md +84 -0
  27. package/docs/thai/02-installation.md +200 -0
  28. package/docs/thai/03-quick-start.md +256 -0
  29. package/docs/thai/04-configuration.md +358 -0
  30. package/docs/thai/05-commands.md +363 -0
  31. package/docs/thai/06-examples.md +456 -0
  32. package/docs/thai/07-troubleshooting.md +417 -0
  33. package/docs/thai/08-advanced.md +411 -0
  34. package/docs/thai/README.md +48 -0
  35. package/example/README.md +282 -53
  36. package/example/suthep-complete.yml +103 -0
  37. package/example/suthep-docker-only.yml +71 -0
  38. package/example/suthep-no-docker.yml +51 -0
  39. package/example/{muacle.yml → suthep-path-routing.yml} +20 -5
  40. package/example/suthep.example.yml +89 -0
  41. package/package.json +1 -1
  42. package/src/commands/down.ts +240 -0
  43. package/src/commands/redeploy.ts +78 -0
  44. package/src/commands/up.ts +271 -0
  45. package/src/index.ts +53 -0
  46. package/suthep-0.1.0-beta.1.tgz +0 -0
  47. package/suthep.example.yml +5 -0
  48. package/suthep.yml +39 -0
  49. package/docs/TRANSLATIONS.md +0 -211
  50. package/docs/en/README.md +0 -76
  51. package/docs/en/api-reference.md +0 -545
  52. package/docs/en/architecture.md +0 -369
  53. package/docs/en/commands.md +0 -273
  54. package/docs/en/configuration.md +0 -347
  55. package/docs/en/developer-guide.md +0 -588
  56. package/docs/en/docker-ports-config.md +0 -333
  57. package/docs/en/examples.md +0 -537
  58. package/docs/en/getting-started.md +0 -202
  59. package/docs/en/port-binding.md +0 -268
  60. package/docs/en/troubleshooting.md +0 -441
  61. package/docs/th/README.md +0 -64
  62. package/docs/th/commands.md +0 -202
  63. package/docs/th/configuration.md +0 -325
  64. package/docs/th/getting-started.md +0 -203
  65. package/example/docker-compose.yml +0 -76
  66. package/example/docker-ports-example.yml +0 -81
  67. package/example/port-binding-example.yml +0 -45
  68. package/example/suthep.yml +0 -46
  69. package/example/suthep=1.yml +0 -46
package/src/index.ts CHANGED
@@ -3,8 +3,11 @@ import { readFileSync } from 'fs'
3
3
  import { dirname, join } from 'path'
4
4
  import { fileURLToPath } from 'url'
5
5
  import { deployCommand } from './commands/deploy'
6
+ import { downCommand } from './commands/down'
6
7
  import { initCommand } from './commands/init'
8
+ import { redeployCommand } from './commands/redeploy'
7
9
  import { setupCommand } from './commands/setup'
10
+ import { upCommand } from './commands/up'
8
11
 
9
12
  const __filename = fileURLToPath(import.meta.url)
10
13
  const __dirname = dirname(__filename)
@@ -39,4 +42,54 @@ program
39
42
  .option('--no-nginx', 'Skip Nginx configuration')
40
43
  .action(deployCommand)
41
44
 
45
+ program
46
+ .command('down')
47
+ .description('Bring down services (stop containers and disable Nginx configs)')
48
+ .option('-f, --file <path>', 'Configuration file path', 'suthep.yml')
49
+ .option('--all', 'Bring down all services', false)
50
+ .argument('[service-name]', 'Name of the service to bring down')
51
+ .action((serviceName, options) => {
52
+ downCommand({
53
+ file: options.file || 'suthep.yml',
54
+ all: options.all || false,
55
+ serviceName: serviceName,
56
+ })
57
+ })
58
+
59
+ program
60
+ .command('up')
61
+ .description('Bring up services (start containers and enable Nginx configs)')
62
+ .option('-f, --file <path>', 'Configuration file path', 'suthep.yml')
63
+ .option('--all', 'Bring up all services', false)
64
+ .option('--no-https', 'Skip HTTPS setup')
65
+ .option('--no-nginx', 'Skip Nginx configuration')
66
+ .argument('[service-name]', 'Name of the service to bring up')
67
+ .action((serviceName, options) => {
68
+ upCommand({
69
+ file: options.file || 'suthep.yml',
70
+ all: options.all || false,
71
+ serviceName: serviceName,
72
+ https: options.https !== false,
73
+ nginx: options.nginx !== false,
74
+ })
75
+ })
76
+
77
+ program
78
+ .command('redeploy')
79
+ .description('Redeploy services (bring down and deploy again)')
80
+ .option('-f, --file <path>', 'Configuration file path', 'suthep.yml')
81
+ .option('--all', 'Redeploy all services', false)
82
+ .option('--no-https', 'Skip HTTPS setup')
83
+ .option('--no-nginx', 'Skip Nginx configuration')
84
+ .argument('[service-name]', 'Name of the service to redeploy')
85
+ .action((serviceName, options) => {
86
+ redeployCommand({
87
+ file: options.file || 'suthep.yml',
88
+ all: options.all || false,
89
+ serviceName: serviceName,
90
+ https: options.https !== false,
91
+ nginx: options.nginx !== false,
92
+ })
93
+ })
94
+
42
95
  program.parse()
Binary file
@@ -85,6 +85,11 @@ services:
85
85
  path: /
86
86
  interval: 30
87
87
 
88
+ # ========================================
89
+ # Deployment Platform Configuration
90
+ # ========================================
91
+ # Nginx + Certbot Configuration
92
+
88
93
  nginx:
89
94
  configPath: /etc/nginx/sites-available
90
95
  reloadCommand: sudo nginx -t && sudo systemctl reload nginx
package/suthep.yml ADDED
@@ -0,0 +1,39 @@
1
+ project:
2
+ name: small-production-app
3
+ version: 1.0.0
4
+
5
+ services:
6
+ # Simple API service for small production deployment
7
+ # - name: muacle-api-dev
8
+ # port: 3003
9
+ # path: /api
10
+ # domains:
11
+ # - dev.muacle.com
12
+ # docker:
13
+ # image: muacle-api:dev
14
+ # container: api-container-dev
15
+ # port: 3001
16
+ # healthCheck:
17
+ # path: /health
18
+ # interval: 30
19
+ # environment:
20
+ # NODE_ENV: production
21
+
22
+ # UI service on root path
23
+ - name: muacle-ui-dev
24
+ port: 3002
25
+ path: /
26
+ domains:
27
+ - localhost
28
+ docker:
29
+ image: frontend-api:latest
30
+ container: ui-container-dev
31
+ port: 3000
32
+ # healthCheck:
33
+ # path: /
34
+ # interval: 30
35
+
36
+ deployment:
37
+ strategy: rolling
38
+ healthCheckTimeout: 30000
39
+
@@ -1,211 +0,0 @@
1
- # Translations Guide
2
-
3
- This document describes the translation structure and how to contribute translations for the Suthep documentation.
4
-
5
- ## Directory Structure
6
-
7
- ```
8
- docs/
9
- ├── README.md # Main documentation index with language selection
10
- ├── TRANSLATIONS.md # This file - translation guide
11
- ├── en/ # English documentation (default)
12
- │ ├── README.md
13
- │ ├── getting-started.md
14
- │ ├── configuration.md
15
- │ ├── commands.md
16
- │ ├── port-binding.md
17
- │ ├── docker-ports-config.md
18
- │ ├── examples.md
19
- │ ├── troubleshooting.md
20
- │ ├── architecture.md
21
- │ ├── developer-guide.md
22
- │ └── api-reference.md
23
- └── th/ # Thai documentation
24
- ├── README.md
25
- ├── getting-started.md
26
- ├── configuration.md
27
- └── commands.md
28
- ```
29
-
30
- ## Translation Status
31
-
32
- | Document | English | Thai | Status |
33
- |----------|---------|------|--------|
34
- | README | ✅ | ✅ | Complete |
35
- | Getting Started | ✅ | ✅ | Complete |
36
- | Configuration | ✅ | ✅ | Complete |
37
- | Commands | ✅ | ✅ | Complete |
38
- | Port Binding | ✅ | ⏳ | English only |
39
- | Docker Ports Config | ✅ | ⏳ | English only |
40
- | Examples | ✅ | ⏳ | English only |
41
- | Troubleshooting | ✅ | ⏳ | English only |
42
- | Architecture | ✅ | ⏳ | English only |
43
- | Developer Guide | ✅ | ⏳ | English only |
44
- | API Reference | ✅ | ⏳ | English only |
45
-
46
- **Legend:**
47
- - ✅ Available
48
- - ⏳ Coming soon / In progress
49
- - ❌ Not started
50
-
51
- ## Adding a New Translation
52
-
53
- ### Step 1: Create Language Folder
54
-
55
- Create a new folder for your language using the ISO 639-1 language code:
56
-
57
- ```bash
58
- mkdir docs/ja # For Japanese
59
- mkdir docs/es # For Spanish
60
- mkdir docs/fr # For French
61
- ```
62
-
63
- ### Step 2: Create README.md
64
-
65
- Create a `README.md` file in the new language folder that:
66
- - Welcomes users in the target language
67
- - Lists all available documents
68
- - Links to English versions for untranslated documents
69
- - Links back to the main documentation index
70
-
71
- Example structure:
72
-
73
- ```markdown
74
- # Suthep Documentation
75
-
76
- [Welcome message in target language]
77
-
78
- ## Table of Contents
79
-
80
- 1. [Getting Started](./getting-started.md)
81
- 2. [Configuration](./configuration.md)
82
- ...
83
-
84
- ## Other Languages
85
-
86
- - [English](../en/README.md)
87
- - [Your Language](./README.md) (current)
88
- ```
89
-
90
- ### Step 3: Translate Documents
91
-
92
- Translate documents in priority order:
93
-
94
- 1. **README.md** - Main index
95
- 2. **getting-started.md** - Most important for new users
96
- 3. **configuration.md** - Essential reference
97
- 4. **commands.md** - User-facing documentation
98
- 5. Other documents as needed
99
-
100
- ### Step 4: Update Links
101
-
102
- - Update internal links to use relative paths within the language folder
103
- - Link to English versions (`../en/filename.md`) for untranslated documents
104
- - Update the main `docs/README.md` to include your language
105
-
106
- ### Step 5: Update Translation Status
107
-
108
- Update this file (`TRANSLATIONS.md`) to reflect the new translation status.
109
-
110
- ## Translation Guidelines
111
-
112
- ### File Naming
113
-
114
- - Use the same filenames as English versions
115
- - Keep file extensions: `.md`
116
- - No language suffix needed (language is determined by folder)
117
-
118
- ### Link Structure
119
-
120
- - **Within same language**: `./filename.md`
121
- - **To English version**: `../en/filename.md`
122
- - **To main index**: `../README.md`
123
- - **To other languages**: `../lang-code/README.md`
124
-
125
- ### Code Examples
126
-
127
- - Keep code examples in English (they're universal)
128
- - Translate comments in code examples if appropriate
129
- - Keep command-line examples in English
130
-
131
- ### Technical Terms
132
-
133
- - Keep technical terms in English when there's no common translation
134
- - Use English terms for: Docker, Nginx, Certbot, SSL, HTTPS, etc.
135
- - Provide explanations in the target language
136
-
137
- ### Formatting
138
-
139
- - Maintain the same Markdown structure
140
- - Keep the same heading hierarchy
141
- - Preserve code blocks and syntax highlighting
142
- - Maintain table structures
143
-
144
- ## Website Integration
145
-
146
- This structure is designed to work with documentation websites:
147
-
148
- ### Static Site Generators
149
-
150
- Works well with:
151
- - **Docusaurus** - Multi-language support built-in
152
- - **VitePress** - Supports i18n
153
- - **MkDocs** - With i18n plugin
154
- - **GitBook** - Multi-language support
155
-
156
- ### URL Structure
157
-
158
- For websites, URLs would be:
159
- - `/en/getting-started` - English
160
- - `/th/getting-started` - Thai
161
- - `/` - Language selection
162
-
163
- ### Configuration Example (Docusaurus)
164
-
165
- ```javascript
166
- // docusaurus.config.js
167
- module.exports = {
168
- i18n: {
169
- defaultLocale: 'en',
170
- locales: ['en', 'th'],
171
- localeConfigs: {
172
- en: {
173
- label: 'English',
174
- },
175
- th: {
176
- label: 'ไทย',
177
- },
178
- },
179
- },
180
- };
181
- ```
182
-
183
- ## Contributing
184
-
185
- 1. **Fork the repository**
186
- 2. **Create a language folder** (if new language)
187
- 3. **Translate documents** following the guidelines
188
- 4. **Update this file** with translation status
189
- 5. **Submit a pull request**
190
-
191
- ## Quality Checklist
192
-
193
- Before submitting a translation:
194
-
195
- - [ ] All internal links work correctly
196
- - [ ] Code examples are preserved
197
- - [ ] Technical terms are handled appropriately
198
- - [ ] Formatting matches English version
199
- - [ ] README.md includes language selection
200
- - [ ] Translation status is updated
201
- - [ ] Main README.md is updated
202
-
203
- ## Questions?
204
-
205
- If you have questions about translations:
206
- - Open an issue on GitHub
207
- - Check existing translations for examples
208
- - Review the English documentation for context
209
-
210
- Thank you for contributing to Suthep documentation! 🎉
211
-
package/docs/en/README.md DELETED
@@ -1,76 +0,0 @@
1
- # Suthep Documentation
2
-
3
- Welcome to the Suthep documentation! This guide will help you understand and use Suthep, a powerful CLI tool for deploying projects with automatic Nginx reverse proxy setup, HTTPS with Certbot, and zero-downtime deployments.
4
-
5
- ## Table of Contents
6
-
7
- ### User Documentation
8
-
9
- 1. [Getting Started](./getting-started.md) - Installation and quick start guide
10
- 2. [Configuration Reference](./configuration.md) - Complete configuration file reference
11
- 3. [Commands Reference](./commands.md) - Detailed command documentation
12
- 4. [Port Binding Guide](./port-binding.md) - How Docker port binding works
13
- 5. [Docker Ports Configuration](./docker-ports-config.md) - How to configure ports in suthep.yml
14
- 6. [Examples](./examples.md) - Real-world deployment examples
15
- 7. [Troubleshooting](./troubleshooting.md) - Common issues and solutions
16
-
17
- ### Developer Documentation
18
-
19
- 8. [Developer Guide](./developer-guide.md) - **Complete guide for developers and contributors**
20
- 9. [Architecture](./architecture.md) - How Suthep works under the hood
21
- 10. [API Reference](./api-reference.md) - Internal utilities and functions
22
-
23
- ## What is Suthep?
24
-
25
- Suthep is a deployment automation tool that simplifies the process of deploying web services with:
26
-
27
- - ✅ **Automatic Nginx reverse proxy setup** - No manual Nginx configuration needed
28
- - ✅ **Automatic HTTPS with Certbot** - Free SSL certificates from Let's Encrypt
29
- - ✅ **Zero-downtime deployment** - Rolling and blue-green deployment strategies
30
- - ✅ **Docker container support** - Deploy containerized applications easily
31
- - ✅ **Multiple domain/subdomain support** - One service, multiple domains
32
- - ✅ **Health check integration** - Ensure services are healthy before going live
33
- - ✅ **YAML-based configuration** - Simple, declarative configuration
34
-
35
- ## Quick Start
36
-
37
- ```bash
38
- # Install dependencies
39
- npm install
40
- npm link
41
-
42
- # Initialize configuration
43
- suthep init
44
-
45
- # Setup prerequisites
46
- suthep setup
47
-
48
- # Deploy your services
49
- suthep deploy
50
- ```
51
-
52
- ## Requirements
53
-
54
- - Node.js 16+
55
- - Nginx (installed via `suthep setup`)
56
- - Certbot (installed via `suthep setup`)
57
- - Docker (optional, for Docker-based services)
58
- - sudo access (for Nginx and Certbot operations)
59
-
60
- ## Cost Optimization
61
-
62
- Suthep helps save costs on VMs by:
63
- - Efficiently managing multiple services on a single server
64
- - Automatic reverse proxy setup reduces manual configuration time
65
- - Zero-downtime deployments reduce service interruptions
66
- - Health checks ensure service reliability
67
-
68
- ## Other Languages / ภาษาอื่นๆ
69
-
70
- - [English](./README.md) - English documentation (current)
71
- - [ไทย](../th/README.md) - Thai documentation / เอกสารภาษาไทย
72
- - [Back to Main Documentation](../README.md) - Return to language selection
73
-
74
- ## License
75
-
76
- [MIT](../../LICENSE)