@sembix/cli 0.1.0
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/.env.example +6 -0
- package/LICENSE +15 -0
- package/README.md +698 -0
- package/config.example.yaml +118 -0
- package/dist/commands/hub-integration.d.ts +3 -0
- package/dist/commands/hub-integration.d.ts.map +1 -0
- package/dist/commands/hub-integration.js +107 -0
- package/dist/commands/hub-integration.js.map +1 -0
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +282 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +498 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config-schema.d.ts +417 -0
- package/dist/config-schema.d.ts.map +1 -0
- package/dist/config-schema.js +152 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +260 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/environment-setup.d.ts +4 -0
- package/dist/prompts/environment-setup.d.ts.map +1 -0
- package/dist/prompts/environment-setup.js +689 -0
- package/dist/prompts/environment-setup.js.map +1 -0
- package/dist/prompts/hub-integration-step.d.ts +21 -0
- package/dist/prompts/hub-integration-step.d.ts.map +1 -0
- package/dist/prompts/hub-integration-step.js +104 -0
- package/dist/prompts/hub-integration-step.js.map +1 -0
- package/dist/prompts/hub-integration.d.ts +4 -0
- package/dist/prompts/hub-integration.d.ts.map +1 -0
- package/dist/prompts/hub-integration.js +141 -0
- package/dist/prompts/hub-integration.js.map +1 -0
- package/dist/prompts/prompt-helpers.d.ts +18 -0
- package/dist/prompts/prompt-helpers.d.ts.map +1 -0
- package/dist/prompts/prompt-helpers.js +50 -0
- package/dist/prompts/prompt-helpers.js.map +1 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/config-loader.d.ts +34 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +377 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/github.d.ts +38 -0
- package/dist/utils/github.d.ts.map +1 -0
- package/dist/utils/github.js +188 -0
- package/dist/utils/github.js.map +1 -0
- package/dist/utils/ui.d.ts +18 -0
- package/dist/utils/ui.d.ts.map +1 -0
- package/dist/utils/ui.js +62 -0
- package/dist/utils/ui.js.map +1 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
# Sembix CLI
|
|
2
|
+
|
|
3
|
+
A terminal-based CLI tool for managing Sembix products. An intuitive command-line interface designed for technical users.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Interactive Setup** - Guided prompts for environment configuration with detailed explanations
|
|
8
|
+
- 📝 **Config File Support** - YAML configuration files for version-controlled, repeatable setups
|
|
9
|
+
- 🎯 **50+ CLI Flags** - Complete automation support with flags for every configuration option
|
|
10
|
+
- 🔐 **GitHub Integration** - Direct GitHub API integration for environment and secrets management
|
|
11
|
+
- ✅ **Validation** - Real-time input validation for AWS resources, IAM roles, and more
|
|
12
|
+
- 🔄 **Update Command** - Modify existing environments without recreation
|
|
13
|
+
- 🔗 **Hub Integration** - Built-in Hub configuration as part of the main workflow
|
|
14
|
+
- 🎨 **Beautiful UI** - Clean, colorful terminal interface with spinners and status updates
|
|
15
|
+
- ⚡ **Priority Chain** - CLI flags > Config file > Interactive prompts > Defaults
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- **Node.js** 20 or higher
|
|
20
|
+
- **GitHub Personal Access Token** with the following scopes:
|
|
21
|
+
- `repo` - Full control of private repositories
|
|
22
|
+
- `workflow` - Update GitHub Action workflows
|
|
23
|
+
- **Deployment Repository** - A GitHub repository set up for Sembix Studio deployments
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
### From npm (Recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @sembix/cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### From Source
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install
|
|
37
|
+
npm run build
|
|
38
|
+
|
|
39
|
+
# Link globally for development
|
|
40
|
+
npm link
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Development Mode
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install
|
|
47
|
+
npm run dev -- studio create
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
### Option 1: Environment Variables (.env file)
|
|
53
|
+
|
|
54
|
+
Create a `.env` file in the project root directory:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cp .env.example .env
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Edit `.env` and add your GitHub token:
|
|
61
|
+
|
|
62
|
+
```env
|
|
63
|
+
# GitHub Personal Access Token
|
|
64
|
+
GITHUB_TOKEN=ghp_your_token_here
|
|
65
|
+
|
|
66
|
+
# Optional: Default GitHub organization
|
|
67
|
+
DEFAULT_GITHUB_ORG=your-org
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Option 2: Config File (Recommended for Automation)
|
|
71
|
+
|
|
72
|
+
Create a YAML config file for your environment:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
# production.yaml
|
|
76
|
+
repository:
|
|
77
|
+
owner: acme-corp
|
|
78
|
+
repo: sembix-deployment
|
|
79
|
+
|
|
80
|
+
environmentName: client-abc-production
|
|
81
|
+
awsAccountId: "123456789012"
|
|
82
|
+
awsRegion: us-east-1
|
|
83
|
+
customerRoleArn: arn:aws:iam::123456789012:role/GitHubActionsDeployRole
|
|
84
|
+
terraformStateBucket: my-terraform-state-bucket
|
|
85
|
+
|
|
86
|
+
database:
|
|
87
|
+
name: sembix_studio
|
|
88
|
+
user: sembix_studio_user
|
|
89
|
+
|
|
90
|
+
# ... see config.example.yaml for complete structure
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See [`config.example.yaml`](./config.example.yaml) for a complete configuration example.
|
|
94
|
+
|
|
95
|
+
### Creating a GitHub Token
|
|
96
|
+
|
|
97
|
+
1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
|
|
98
|
+
2. Click "Generate new token (classic)"
|
|
99
|
+
3. Select scopes:
|
|
100
|
+
- ✅ `repo` (all sub-scopes)
|
|
101
|
+
- ✅ `workflow`
|
|
102
|
+
4. Generate and copy the token
|
|
103
|
+
5. Add to `.env` file or use `--token` flag
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### Quick Start
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Fully interactive (beginner-friendly)
|
|
111
|
+
sembix studio create
|
|
112
|
+
|
|
113
|
+
# Fast setup with config file
|
|
114
|
+
sembix studio create --config production.yaml
|
|
115
|
+
|
|
116
|
+
# Fully automated with CLI flags
|
|
117
|
+
sembix studio create production \
|
|
118
|
+
--repo acme/deploy \
|
|
119
|
+
--aws-account-id 123456789012 \
|
|
120
|
+
--aws-region us-east-1 \
|
|
121
|
+
--customer-role-arn arn:aws:iam::123456789012:role/Deploy \
|
|
122
|
+
--terraform-state-bucket my-tf-state \
|
|
123
|
+
# ... (all other flags)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Commands
|
|
127
|
+
|
|
128
|
+
### `sembix studio create`
|
|
129
|
+
|
|
130
|
+
Create a new Sembix Studio environment with complete configuration.
|
|
131
|
+
|
|
132
|
+
**Syntax:**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
sembix studio create [environment-name] [options]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Options:**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# General
|
|
142
|
+
-t, --token <token> GitHub personal access token
|
|
143
|
+
-c, --config <path> Path to YAML configuration file
|
|
144
|
+
-r, --repo <repo> Target repository (owner/repo format)
|
|
145
|
+
-e, --env <environment> Environment name (alternative to positional arg)
|
|
146
|
+
|
|
147
|
+
# AWS Basic Configuration
|
|
148
|
+
--aws-account-id <id> AWS Account ID (12 digits)
|
|
149
|
+
--aws-region <region> AWS Region (e.g., us-east-1)
|
|
150
|
+
--customer-role-arn <arn> GitHub Actions IAM role ARN
|
|
151
|
+
--terraform-state-bucket <bucket> S3 bucket for Terraform state
|
|
152
|
+
|
|
153
|
+
# Database
|
|
154
|
+
--database-name <name> PostgreSQL database name
|
|
155
|
+
--database-user <user> PostgreSQL database user
|
|
156
|
+
|
|
157
|
+
# Networking
|
|
158
|
+
--enable-vpc-endpoints <boolean> Enable VPC endpoints (true/false)
|
|
159
|
+
--use-custom-networking <boolean> Use existing VPC (true/false)
|
|
160
|
+
--vpc-cidr <cidr> VPC CIDR block (e.g., 10.0.0.0/16)
|
|
161
|
+
--public-subnet-cidrs <json> Public subnet CIDRs (JSON array)
|
|
162
|
+
--private-subnet-cidrs <json> Private subnet CIDRs (JSON array)
|
|
163
|
+
--az-count <count> Number of AZs (2 or 3)
|
|
164
|
+
--custom-vpc-id <id> Existing VPC ID
|
|
165
|
+
--custom-public-subnet-ids <ids> Existing public subnet IDs (comma-separated)
|
|
166
|
+
--custom-private-subnet-ids <ids> Existing private subnet IDs (comma-separated)
|
|
167
|
+
|
|
168
|
+
# Security - Security Groups
|
|
169
|
+
--use-custom-security-groups <boolean> Use custom security groups (true/false)
|
|
170
|
+
--sg-workflow-engine <id> Workflow Engine security group ID
|
|
171
|
+
--sg-aurora <id> Aurora database security group ID
|
|
172
|
+
--sg-rds-proxy <id> RDS Proxy security group ID
|
|
173
|
+
--sg-bff-ecs <id> BFF ECS service security group ID
|
|
174
|
+
--sg-bastion <id> Bastion host security group ID
|
|
175
|
+
--sg-bff-alb <id> BFF ALB security group ID
|
|
176
|
+
|
|
177
|
+
# Security - IAM Roles
|
|
178
|
+
--use-custom-iam-roles <boolean> Use custom IAM roles (true/false)
|
|
179
|
+
--iam-workflow-engine-exec <arn> Workflow Engine execution role ARN
|
|
180
|
+
--iam-workflow-engine-task <arn> Workflow Engine task role ARN
|
|
181
|
+
--iam-bff-ecs-exec <arn> BFF ECS task execution role ARN
|
|
182
|
+
--iam-bff-ecs-task <arn> BFF ECS task role ARN
|
|
183
|
+
--iam-rds-proxy <arn> RDS Proxy role ARN
|
|
184
|
+
--iam-studio-memory <arn> Studio Memory role ARN
|
|
185
|
+
--iam-studio-notification <arn> Studio Notification role ARN
|
|
186
|
+
|
|
187
|
+
# TLS/DNS
|
|
188
|
+
--cloudfront-domain <domain> CloudFront custom domain
|
|
189
|
+
--cloudfront-cert-arn <arn> CloudFront SSL certificate ARN (must be in us-east-1)
|
|
190
|
+
--bff-alb-cert-arn <arn> BFF ALB SSL certificate ARN
|
|
191
|
+
--hosted-zone-id <id> Route53 hosted zone ID
|
|
192
|
+
|
|
193
|
+
# Feature Flags
|
|
194
|
+
--deploy-studio-memory <boolean> Deploy Studio Memory service (true/false)
|
|
195
|
+
--deploy-studio-notifications <boolean> Deploy Studio Notifications (true/false)
|
|
196
|
+
--enable-bff-waf <boolean> Enable WAF for BFF (true/false)
|
|
197
|
+
|
|
198
|
+
# Frontend
|
|
199
|
+
--github-app-client-id <id> GitHub App OAuth client ID
|
|
200
|
+
--github-app-name <name> GitHub App name
|
|
201
|
+
--jira-client-id <id> Jira OAuth client ID
|
|
202
|
+
|
|
203
|
+
# Hub Integration (Step 9)
|
|
204
|
+
--skip-hub Skip Hub integration configuration
|
|
205
|
+
--hub-engine-execution-role <arn> Hub Engine Execution Role ARN
|
|
206
|
+
--hub-consumer-role <arn> Hub Consumer Role ARN
|
|
207
|
+
--hub-admin-role <arn> Hub Admin Role ARN
|
|
208
|
+
--hub-appconfig-role <arn> Hub AppConfig Role ARN
|
|
209
|
+
--hub-appconfig-app-id <id> Hub AppConfig Application ID
|
|
210
|
+
--hub-appconfig-env-id <id> Hub AppConfig Environment ID
|
|
211
|
+
--hub-appconfig-profile-id <id> Hub AppConfig Profile ID
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Examples:**
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Interactive mode (prompts for everything)
|
|
218
|
+
sembix studio create
|
|
219
|
+
|
|
220
|
+
# Specify environment name
|
|
221
|
+
sembix studio create production
|
|
222
|
+
|
|
223
|
+
# With repository
|
|
224
|
+
sembix studio create production --repo acme/deploy
|
|
225
|
+
|
|
226
|
+
# Using config file
|
|
227
|
+
sembix studio create --config production.yaml
|
|
228
|
+
|
|
229
|
+
# Config file with overrides
|
|
230
|
+
sembix studio create --config base.yaml \
|
|
231
|
+
--env client-abc-production \
|
|
232
|
+
--aws-account-id 123456789012
|
|
233
|
+
|
|
234
|
+
# Skip Hub integration (add later)
|
|
235
|
+
sembix studio create production --repo acme/deploy --skip-hub
|
|
236
|
+
|
|
237
|
+
# Fully automated with all flags
|
|
238
|
+
sembix studio create production \
|
|
239
|
+
--repo acme/deploy \
|
|
240
|
+
--aws-account-id 123456789012 \
|
|
241
|
+
--aws-region us-east-1 \
|
|
242
|
+
--customer-role-arn arn:aws:iam::123456789012:role/Deploy \
|
|
243
|
+
--terraform-state-bucket my-tf-state \
|
|
244
|
+
--database-name sembix_studio \
|
|
245
|
+
--database-user sembix_studio_user \
|
|
246
|
+
--cloudfront-domain studio.acme.com \
|
|
247
|
+
--cloudfront-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/abc \
|
|
248
|
+
--bff-alb-cert-arn arn:aws:acm:us-east-1:123456789012:certificate/def \
|
|
249
|
+
--hosted-zone-id Z1234567890ABC \
|
|
250
|
+
--github-app-client-id Iv1.0123456789abcdef \
|
|
251
|
+
--github-app-name sembix-studio-app \
|
|
252
|
+
--jira-client-id abc123def456
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**What it does:**
|
|
256
|
+
|
|
257
|
+
1. Validates repository and environment name
|
|
258
|
+
2. Walks through 9 configuration steps (or uses provided config):
|
|
259
|
+
- Repository selection
|
|
260
|
+
- Basic AWS configuration
|
|
261
|
+
- Database configuration
|
|
262
|
+
- Networking (VPC, subnets)
|
|
263
|
+
- Security (security groups, IAM roles, KMS)
|
|
264
|
+
- DNS & TLS (CloudFront, ALB certificates)
|
|
265
|
+
- Feature flags (Memory, Notifications, WAF)
|
|
266
|
+
- Frontend configuration (GitHub App, Jira)
|
|
267
|
+
- **Hub integration (optional)**
|
|
268
|
+
3. Creates GitHub Actions environment
|
|
269
|
+
4. Sets environment variables and encrypted secrets
|
|
270
|
+
5. Provides next steps for deployment
|
|
271
|
+
|
|
272
|
+
### `sembix studio update`
|
|
273
|
+
|
|
274
|
+
Update an existing Sembix Studio environment.
|
|
275
|
+
|
|
276
|
+
**Syntax:**
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
sembix studio update [environment-name] [options]
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Options:** Same as `create` command
|
|
283
|
+
|
|
284
|
+
**Examples:**
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Interactive update (re-prompts for all config)
|
|
288
|
+
sembix studio update production --repo acme/deploy
|
|
289
|
+
|
|
290
|
+
# Add Hub integration to existing environment
|
|
291
|
+
sembix studio update production --repo acme/deploy \
|
|
292
|
+
--hub-engine-execution-role arn:aws:iam::123456789012:role/HubEngine \
|
|
293
|
+
--hub-consumer-role arn:aws:iam::123456789012:role/HubConsumer \
|
|
294
|
+
--hub-admin-role arn:aws:iam::123456789012:role/HubAdmin
|
|
295
|
+
|
|
296
|
+
# Update specific fields only
|
|
297
|
+
sembix studio update production --repo acme/deploy \
|
|
298
|
+
--deploy-studio-memory true \
|
|
299
|
+
--enable-bff-waf true
|
|
300
|
+
|
|
301
|
+
# Update via config file
|
|
302
|
+
sembix studio update --config production-updates.yaml
|
|
303
|
+
|
|
304
|
+
# Update database credentials
|
|
305
|
+
sembix studio update production --repo acme/deploy \
|
|
306
|
+
--database-name new_db_name \
|
|
307
|
+
--database-user new_db_user
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**What it does:**
|
|
311
|
+
|
|
312
|
+
- Validates environment exists
|
|
313
|
+
- Updates only the fields you provide (partial updates)
|
|
314
|
+
- Interactive mode re-collects all configuration
|
|
315
|
+
- Preserves existing settings for fields not specified
|
|
316
|
+
|
|
317
|
+
### `sembix studio list`
|
|
318
|
+
|
|
319
|
+
List GitHub Actions environments in a repository.
|
|
320
|
+
|
|
321
|
+
**Syntax:**
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
sembix studio list [repository] [options]
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Examples:**
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# List all your repositories
|
|
331
|
+
sembix studio list
|
|
332
|
+
|
|
333
|
+
# List environments in specific repository
|
|
334
|
+
sembix studio list acme-corp/sembix-deployment
|
|
335
|
+
|
|
336
|
+
# With custom token
|
|
337
|
+
sembix studio list acme/deploy --token ghp_custom_token
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### `sembix studio add-hub` [DEPRECATED]
|
|
341
|
+
|
|
342
|
+
**⚠️ This command is deprecated.** Use `sembix studio update` instead.
|
|
343
|
+
|
|
344
|
+
Hub integration is now part of the main `create` workflow (Step 9) and can be added/updated using the `update` command.
|
|
345
|
+
|
|
346
|
+
## Workflow
|
|
347
|
+
|
|
348
|
+
### Complete Setup Process
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
┌─────────────────────────────────────────────────┐
|
|
352
|
+
│ 1. Run: sembix studio create │
|
|
353
|
+
│ • Configure environment (Steps 1-8) │
|
|
354
|
+
│ • Optionally configure Hub (Step 9) │
|
|
355
|
+
│ • Creates GitHub environment + secrets │
|
|
356
|
+
└─────────────────────────────────────────────────┘
|
|
357
|
+
↓
|
|
358
|
+
┌─────────────────────────────────────────────────┐
|
|
359
|
+
│ 2. Deploy via GitHub Actions │
|
|
360
|
+
│ • Go to repo → Actions │
|
|
361
|
+
│ • Run deployment workflow │
|
|
362
|
+
│ • Copy Hub ARNs from output (if needed) │
|
|
363
|
+
└─────────────────────────────────────────────────┘
|
|
364
|
+
↓
|
|
365
|
+
┌─────────────────────────────────────────────────┐
|
|
366
|
+
│ 3. Run: sembix studio update (if Hub skipped) │
|
|
367
|
+
│ • Add Hub role ARNs │
|
|
368
|
+
│ • Add AppConfig configuration │
|
|
369
|
+
└─────────────────────────────────────────────────┘
|
|
370
|
+
↓
|
|
371
|
+
┌─────────────────────────────────────────────────┐
|
|
372
|
+
│ 4. Deploy Again (with Hub integration) │
|
|
373
|
+
│ • Full Sembix Studio deployment │
|
|
374
|
+
│ • Cross-account access enabled │
|
|
375
|
+
└─────────────────────────────────────────────────┘
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Configuration Priority
|
|
379
|
+
|
|
380
|
+
The CLI follows this priority chain for configuration values:
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
CLI Flags > Config File > Interactive Prompts > Defaults
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Examples:**
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Config file provides base, CLI flags override specific values
|
|
390
|
+
sembix studio create --config base.yaml --env custom-name
|
|
391
|
+
|
|
392
|
+
# Interactive prompts only for missing values
|
|
393
|
+
sembix studio create --repo acme/deploy --aws-account-id 123456789012
|
|
394
|
+
# Will prompt for all other fields
|
|
395
|
+
|
|
396
|
+
# Fully automated (no prompts)
|
|
397
|
+
sembix studio create --config complete.yaml
|
|
398
|
+
# No prompts if config file is complete
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## Config File Reference
|
|
402
|
+
|
|
403
|
+
See [`config.example.yaml`](./config.example.yaml) for a complete, documented example.
|
|
404
|
+
|
|
405
|
+
**Minimal config:**
|
|
406
|
+
|
|
407
|
+
```yaml
|
|
408
|
+
repository:
|
|
409
|
+
owner: acme-corp
|
|
410
|
+
repo: sembix-deployment
|
|
411
|
+
|
|
412
|
+
environmentName: production
|
|
413
|
+
awsAccountId: "123456789012"
|
|
414
|
+
awsRegion: us-east-1
|
|
415
|
+
customerRoleArn: arn:aws:iam::123456789012:role/GitHubActionsDeployRole
|
|
416
|
+
terraformStateBucket: my-terraform-state-bucket
|
|
417
|
+
|
|
418
|
+
database:
|
|
419
|
+
name: sembix_studio
|
|
420
|
+
user: sembix_studio_user
|
|
421
|
+
|
|
422
|
+
tls:
|
|
423
|
+
cloudfrontDomain: studio.acme.com
|
|
424
|
+
cloudfrontCertArn: arn:aws:acm:us-east-1:123456789012:certificate/abc123
|
|
425
|
+
bffAlbCertificateArn: arn:aws:acm:us-east-1:123456789012:certificate/def456
|
|
426
|
+
hostedZoneId: Z1234567890ABC
|
|
427
|
+
|
|
428
|
+
frontend:
|
|
429
|
+
githubAppClientId: Iv1.0123456789abcdef
|
|
430
|
+
githubAppName: sembix-studio-app
|
|
431
|
+
jiraClientId: abc123def456
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Complete config with all options:**
|
|
435
|
+
|
|
436
|
+
```yaml
|
|
437
|
+
# See config.example.yaml for:
|
|
438
|
+
# - Networking configuration (VPC, subnets)
|
|
439
|
+
# - Custom security groups
|
|
440
|
+
# - Custom IAM roles
|
|
441
|
+
# - Feature flags
|
|
442
|
+
# - Hub integration
|
|
443
|
+
# - All advanced options
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Use Cases
|
|
447
|
+
|
|
448
|
+
### 1. First-Time Setup (Interactive Learning)
|
|
449
|
+
|
|
450
|
+
Perfect for understanding all configuration options:
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
sembix studio create
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Follow all 9 steps with detailed explanations.
|
|
457
|
+
|
|
458
|
+
### 2. Rapid Iteration (Config Files)
|
|
459
|
+
|
|
460
|
+
For creating multiple similar environments:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Create base config once
|
|
464
|
+
cp config.example.yaml clients/base.yaml
|
|
465
|
+
# Edit base.yaml with common settings
|
|
466
|
+
|
|
467
|
+
# Create client-specific environments
|
|
468
|
+
sembix studio create --config clients/base.yaml --env client-abc-prod
|
|
469
|
+
sembix studio create --config clients/base.yaml --env client-xyz-prod
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### 3. CI/CD Automation
|
|
473
|
+
|
|
474
|
+
For automated environment creation in pipelines:
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
#!/bin/bash
|
|
478
|
+
CLIENT_NAME=$1
|
|
479
|
+
sembix studio create "${CLIENT_NAME}-production" \
|
|
480
|
+
--config ci/base-config.yaml \
|
|
481
|
+
--token "$GITHUB_TOKEN" \
|
|
482
|
+
--aws-account-id "$CLIENT_AWS_ACCOUNT" \
|
|
483
|
+
--cloudfront-domain "studio.${CLIENT_NAME}.example.com"
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### 4. Infrastructure as Code
|
|
487
|
+
|
|
488
|
+
Version control your environment configurations:
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
configs/
|
|
492
|
+
├── base.yaml # Common settings
|
|
493
|
+
├── production.yaml # Production overrides
|
|
494
|
+
├── staging.yaml # Staging overrides
|
|
495
|
+
└── development.yaml # Dev overrides
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# Create from version-controlled configs
|
|
500
|
+
sembix studio create --config configs/production.yaml
|
|
501
|
+
sembix studio create --config configs/staging.yaml
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### 5. Hub Integration After Deployment
|
|
505
|
+
|
|
506
|
+
Add Hub configuration after initial deployment:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
# Step 1: Create without Hub
|
|
510
|
+
sembix studio create production --repo acme/deploy --skip-hub
|
|
511
|
+
|
|
512
|
+
# Step 2: Deploy and get Hub ARNs
|
|
513
|
+
|
|
514
|
+
# Step 3: Add Hub integration
|
|
515
|
+
sembix studio update production --repo acme/deploy \
|
|
516
|
+
--hub-engine-execution-role arn:aws:iam::123456789012:role/HubEngine \
|
|
517
|
+
--hub-consumer-role arn:aws:iam::123456789012:role/HubConsumer \
|
|
518
|
+
--hub-admin-role arn:aws:iam::123456789012:role/HubAdmin
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## Development
|
|
522
|
+
|
|
523
|
+
### Project Structure
|
|
524
|
+
|
|
525
|
+
```
|
|
526
|
+
sembix-cli/
|
|
527
|
+
├── src/
|
|
528
|
+
│ ├── commands/ # Command implementations
|
|
529
|
+
│ │ ├── setup.ts # Environment create command
|
|
530
|
+
│ │ ├── update.ts # Environment update command
|
|
531
|
+
│ │ └── hub-integration.ts # Deprecated hub command
|
|
532
|
+
│ ├── prompts/ # Interactive prompts
|
|
533
|
+
│ │ ├── environment-setup.ts # Main setup prompts
|
|
534
|
+
│ │ ├── hub-integration-step.ts # Hub integration prompts
|
|
535
|
+
│ │ └── hub-integration.ts # Deprecated hub prompts
|
|
536
|
+
│ ├── utils/ # Utility modules
|
|
537
|
+
│ │ ├── github.ts # GitHub API client
|
|
538
|
+
│ │ ├── ui.ts # Terminal UI utilities
|
|
539
|
+
│ │ └── config-loader.ts # Config file loading & merging
|
|
540
|
+
│ ├── types.ts # TypeScript types
|
|
541
|
+
│ ├── config-schema.ts # Zod schemas for config validation
|
|
542
|
+
│ ├── config.ts # Configuration management
|
|
543
|
+
│ └── index.ts # CLI entry point
|
|
544
|
+
├── config.example.yaml # Example config file
|
|
545
|
+
├── package.json
|
|
546
|
+
├── tsconfig.json
|
|
547
|
+
├── .env.example
|
|
548
|
+
└── README.md
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Scripts
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
npm run build # Compile TypeScript to JavaScript
|
|
555
|
+
npm run dev # Run in development mode with tsx
|
|
556
|
+
npm run type-check # Type check without emitting files
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### Adding New Commands
|
|
560
|
+
|
|
561
|
+
1. Create a new file in `src/commands/`
|
|
562
|
+
2. Implement the command logic
|
|
563
|
+
3. Add prompts in `src/prompts/` if needed
|
|
564
|
+
4. Register the command in `src/index.ts`
|
|
565
|
+
|
|
566
|
+
Example:
|
|
567
|
+
|
|
568
|
+
```typescript
|
|
569
|
+
// src/commands/my-command.ts
|
|
570
|
+
export async function myCommand(githubToken: string, options: Record<string, any>): Promise<void> {
|
|
571
|
+
// Command implementation
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// src/index.ts
|
|
575
|
+
studio
|
|
576
|
+
.command('my-command')
|
|
577
|
+
.description('Description of my command')
|
|
578
|
+
.option('-r, --repo <repo>', 'Target repository')
|
|
579
|
+
.action(async (options) => {
|
|
580
|
+
const { myCommand } = await import('./commands/my-command.js');
|
|
581
|
+
await myCommand(config.githubToken, options);
|
|
582
|
+
});
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
## Troubleshooting
|
|
586
|
+
|
|
587
|
+
### "GITHUB_TOKEN environment variable is required"
|
|
588
|
+
|
|
589
|
+
Make sure you have a `.env` file in the project root directory with your token:
|
|
590
|
+
|
|
591
|
+
```env
|
|
592
|
+
GITHUB_TOKEN=ghp_your_token_here
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
Or pass the token via CLI:
|
|
596
|
+
|
|
597
|
+
```bash
|
|
598
|
+
sembix studio create --token ghp_your_token_here
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### "Failed to create environment: Bad credentials"
|
|
602
|
+
|
|
603
|
+
Your GitHub token may be invalid or missing required scopes. Create a new token with `repo` and `workflow` scopes.
|
|
604
|
+
|
|
605
|
+
### "Failed to encrypt secret"
|
|
606
|
+
|
|
607
|
+
The `libsodium-wrappers` library is required for encrypting GitHub secrets. Make sure dependencies are installed:
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
npm install
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### "No repositories found"
|
|
614
|
+
|
|
615
|
+
Make sure your GitHub token has access to the repositories you want to manage. Check the token's permissions and organization access.
|
|
616
|
+
|
|
617
|
+
### "Invalid YAML syntax"
|
|
618
|
+
|
|
619
|
+
When using config files, validate your YAML syntax:
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
# Use a YAML validator
|
|
623
|
+
npm install -g js-yaml
|
|
624
|
+
js-yaml config.yaml
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
### "Environment already exists"
|
|
628
|
+
|
|
629
|
+
Use the `update` command instead of `create`:
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
sembix studio update production --repo acme/deploy
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Or delete the environment in GitHub and recreate it.
|
|
636
|
+
|
|
637
|
+
## Advanced Topics
|
|
638
|
+
|
|
639
|
+
### Partial Updates
|
|
640
|
+
|
|
641
|
+
The `update` command supports partial updates - only provide the flags you want to change:
|
|
642
|
+
|
|
643
|
+
```bash
|
|
644
|
+
# Only update feature flags
|
|
645
|
+
sembix studio update prod --repo acme/deploy \
|
|
646
|
+
--deploy-studio-memory true \
|
|
647
|
+
--enable-bff-waf false
|
|
648
|
+
|
|
649
|
+
# Only update Hub integration
|
|
650
|
+
sembix studio update prod --repo acme/deploy \
|
|
651
|
+
--hub-consumer-role arn:aws:iam::123456789012:role/NewConsumer
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Config File Inheritance
|
|
655
|
+
|
|
656
|
+
Create a base config and override specific values:
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
# base.yaml has common settings
|
|
660
|
+
# production.yaml imports and overrides
|
|
661
|
+
|
|
662
|
+
sembix studio create --config base.yaml --config production.yaml
|
|
663
|
+
# (Note: Multiple --config flags not yet supported, use CLI flags for overrides)
|
|
664
|
+
|
|
665
|
+
# Current approach:
|
|
666
|
+
sembix studio create --config base.yaml \
|
|
667
|
+
--env production \
|
|
668
|
+
--cloudfront-domain studio.prod.acme.com
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
### Batch Operations
|
|
672
|
+
|
|
673
|
+
Create multiple environments with a script:
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
#!/bin/bash
|
|
677
|
+
for CLIENT in client-a client-b client-c; do
|
|
678
|
+
sembix studio create "${CLIENT}-production" \
|
|
679
|
+
--config base.yaml \
|
|
680
|
+
--cloudfront-domain "studio.${CLIENT}.example.com" \
|
|
681
|
+
--aws-account-id "${CLIENT_AWS_ACCOUNTS[$CLIENT]}"
|
|
682
|
+
done
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
## License
|
|
686
|
+
|
|
687
|
+
Proprietary - Sembix AI
|
|
688
|
+
|
|
689
|
+
## Support
|
|
690
|
+
|
|
691
|
+
For issues or questions, contact the Sembix team or open an issue in the repository.
|
|
692
|
+
|
|
693
|
+
## See Also
|
|
694
|
+
|
|
695
|
+
- [QUICKSTART.md](./QUICKSTART.md) - 5-minute quick start guide
|
|
696
|
+
- [USAGE-EXAMPLES.md](./USAGE-EXAMPLES.md) - Real-world usage examples
|
|
697
|
+
- [COMMANDS.md](./COMMANDS.md) - Detailed command reference
|
|
698
|
+
- [config.example.yaml](./config.example.yaml) - Complete config file example
|