@factiii/stack 0.1.201 → 0.7.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/LICENSE +21 -21
- package/README.md +95 -403
- package/bin/stack +334 -334
- package/dist/cli/dev-sync.js +16 -16
- package/dist/plugins/addons/auth/index.d.ts.map +1 -1
- package/dist/plugins/addons/auth/index.js +31 -12
- package/dist/plugins/addons/auth/index.js.map +1 -1
- package/dist/plugins/addons/auth/scanfix/secrets.d.ts +3 -0
- package/dist/plugins/addons/auth/scanfix/secrets.d.ts.map +1 -1
- package/dist/plugins/addons/auth/scanfix/secrets.js +54 -19
- package/dist/plugins/addons/auth/scanfix/secrets.js.map +1 -1
- package/dist/plugins/addons/auth/scanfix/validate.d.ts +3 -0
- package/dist/plugins/addons/auth/scanfix/validate.d.ts.map +1 -1
- package/dist/plugins/addons/auth/scanfix/validate.js +37 -18
- package/dist/plugins/addons/auth/scanfix/validate.js.map +1 -1
- package/dist/plugins/addons/vercel/index.js +9 -9
- package/dist/plugins/addons/vercel/scanfix/config.js +10 -10
- package/dist/plugins/addons/vercel/scanfix/token.js +15 -15
- package/dist/plugins/approved.json +13 -13
- package/dist/plugins/pipelines/aws/index.js +12 -12
- package/dist/plugins/pipelines/aws/policies/bootstrap-policy.json +135 -135
- package/dist/plugins/pipelines/aws/prod.js +1 -1
- package/dist/plugins/pipelines/factiii/index.d.ts.map +1 -1
- package/dist/plugins/pipelines/factiii/index.js +2 -14
- package/dist/plugins/pipelines/factiii/index.js.map +1 -1
- package/dist/plugins/pipelines/factiii/prod.js +21 -21
- package/dist/plugins/pipelines/factiii/scanfix/port-convention.d.ts.map +1 -1
- package/dist/plugins/pipelines/factiii/scanfix/port-convention.js +2 -4
- package/dist/plugins/pipelines/factiii/scanfix/port-convention.js.map +1 -1
- package/dist/plugins/pipelines/factiii/staging.js +23 -23
- package/dist/plugins/pipelines/factiii/workflows/stack-ci.yml +75 -75
- package/dist/plugins/pipelines/factiii/workflows/stack-cicd-prod.yml +73 -73
- package/dist/plugins/servers/amazon-linux/index.js +16 -16
- package/dist/plugins/servers/mac/index.js +12 -12
- package/dist/plugins/servers/mac/staging.js +2 -2
- package/dist/plugins/servers/ubuntu/index.js +23 -23
- package/dist/plugins/servers/windows/index.js +15 -15
- package/dist/scanfix/commands/mac.d.ts.map +1 -1
- package/dist/scanfix/commands/mac.js +5 -4
- package/dist/scanfix/commands/mac.js.map +1 -1
- package/dist/scanfix/fixes/certbot.d.ts.map +1 -1
- package/dist/scanfix/fixes/certbot.js +4 -18
- package/dist/scanfix/fixes/certbot.js.map +1 -1
- package/dist/scanfix/fixes/docker.d.ts.map +1 -1
- package/dist/scanfix/fixes/docker.js +5 -14
- package/dist/scanfix/fixes/docker.js.map +1 -1
- package/dist/scanfix/ssl-cert-helper.d.ts.map +1 -1
- package/dist/scanfix/ssl-cert-helper.js +18 -4
- package/dist/scanfix/ssl-cert-helper.js.map +1 -1
- package/dist/scripts/generate-all.js +73 -73
- package/dist/utils/deployment-report.js +2 -2
- package/dist/utils/secret-prompts.js +34 -34
- package/dist/utils/ssh-helper.d.ts.map +1 -1
- package/dist/utils/ssh-helper.js +150 -142
- package/dist/utils/ssh-helper.js.map +1 -1
- package/dist/utils/template-generator.js +74 -74
- package/package.json +93 -114
- package/dist/plugins/pipelines/factiii/scanfix/docker.d.ts +0 -20
- package/dist/plugins/pipelines/factiii/scanfix/docker.d.ts.map +0 -1
- package/dist/plugins/pipelines/factiii/scanfix/docker.js +0 -131
- package/dist/plugins/pipelines/factiii/scanfix/docker.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-present Factiii.io
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Factiii.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,403 +1,95 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Infrastructure management CLI
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
# -
|
|
16
|
-
# -
|
|
17
|
-
# -
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Scan
|
|
98
|
-
|
|
99
|
-
Checks all environments for issues:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
npx stack scan # Scan all (dev, secrets, staging, prod)
|
|
103
|
-
npx stack scan --dev # Scan dev only
|
|
104
|
-
npx stack scan --staging # Scan staging only
|
|
105
|
-
npx stack scan --prod # Scan prod only
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Note:** Requires `stack.yml` (or legacy factiii.yml) to exist. Run `npx stack init` first.
|
|
109
|
-
|
|
110
|
-
### Fix
|
|
111
|
-
|
|
112
|
-
Automatically fixes issues where possible:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npx stack fix # Fix all environments
|
|
116
|
-
npx stack fix --dev # Fix dev only
|
|
117
|
-
npx stack fix --staging # Fix staging only
|
|
118
|
-
npx stack fix --prod # Fix prod only
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Note:** Requires `stack.yml` (or legacy factiii.yml) to exist. Run `npx stack init` first.
|
|
122
|
-
|
|
123
|
-
### Deploy
|
|
124
|
-
|
|
125
|
-
Deploys to environments (runs scan first, aborts on issues):
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
npx stack deploy --dev # Start local dev containers
|
|
129
|
-
npx stack deploy --staging # Deploy to staging server
|
|
130
|
-
npx stack deploy --prod # Deploy to production server
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Note:** Requires `stack.yml` (or legacy factiii.yml) to exist. Run `npx stack init` first.
|
|
134
|
-
|
|
135
|
-
### AWS EC2 Deployment (2 Commands)
|
|
136
|
-
|
|
137
|
-
Deploy your full-stack app to AWS EC2 with just two commands:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# 1. Provision all AWS infrastructure
|
|
141
|
-
npx factiii fix
|
|
142
|
-
|
|
143
|
-
# Creates: VPC, Security Groups, EC2 instance, RDS database,
|
|
144
|
-
# S3 bucket, ECR repository, IAM users, SES email
|
|
145
|
-
|
|
146
|
-
# 2. Deploy your application
|
|
147
|
-
npx factiii deploy --prod
|
|
148
|
-
|
|
149
|
-
# Configures: Docker, Nginx, SSL certificates, pulls images, starts containers
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Prerequisites:** You need an IAM user with the `factiii-bootstrap` policy configured via `aws configure`.
|
|
153
|
-
|
|
154
|
-
See [docs/aws-setup-guide.md](docs/aws-setup-guide.md) for the full step-by-step setup guide including the IAM policy JSON.
|
|
155
|
-
|
|
156
|
-
### Secrets Management
|
|
157
|
-
|
|
158
|
-
Manage secrets via Ansible Vault and deploy them directly to servers:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# List all secrets (SSH keys + environment variables)
|
|
162
|
-
npx stack deploy --secrets list
|
|
163
|
-
|
|
164
|
-
# Set SSH keys (required for deployment)
|
|
165
|
-
npx stack deploy --secrets set STAGING_SSH
|
|
166
|
-
npx stack deploy --secrets set PROD_SSH
|
|
167
|
-
|
|
168
|
-
# Set environment variables for each stage
|
|
169
|
-
npx stack deploy --secrets set-env DATABASE_URL --staging
|
|
170
|
-
npx stack deploy --secrets set-env JWT_SECRET --staging
|
|
171
|
-
npx stack deploy --secrets set-env DATABASE_URL --prod
|
|
172
|
-
npx stack deploy --secrets set-env JWT_SECRET --prod
|
|
173
|
-
|
|
174
|
-
# List environment variables
|
|
175
|
-
npx stack deploy --secrets list-env --staging
|
|
176
|
-
npx stack deploy --secrets list-env --prod
|
|
177
|
-
|
|
178
|
-
# Deploy secrets to servers via SSH
|
|
179
|
-
npx stack deploy --secrets deploy --staging # Deploy to staging server
|
|
180
|
-
npx stack deploy --secrets deploy --prod # Deploy to production server
|
|
181
|
-
npx stack deploy --secrets deploy --all # Deploy to all servers
|
|
182
|
-
|
|
183
|
-
# Options
|
|
184
|
-
npx stack deploy --secrets deploy --staging --restart # Restart container after deploy
|
|
185
|
-
npx stack deploy --secrets deploy --staging --dry-run # Show what would be deployed
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**How it works:**
|
|
189
|
-
1. Secrets are stored locally in Ansible Vault (encrypted)
|
|
190
|
-
2. When you run `secrets deploy`, Factiii:
|
|
191
|
-
- Reads the SSH key from the vault
|
|
192
|
-
- Connects to the server via SSH
|
|
193
|
-
- Writes a `.env.{stage}` file with your environment variables
|
|
194
|
-
3. Your application reads the `.env.{stage}` file on startup
|
|
195
|
-
|
|
196
|
-
**Note:** Requires `stack.yml` with Ansible Vault configured. Run `npx stack init` first.
|
|
197
|
-
|
|
198
|
-
## Stage Execution
|
|
199
|
-
|
|
200
|
-
Stack commands work with four stages: `dev`, `secrets`, `staging`, `prod`.
|
|
201
|
-
|
|
202
|
-
### Running Commands
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
npx stack scan # Scan all reachable stages
|
|
206
|
-
npx stack scan --dev # Scan only dev stage
|
|
207
|
-
npx stack scan --staging # Scan only staging stage
|
|
208
|
-
|
|
209
|
-
npx stack fix # Fix all reachable stages
|
|
210
|
-
npx stack fix --staging # Fix only staging stage
|
|
211
|
-
|
|
212
|
-
npx stack deploy --staging # Deploy to staging
|
|
213
|
-
npx stack deploy --prod # Deploy to prod
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### How Stages Are Reached
|
|
217
|
-
|
|
218
|
-
The pipeline plugin decides how to reach each stage:
|
|
219
|
-
|
|
220
|
-
| Stage | How it's reached |
|
|
221
|
-
|-------|------------------|
|
|
222
|
-
| dev | Always runs locally |
|
|
223
|
-
| secrets | Runs locally (needs Ansible Vault configured) |
|
|
224
|
-
| staging | Via workflow → SSH → runs with `--staging` |
|
|
225
|
-
| prod | Via workflow → SSH → runs with `--prod` |
|
|
226
|
-
|
|
227
|
-
### For Pipeline Plugin Authors
|
|
228
|
-
|
|
229
|
-
When your CI/CD workflow SSHs to a server to run commands, you **MUST** specify the stage:
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
# In your workflow, after SSH to staging server:
|
|
233
|
-
GITHUB_ACTIONS=true npx stack fix --staging # ✅ Correct
|
|
234
|
-
npx stack fix # ❌ Wrong - will try to run all stages
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
This prevents the command from trying to reach stages it can't access from the server.
|
|
238
|
-
|
|
239
|
-
See [STANDARDS.md](STANDARDS.md) for full documentation of the stage execution pattern.
|
|
240
|
-
|
|
241
|
-
## Plugin Architecture
|
|
242
|
-
|
|
243
|
-
### Built-in Plugins
|
|
244
|
-
|
|
245
|
-
**Pipelines**
|
|
246
|
-
- `factiii` - GitHub Actions CI/CD with thin workflows
|
|
247
|
-
- `aws` - AWS infrastructure (EC2, ECR, free-tier configs)
|
|
248
|
-
|
|
249
|
-
**Servers (OS Types)**
|
|
250
|
-
- `mac` - macOS (Homebrew, launchctl)
|
|
251
|
-
- `ubuntu` - Ubuntu Linux (apt, systemd)
|
|
252
|
-
- `windows` - Windows Server (Chocolatey) - template
|
|
253
|
-
- `amazon-linux` - Amazon Linux 2023 (dnf, systemd)
|
|
254
|
-
|
|
255
|
-
**Frameworks**
|
|
256
|
-
- `prisma-trpc` - Prisma database + tRPC API
|
|
257
|
-
|
|
258
|
-
**Addons**
|
|
259
|
-
- `server-mode` - Configure machines as deployment servers (disable sleep, enable SSH, etc.)
|
|
260
|
-
|
|
261
|
-
### How Plugins Work
|
|
262
|
-
|
|
263
|
-
Each plugin defines:
|
|
264
|
-
|
|
265
|
-
```javascript
|
|
266
|
-
class MyPlugin {
|
|
267
|
-
static id = 'my-plugin';
|
|
268
|
-
static category = 'framework'; // or: pipeline, server, addon
|
|
269
|
-
|
|
270
|
-
// Schema for factiii.yml (user-editable)
|
|
271
|
-
static configSchema = {
|
|
272
|
-
my_plugin: {
|
|
273
|
-
setting: 'default-value'
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
// Schema for factiiiAuto.yml (auto-detected)
|
|
278
|
-
static autoConfigSchema = {
|
|
279
|
-
has_my_plugin: 'boolean',
|
|
280
|
-
my_plugin_version: 'string'
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// Auto-detect configuration
|
|
284
|
-
static async detectConfig(rootDir) {
|
|
285
|
-
return {
|
|
286
|
-
has_my_plugin: true,
|
|
287
|
-
my_plugin_version: '1.0.0'
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Fixes array - issues this plugin can detect and resolve
|
|
292
|
-
static fixes = [
|
|
293
|
-
{
|
|
294
|
-
id: 'missing-config',
|
|
295
|
-
stage: 'dev',
|
|
296
|
-
severity: 'critical',
|
|
297
|
-
description: 'Configuration missing',
|
|
298
|
-
scan: async (config, rootDir) => {
|
|
299
|
-
// Return true if problem exists
|
|
300
|
-
return !config.my_plugin;
|
|
301
|
-
},
|
|
302
|
-
fix: async (config, rootDir) => {
|
|
303
|
-
// Auto-fix the problem
|
|
304
|
-
return true;
|
|
305
|
-
},
|
|
306
|
-
manualFix: 'Add my_plugin config to factiii.yml'
|
|
307
|
-
}
|
|
308
|
-
];
|
|
309
|
-
|
|
310
|
-
// Deploy method
|
|
311
|
-
async deploy(config, environment) {
|
|
312
|
-
// Handle deployment for this environment
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Thin Workflows
|
|
318
|
-
|
|
319
|
-
GitHub Actions workflows are intentionally minimal - they just SSH into servers and call the CLI:
|
|
320
|
-
|
|
321
|
-
```yaml
|
|
322
|
-
# .github/workflows/factiii-staging.yml
|
|
323
|
-
- name: Deploy via CLI
|
|
324
|
-
run: |
|
|
325
|
-
ssh user@host << EOF
|
|
326
|
-
cd ~/.factiii/my-app
|
|
327
|
-
git pull
|
|
328
|
-
GITHUB_ACTIONS=true npx stack deploy --staging
|
|
329
|
-
EOF
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
**CRITICAL: Workflows MUST specify the stage flag (`--staging` or `--prod`) when running commands on servers.**
|
|
333
|
-
|
|
334
|
-
All deployment logic runs on the server in testable JavaScript, not in workflow bash scripts.
|
|
335
|
-
|
|
336
|
-
## Secrets Configuration
|
|
337
|
-
|
|
338
|
-
Secrets are managed via Ansible Vault (see CLI commands above). Add this to `stack.yml`:
|
|
339
|
-
|
|
340
|
-
```yaml
|
|
341
|
-
ansible:
|
|
342
|
-
vault_path: group_vars/all/vault.yml
|
|
343
|
-
vault_password_file: ~/.vault_pass # or set ANSIBLE_VAULT_PASSWORD env var
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**Required secrets:** `STAGING_SSH`, `PROD_SSH`, and `AWS_SECRET_ACCESS_KEY` (if using AWS).
|
|
347
|
-
|
|
348
|
-
**CI/CD:** Add `ANSIBLE_VAULT_PASSWORD` to your GitHub repo secrets. Workflows use `npx stack deploy --secrets write-ssh-keys` to extract SSH keys for deployment.
|
|
349
|
-
|
|
350
|
-
**Security:** Never commit the vault password or decrypted vault file to git.
|
|
351
|
-
|
|
352
|
-
## Environment Variables
|
|
353
|
-
|
|
354
|
-
Plugins declare required environment variables:
|
|
355
|
-
|
|
356
|
-
```javascript
|
|
357
|
-
class MyPlugin {
|
|
358
|
-
static requiredEnvVars = ['DATABASE_URL', 'API_KEY'];
|
|
359
|
-
}
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
These are automatically validated against:
|
|
363
|
-
- `.env.example` (template, committed to git)
|
|
364
|
-
- `.env` (local dev, gitignored, auto-created from example)
|
|
365
|
-
- `.env.staging` (staging values, user creates)
|
|
366
|
-
- `.env.prod` (production values, user creates)
|
|
367
|
-
|
|
368
|
-
## AWS Configuration Bundles
|
|
369
|
-
|
|
370
|
-
The AWS plugin supports multiple configuration bundles:
|
|
371
|
-
|
|
372
|
-
```yaml
|
|
373
|
-
# factiii.yml
|
|
374
|
-
aws:
|
|
375
|
-
config: free-tier # Choose your bundle
|
|
376
|
-
region: us-east-1
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
**Available Bundles:**
|
|
380
|
-
- `ec2` - Basic EC2 instance
|
|
381
|
-
- `free-tier` - Complete free tier (EC2 + RDS + S3 + ECR)
|
|
382
|
-
- `standard` - Production-ready setup (coming soon)
|
|
383
|
-
- `enterprise` - HA, multi-AZ, auto-scaling (coming soon)
|
|
384
|
-
|
|
385
|
-
## External Plugins
|
|
386
|
-
|
|
387
|
-
Install external plugins via npm:
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
npm install @factiii/stack-plugin-nextjs
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
Factiii automatically loads plugins from `node_modules` that match:
|
|
394
|
-
- `@factiii/stack-plugin-*`
|
|
395
|
-
- Listed in `factiii.yml` under `plugins`
|
|
396
|
-
|
|
397
|
-
## Development
|
|
398
|
-
|
|
399
|
-
See [STANDARDS.md](STANDARDS.md) for plugin development guide.
|
|
400
|
-
|
|
401
|
-
## License
|
|
402
|
-
|
|
403
|
-
MIT
|
|
1
|
+
# @factiii/stack
|
|
2
|
+
|
|
3
|
+
Infrastructure management CLI. Scan, fix, and deploy Node.js apps to AWS with Docker, Nginx, and GitHub Actions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @factiii/stack
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx stack # Self-bootstrap + scan
|
|
15
|
+
npx stack init # First-time vault/secrets setup
|
|
16
|
+
npx stack scan --dev # Read-only issue detection
|
|
17
|
+
npx stack fix --dev # Auto-fix detected issues
|
|
18
|
+
npx stack deploy --staging # Scan then deploy
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
| Command | Description |
|
|
24
|
+
|---------|-------------|
|
|
25
|
+
| `npx stack` | Self-bootstrap + scan (default) |
|
|
26
|
+
| `npx stack init` | First-time vault/secrets setup |
|
|
27
|
+
| `npx stack scan [--stage]` | Read-only issue detection |
|
|
28
|
+
| `npx stack fix [--stage]` | Auto-fix detected issues |
|
|
29
|
+
| `npx stack deploy --<stage>` | Scan then deploy |
|
|
30
|
+
| `npx stack deploy --secrets <action>` | Manage Ansible Vault secrets |
|
|
31
|
+
| `npx stack db <cmd> --<stage>` | Database operations (migrate, seed, reset, status) |
|
|
32
|
+
| `npx stack ops <cmd> --<stage>` | Server operations (logs, restart, shell, status) |
|
|
33
|
+
| `npx stack backup <cmd> --<stage>` | Database backup/restore |
|
|
34
|
+
| `npx stack dev-reset [--dry-run]` | Reset local config/secrets for fresh bootstrap |
|
|
35
|
+
|
|
36
|
+
## Stages
|
|
37
|
+
|
|
38
|
+
`--dev`, `--secrets`, `--staging`, `--prod`
|
|
39
|
+
|
|
40
|
+
Routing priority:
|
|
41
|
+
1. `dev` / `secrets` → always runs locally
|
|
42
|
+
2. `staging` / `prod` → tries SSH key (`~/.ssh/{stage}_deploy_key`) → falls back to GitHub Actions workflow → unreachable
|
|
43
|
+
|
|
44
|
+
## Config Files
|
|
45
|
+
|
|
46
|
+
| File | Purpose | Editable By |
|
|
47
|
+
|------|---------|-------------|
|
|
48
|
+
| `stack.yml` | Manual settings (committed) | User |
|
|
49
|
+
| `stackAuto.yml` | Auto-detected settings | Stack CLI |
|
|
50
|
+
| `stack.local.yml` | Per-developer overrides (gitignored) | User |
|
|
51
|
+
|
|
52
|
+
Legacy `factiii.yml` is also supported.
|
|
53
|
+
|
|
54
|
+
## Plugins
|
|
55
|
+
|
|
56
|
+
**Pipelines** — CI/CD routing: `factiii`, `aws`
|
|
57
|
+
|
|
58
|
+
**Servers** — OS-specific commands: `mac`, `ubuntu`, `windows`, `amazon-linux`
|
|
59
|
+
|
|
60
|
+
**Frameworks** — App scaffolding: `prisma-trpc`, `expo`
|
|
61
|
+
|
|
62
|
+
**Addons** — Extensions: `server-mode` (hardening), `openclaw` (AI agent), `auth` (@factiii/auth integration)
|
|
63
|
+
|
|
64
|
+
Plugins auto-detect from your project. No manual registration needed.
|
|
65
|
+
|
|
66
|
+
## AWS Strategy
|
|
67
|
+
|
|
68
|
+
Two IAM users per project:
|
|
69
|
+
- **Dev account** (dev + staging): `factiii-{project}-dev`
|
|
70
|
+
- **Prod account** (prod only): `factiii-{project}-prod`
|
|
71
|
+
|
|
72
|
+
Provisioning covers EC2, RDS, VPC, ECR, Route 53, and S3.
|
|
73
|
+
|
|
74
|
+
## Deployment Flow
|
|
75
|
+
|
|
76
|
+
1. `npx stack` — bootstrap (installs deps, detects frameworks, generates config)
|
|
77
|
+
2. `npx stack init` — create vault, store secrets
|
|
78
|
+
3. `npx stack fix --staging` — provision infrastructure, push workflows
|
|
79
|
+
4. `npx stack deploy --staging` — scan, build, deploy via SSH or GitHub Actions
|
|
80
|
+
|
|
81
|
+
Workflows are ultra-thin: trigger + secrets + SSH + CLI call. No setup/clone/build logic in CI.
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
ssh -i ~/.ssh/deploy_key "$USER@$HOST" \
|
|
85
|
+
"GITHUB_ACTIONS=true npx stack deploy --staging"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
- Node.js >= 18.0.0
|
|
91
|
+
- pnpm, npm, or yarn
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|