nvoi 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/.claude/todo/refactor/12-cli-db-command.md +128 -0
- data/.claude/todo/refactor-execution/00-entrypoint.md +49 -0
- data/.claude/todo/refactor-execution/01-objects.md +42 -0
- data/.claude/todo/refactor-execution/02-utils.md +41 -0
- data/.claude/todo/refactor-execution/03-external-cloud.md +38 -0
- data/.claude/todo/refactor-execution/04-external-dns.md +35 -0
- data/.claude/todo/refactor-execution/05-external-other.md +46 -0
- data/.claude/todo/refactor-execution/06-cli-deploy.md +45 -0
- data/.claude/todo/refactor-execution/07-cli-delete.md +43 -0
- data/.claude/todo/refactor-execution/08-cli-exec.md +30 -0
- data/.claude/todo/refactor-execution/09-cli-credentials.md +34 -0
- data/.claude/todo/refactor-execution/10-cli-db.md +31 -0
- data/.claude/todo/refactor-execution/11-cli-router.md +44 -0
- data/.claude/todo/refactor-execution/12-cleanup.md +120 -0
- data/.claude/todo/refactor-execution/_monitoring-strategy.md +126 -0
- data/.claude/todos.md +550 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +35 -4
- data/Rakefile +1 -1
- data/ingest +0 -0
- data/lib/nvoi/cli/config/command.rb +219 -0
- data/lib/nvoi/cli/delete/steps/teardown_dns.rb +12 -11
- data/lib/nvoi/cli/deploy/steps/configure_tunnel.rb +15 -13
- data/lib/nvoi/cli/deploy/steps/deploy_service.rb +5 -2
- data/lib/nvoi/cli/deploy/steps/setup_k3s.rb +10 -1
- data/lib/nvoi/cli/logs/command.rb +66 -0
- data/lib/nvoi/cli/onboard/command.rb +761 -0
- data/lib/nvoi/cli/unlock/command.rb +72 -0
- data/lib/nvoi/cli.rb +257 -0
- data/lib/nvoi/config_api/actions/app.rb +30 -30
- data/lib/nvoi/config_api/actions/compute_provider.rb +31 -31
- data/lib/nvoi/config_api/actions/database.rb +42 -42
- data/lib/nvoi/config_api/actions/domain_provider.rb +40 -0
- data/lib/nvoi/config_api/actions/env.rb +12 -12
- data/lib/nvoi/config_api/actions/init.rb +67 -0
- data/lib/nvoi/config_api/actions/secret.rb +12 -12
- data/lib/nvoi/config_api/actions/server.rb +35 -35
- data/lib/nvoi/config_api/actions/service.rb +52 -0
- data/lib/nvoi/config_api/actions/volume.rb +18 -18
- data/lib/nvoi/config_api/base.rb +15 -21
- data/lib/nvoi/config_api/result.rb +5 -5
- data/lib/nvoi/config_api.rb +51 -28
- data/lib/nvoi/external/cloud/aws.rb +26 -1
- data/lib/nvoi/external/cloud/hetzner.rb +27 -1
- data/lib/nvoi/external/cloud/scaleway.rb +32 -6
- data/lib/nvoi/external/containerd.rb +4 -0
- data/lib/nvoi/external/dns/cloudflare.rb +34 -16
- data/lib/nvoi/objects/configuration.rb +20 -0
- data/lib/nvoi/utils/namer.rb +9 -0
- data/lib/nvoi/utils/retry.rb +1 -1
- data/lib/nvoi/version.rb +1 -1
- data/lib/nvoi.rb +16 -0
- data/templates/app-ingress.yaml.erb +3 -1
- metadata +25 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91c0d6ae24cfc163dd6c00008e5199cfdca4b9864ed6c2b56644b58b90d04ca6
|
|
4
|
+
data.tar.gz: 319109891843c14ae0dfe4c66553bdf06a5bf5a1d009855f97f0c6ffc17bccc6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34b0c1e73b479bb2e10356b27f397a7c34dc9476bd7244490450163736fc7106bd28143ec91bfba1aa27a16c5b1f15d722cfd09d98d7a4155ce7dd752ff30949
|
|
7
|
+
data.tar.gz: 9706c433e608299ac10f71ff257a9d73a0e4f97bab126d3b99d0050474c426dde79fb793204dc55d9369b0654bfba162621106c34d3791fb4e9fb7fed651d8e2
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# 12 - CLI: Database Commands
|
|
2
|
+
|
|
3
|
+
## Priority: FIFTH (parallel with others)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Current State (NEW from main)
|
|
8
|
+
|
|
9
|
+
| File | Lines | Purpose |
|
|
10
|
+
|------|-------|---------|
|
|
11
|
+
| `service/db.rb` | 285 | DbService - database branch operations |
|
|
12
|
+
| `database/provider.rb` | 160 | Base provider + factory + structs |
|
|
13
|
+
| `database/postgres.rb` | ~100 | Postgres dump/restore |
|
|
14
|
+
| `database/mysql.rb` | ~100 | MySQL dump/restore |
|
|
15
|
+
| `database/sqlite.rb` | ~80 | SQLite dump/restore |
|
|
16
|
+
|
|
17
|
+
**Total: ~725 lines**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What It Does
|
|
22
|
+
|
|
23
|
+
Database "branching" = snapshots for backup/restore:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
nvoi db branch create [name] # Dump current DB to file
|
|
27
|
+
nvoi db branch list # List saved branches
|
|
28
|
+
nvoi db branch restore <id> # Restore branch to new DB
|
|
29
|
+
nvoi db branch download <id> # Download dump locally
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Target Structure
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
lib/nvoi/cli/db/
|
|
38
|
+
├── command.rb # Router for subcommands
|
|
39
|
+
├── branch/
|
|
40
|
+
│ ├── create/
|
|
41
|
+
│ │ └── command.rb
|
|
42
|
+
│ ├── list/
|
|
43
|
+
│ │ └── command.rb
|
|
44
|
+
│ ├── restore/
|
|
45
|
+
│ │ └── command.rb
|
|
46
|
+
│ └── download/
|
|
47
|
+
│ └── command.rb
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
OR simpler (single file since operations are small):
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
lib/nvoi/cli/db/
|
|
54
|
+
└── command.rb # All branch operations
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Database Module → External
|
|
60
|
+
|
|
61
|
+
The `database/` providers are external adapters (talk to DBs via kubectl exec):
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
lib/nvoi/external/database/
|
|
65
|
+
├── provider.rb # Base + factory
|
|
66
|
+
├── postgres.rb
|
|
67
|
+
├── mysql.rb
|
|
68
|
+
└── sqlite.rb
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Note:** These use `kubectl exec` to run dump/restore commands in pods. They're external adapters like cloud providers.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Objects to Extract
|
|
76
|
+
|
|
77
|
+
From `database/provider.rb`:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
# objects/database.rb
|
|
81
|
+
Credentials = Struct.new(:user, :password, :host, :port, :database, :path, keyword_init: true)
|
|
82
|
+
DumpOptions = Struct.new(:pod_name, :database, :user, :password, :host_path, keyword_init: true)
|
|
83
|
+
RestoreOptions = Struct.new(:pod_name, :database, :user, :password, :source_db, :host_path, keyword_init: true)
|
|
84
|
+
CreateOptions = Struct.new(:pod_name, :database, :user, :password, keyword_init: true)
|
|
85
|
+
Branch = Struct.new(:id, :created_at, :size, :adapter, :database, keyword_init: true)
|
|
86
|
+
BranchMetadata # class with branches array
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## DRY Opportunities
|
|
92
|
+
|
|
93
|
+
### 1. SSH Helper Pattern
|
|
94
|
+
`DbService#with_ssh` creates SSH executor. Same pattern in other services.
|
|
95
|
+
Extract to base or mixin:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# In command base or utils
|
|
99
|
+
def with_master_ssh(config, provider)
|
|
100
|
+
server_ip = get_master_server_ip(config, provider)
|
|
101
|
+
ssh = External::SSH.new(server_ip, config.ssh_key_path)
|
|
102
|
+
yield ssh
|
|
103
|
+
end
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 2. Database Credentials Resolution
|
|
107
|
+
`Config::DatabaseHelper.get_credentials` is called from multiple places.
|
|
108
|
+
Keep in config or move to database provider factory.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Migration Steps
|
|
113
|
+
|
|
114
|
+
1. Create `lib/nvoi/external/database/` directory
|
|
115
|
+
2. Move `database/*.rb` → `external/database/`
|
|
116
|
+
3. Extract Structs to `objects/database.rb`
|
|
117
|
+
4. Create `lib/nvoi/cli/db/command.rb`
|
|
118
|
+
5. Move logic from `service/db.rb` → `cli/db/command.rb`
|
|
119
|
+
6. Delete `service/db.rb`
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Estimated Effort
|
|
124
|
+
|
|
125
|
+
- **Lines to reorganize:** ~725
|
|
126
|
+
- **Files created:** 5 (1 command + 4 external/database)
|
|
127
|
+
- **Files deleted/moved:** 5
|
|
128
|
+
- **Net change:** minimal (reorganization)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Refactor Execution Entrypoint
|
|
2
|
+
|
|
3
|
+
## Strategy
|
|
4
|
+
|
|
5
|
+
**Clean slate rebuild.** Not migration.
|
|
6
|
+
|
|
7
|
+
- **Reference codebase:** `/Users/ben/Desktop/nvoi-rb/` (working code, read-only)
|
|
8
|
+
- **Worktree:** `/Users/ben/Desktop/nvoi-rb-refactor/` (clean slate, write here)
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Clear worktree lib/nvoi/ (keep exe/, test/, templates/, etc.)
|
|
14
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
15
|
+
rm -rf lib/nvoi
|
|
16
|
+
mkdir lib/nvoi
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Execution Order
|
|
20
|
+
|
|
21
|
+
Each phase: **build → validate → test → commit**
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Phase 1: 01-objects.md → Build objects/ from scratch
|
|
25
|
+
Phase 2: 02-utils.md → Build utils/ from scratch
|
|
26
|
+
Phase 3: 03-external-cloud.md → Build external/cloud/
|
|
27
|
+
Phase 4: 04-external-dns.md → Build external/dns/
|
|
28
|
+
Phase 5: 05-external-other.md → Build external/ssh, kubectl, containerd, database
|
|
29
|
+
Phase 6: 06-cli-deploy.md → Build cli/deploy/
|
|
30
|
+
Phase 7: 07-cli-delete.md → Build cli/delete/
|
|
31
|
+
Phase 8: 08-cli-exec.md → Build cli/exec/
|
|
32
|
+
Phase 9: 09-cli-credentials.md → Build cli/credentials/
|
|
33
|
+
Phase 10: 10-cli-db.md → Build cli/db/
|
|
34
|
+
Phase 11: 11-cli-router.md → Build cli.rb
|
|
35
|
+
Phase 12: 12-cleanup.md → Final wiring, lib/nvoi.rb, version.rb
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Per-Phase Protocol
|
|
39
|
+
|
|
40
|
+
1. **Build** - Create new files reading from reference
|
|
41
|
+
2. **Validate** - User reviews structure
|
|
42
|
+
3. **Test** - `bundle exec rake test`
|
|
43
|
+
4. **Commit** - Only after tests pass
|
|
44
|
+
|
|
45
|
+
## Current Step
|
|
46
|
+
|
|
47
|
+
**NOT STARTED**
|
|
48
|
+
|
|
49
|
+
Next: Clear worktree, then `01-objects.md`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 01 - Objects Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/objects/` with:
|
|
9
|
+
|
|
10
|
+
| File | Content (from reference) |
|
|
11
|
+
|------|--------------------------|
|
|
12
|
+
| `server.rb` | `Server`, `ServerCreateOptions` from `providers/base.rb` |
|
|
13
|
+
| `network.rb` | `Network` from `providers/base.rb` |
|
|
14
|
+
| `firewall.rb` | `Firewall` from `providers/base.rb` |
|
|
15
|
+
| `volume.rb` | `Volume`, `VolumeCreateOptions` from `providers/base.rb`, `MountOptions` from `remote/volume_manager.rb` |
|
|
16
|
+
| `tunnel.rb` | `Tunnel` from `cloudflare/client.rb`, `TunnelInfo` from `deployer/types.rb` |
|
|
17
|
+
| `dns.rb` | `Zone`, `DNSRecord` from `cloudflare/client.rb` |
|
|
18
|
+
| `database.rb` | `DatabaseCredentials`, `DumpOptions`, `RestoreOptions`, `CreateOptions`, `Branch`, `BranchMetadata` from `database/provider.rb` |
|
|
19
|
+
| `service_spec.rb` | `ServiceSpec` from `config/types.rb` |
|
|
20
|
+
|
|
21
|
+
All under `Nvoi::Objects` namespace.
|
|
22
|
+
|
|
23
|
+
## Validate
|
|
24
|
+
|
|
25
|
+
- [ ] `ls lib/nvoi/objects/` shows 8 files
|
|
26
|
+
- [ ] Each file has `module Nvoi::Objects`
|
|
27
|
+
- [ ] Structs match reference
|
|
28
|
+
|
|
29
|
+
## Test
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
33
|
+
ruby -e "require './lib/nvoi/objects/server'; p Nvoi::Objects::Server.new(id: '1', name: 'test', status: 'running', public_ipv4: '1.2.3.4')"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
(Full test suite runs after all phases complete)
|
|
37
|
+
|
|
38
|
+
## Commit
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git add -A && git commit -m "Phase 1: Build objects/"
|
|
42
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 02 - Utils Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/utils/` with:
|
|
9
|
+
|
|
10
|
+
| File | Content (from reference) |
|
|
11
|
+
|------|--------------------------|
|
|
12
|
+
| `logger.rb` | From `logger.rb` |
|
|
13
|
+
| `constants.rb` | From `constants.rb` |
|
|
14
|
+
| `errors.rb` | From `errors.rb` |
|
|
15
|
+
| `namer.rb` | From `config/naming.rb` + add `hostname(subdomain, domain)` |
|
|
16
|
+
| `env_resolver.rb` | From `config/env_resolver.rb` |
|
|
17
|
+
| `config_loader.rb` | Merge `config/loader.rb` + `config/ssh_keys.rb` |
|
|
18
|
+
| `crypto.rb` | Merge `credentials/crypto.rb` + `credentials/manager.rb` |
|
|
19
|
+
| `templates.rb` | Merge `k8s/templates.rb` + `k8s/renderer.rb` |
|
|
20
|
+
| `retry.rb` | From `deployer/retry.rb` |
|
|
21
|
+
|
|
22
|
+
All under `Nvoi::Utils` namespace.
|
|
23
|
+
|
|
24
|
+
## Validate
|
|
25
|
+
|
|
26
|
+
- [ ] `ls lib/nvoi/utils/` shows 9 files
|
|
27
|
+
- [ ] Each file has `module Nvoi::Utils`
|
|
28
|
+
- [ ] `hostname` method added to namer
|
|
29
|
+
|
|
30
|
+
## Test
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
34
|
+
ruby -e "require './lib/nvoi/utils/logger'; Nvoi::Utils::Logger.new.info('test')"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Commit
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git add -A && git commit -m "Phase 2: Build utils/"
|
|
41
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# 03 - External Cloud Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/external/cloud/` with:
|
|
9
|
+
|
|
10
|
+
| File | Content (from reference) |
|
|
11
|
+
|------|--------------------------|
|
|
12
|
+
| `base.rb` | From `providers/base.rb` (interface only, no Structs) |
|
|
13
|
+
| `hetzner.rb` | Merge `providers/hetzner.rb` + `providers/hetzner_client.rb` |
|
|
14
|
+
| `aws.rb` | From `providers/aws.rb` |
|
|
15
|
+
| `scaleway.rb` | Merge `providers/scaleway.rb` + `providers/scaleway_client.rb` |
|
|
16
|
+
| `factory.rb` | From `service/provider.rb` (ProviderHelper → `External::Cloud.for(config)`) |
|
|
17
|
+
|
|
18
|
+
All under `Nvoi::External::Cloud` namespace.
|
|
19
|
+
Use `Objects::Server`, `Objects::Network`, etc.
|
|
20
|
+
|
|
21
|
+
## Validate
|
|
22
|
+
|
|
23
|
+
- [ ] `ls lib/nvoi/external/cloud/` shows 5 files
|
|
24
|
+
- [ ] `base.rb` has no Struct definitions
|
|
25
|
+
- [ ] Each provider uses `Objects::` for return types
|
|
26
|
+
|
|
27
|
+
## Test
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
31
|
+
ruby -e "require './lib/nvoi/objects/server'; require './lib/nvoi/external/cloud/base'; p Nvoi::External::Cloud::Base"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Commit
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git add -A && git commit -m "Phase 3: Build external/cloud/"
|
|
38
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 04 - External DNS Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/external/dns/` with:
|
|
9
|
+
|
|
10
|
+
| File | Content (from reference) |
|
|
11
|
+
|------|--------------------------|
|
|
12
|
+
| `cloudflare.rb` | Merge `cloudflare/client.rb` + `deployer/tunnel_manager.rb` (no Structs) |
|
|
13
|
+
|
|
14
|
+
Under `Nvoi::External::DNS` namespace.
|
|
15
|
+
Use `Objects::Tunnel`, `Objects::Zone`, `Objects::DNSRecord`, `Objects::TunnelInfo`.
|
|
16
|
+
Add `setup_tunnel` method from TunnelManager.
|
|
17
|
+
|
|
18
|
+
## Validate
|
|
19
|
+
|
|
20
|
+
- [ ] `ls lib/nvoi/external/dns/` shows 1 file
|
|
21
|
+
- [ ] No Struct definitions in file
|
|
22
|
+
- [ ] `setup_tunnel` method exists
|
|
23
|
+
|
|
24
|
+
## Test
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
28
|
+
ruby -e "require './lib/nvoi/objects/tunnel'; require './lib/nvoi/objects/dns'; require './lib/nvoi/external/dns/cloudflare'; p Nvoi::External::DNS::Cloudflare"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commit
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git add -A && git commit -m "Phase 4: Build external/dns/"
|
|
35
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 05 - External Other Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create in `lib/nvoi/external/`:
|
|
9
|
+
|
|
10
|
+
| File | Content (from reference) |
|
|
11
|
+
|------|--------------------------|
|
|
12
|
+
| `ssh.rb` | From `remote/ssh_executor.rb` |
|
|
13
|
+
| `kubectl.rb` | Extract kubectl ops from `k8s/renderer.rb` |
|
|
14
|
+
| `containerd.rb` | From `remote/docker_manager.rb` (rename class) |
|
|
15
|
+
| `volume_manager.rb` | From `remote/volume_manager.rb` (no MountOptions Struct) |
|
|
16
|
+
|
|
17
|
+
Create `lib/nvoi/external/database/`:
|
|
18
|
+
|
|
19
|
+
| File | Content (from reference) |
|
|
20
|
+
|------|--------------------------|
|
|
21
|
+
| `provider.rb` | From `database/provider.rb` (no Structs, use `Objects::`) |
|
|
22
|
+
| `postgres.rb` | From `database/postgres.rb` |
|
|
23
|
+
| `mysql.rb` | From `database/mysql.rb` |
|
|
24
|
+
| `sqlite.rb` | From `database/sqlite.rb` |
|
|
25
|
+
|
|
26
|
+
Under `Nvoi::External` namespace.
|
|
27
|
+
Use `Objects::MountOptions`, `Objects::DatabaseCredentials`, etc.
|
|
28
|
+
|
|
29
|
+
## Validate
|
|
30
|
+
|
|
31
|
+
- [ ] `ls lib/nvoi/external/` shows ssh.rb, kubectl.rb, containerd.rb, volume_manager.rb
|
|
32
|
+
- [ ] `ls lib/nvoi/external/database/` shows 4 files
|
|
33
|
+
- [ ] No Struct definitions in any file
|
|
34
|
+
|
|
35
|
+
## Test
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
39
|
+
ruby -e "require './lib/nvoi/external/ssh'; p Nvoi::External::SSH"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commit
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git add -A && git commit -m "Phase 5: Build external/ssh, kubectl, containerd, database"
|
|
46
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 06 - CLI Deploy Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli/deploy/command.rb`:
|
|
9
|
+
- Orchestrator from `service/deploy.rb`
|
|
10
|
+
- Uses `External::`, `Utils::`, `Objects::`
|
|
11
|
+
|
|
12
|
+
Create `lib/nvoi/cli/deploy/steps/`:
|
|
13
|
+
|
|
14
|
+
| File | Content (from reference) |
|
|
15
|
+
|------|--------------------------|
|
|
16
|
+
| `provision_network.rb` | From `deployer/infrastructure.rb` (network + firewall) |
|
|
17
|
+
| `provision_server.rb` | From `steps/server_provisioner.rb` |
|
|
18
|
+
| `provision_volume.rb` | From `steps/volume_provisioner.rb` |
|
|
19
|
+
| `setup_k3s.rb` | Merge `steps/k3s_provisioner.rb` + `steps/k3s_cluster_setup.rb` |
|
|
20
|
+
| `configure_tunnel.rb` | From `steps/tunnel_configurator.rb` |
|
|
21
|
+
| `build_image.rb` | From `deployer/image_builder.rb` |
|
|
22
|
+
| `deploy_database.rb` | From `steps/database_provisioner.rb` |
|
|
23
|
+
| `deploy_service.rb` | Merge `deployer/orchestrator.rb` + `deployer/service_deployer.rb` |
|
|
24
|
+
| `cleanup_images.rb` | From `deployer/cleaner.rb` |
|
|
25
|
+
|
|
26
|
+
Under `Nvoi::CLI::Deploy` namespace.
|
|
27
|
+
|
|
28
|
+
## Validate
|
|
29
|
+
|
|
30
|
+
- [ ] `ls lib/nvoi/cli/deploy/` shows command.rb + steps/
|
|
31
|
+
- [ ] `ls lib/nvoi/cli/deploy/steps/` shows 9 files
|
|
32
|
+
- [ ] command.rb orchestrates steps in correct order
|
|
33
|
+
|
|
34
|
+
## Test
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
38
|
+
ruby -e "require './lib/nvoi/cli/deploy/command'; p Nvoi::CLI::Deploy::Command"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Commit
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git add -A && git commit -m "Phase 6: Build cli/deploy/"
|
|
45
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 07 - CLI Delete Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli/delete/command.rb`:
|
|
9
|
+
- Orchestrator from `service/delete.rb`
|
|
10
|
+
- Uses `External::`, `Utils::`, `Objects::`
|
|
11
|
+
|
|
12
|
+
Create `lib/nvoi/cli/delete/steps/`:
|
|
13
|
+
|
|
14
|
+
| File | Content (from reference) |
|
|
15
|
+
|------|--------------------------|
|
|
16
|
+
| `detach_volumes.rb` | Extract from `service/delete.rb` |
|
|
17
|
+
| `teardown_server.rb` | Extract from `service/delete.rb` |
|
|
18
|
+
| `teardown_volume.rb` | Extract from `service/delete.rb` |
|
|
19
|
+
| `teardown_firewall.rb` | Extract from `service/delete.rb` |
|
|
20
|
+
| `teardown_network.rb` | Extract from `service/delete.rb` |
|
|
21
|
+
| `teardown_tunnel.rb` | Extract from `service/delete.rb` |
|
|
22
|
+
| `teardown_dns.rb` | Extract from `service/delete.rb` |
|
|
23
|
+
|
|
24
|
+
Under `Nvoi::CLI::Delete` namespace.
|
|
25
|
+
|
|
26
|
+
## Validate
|
|
27
|
+
|
|
28
|
+
- [ ] `ls lib/nvoi/cli/delete/` shows command.rb + steps/
|
|
29
|
+
- [ ] `ls lib/nvoi/cli/delete/steps/` shows 7 files
|
|
30
|
+
- [ ] Teardown order correct: detach → servers → volumes → firewall → network → tunnel → dns
|
|
31
|
+
|
|
32
|
+
## Test
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
36
|
+
ruby -e "require './lib/nvoi/cli/delete/command'; p Nvoi::CLI::Delete::Command"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Commit
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git add -A && git commit -m "Phase 7: Build cli/delete/"
|
|
43
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 08 - CLI Exec Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli/exec/command.rb`:
|
|
9
|
+
- From `service/exec.rb`
|
|
10
|
+
- Uses `External::SSH`, `Utils::`
|
|
11
|
+
|
|
12
|
+
Under `Nvoi::CLI::Exec` namespace.
|
|
13
|
+
|
|
14
|
+
## Validate
|
|
15
|
+
|
|
16
|
+
- [ ] `ls lib/nvoi/cli/exec/` shows command.rb
|
|
17
|
+
- [ ] Supports: single server, `--all`, `-i` interactive
|
|
18
|
+
|
|
19
|
+
## Test
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
23
|
+
ruby -e "require './lib/nvoi/cli/exec/command'; p Nvoi::CLI::Exec::Command"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commit
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git add -A && git commit -m "Phase 8: Build cli/exec/"
|
|
30
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 09 - CLI Credentials Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli/credentials/edit/command.rb`:
|
|
9
|
+
- Edit logic from `credentials/editor.rb`
|
|
10
|
+
- Uses `Utils::Crypto`
|
|
11
|
+
|
|
12
|
+
Create `lib/nvoi/cli/credentials/show/command.rb`:
|
|
13
|
+
- Show logic from `credentials/editor.rb`
|
|
14
|
+
- Uses `Utils::Crypto`
|
|
15
|
+
|
|
16
|
+
Under `Nvoi::CLI::Credentials` namespace.
|
|
17
|
+
|
|
18
|
+
## Validate
|
|
19
|
+
|
|
20
|
+
- [ ] `ls lib/nvoi/cli/credentials/edit/` shows command.rb
|
|
21
|
+
- [ ] `ls lib/nvoi/cli/credentials/show/` shows command.rb
|
|
22
|
+
|
|
23
|
+
## Test
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
27
|
+
ruby -e "require './lib/nvoi/cli/credentials/edit/command'; p Nvoi::CLI::Credentials::Edit::Command"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Commit
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git add -A && git commit -m "Phase 9: Build cli/credentials/"
|
|
34
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 10 - CLI Database Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli/db/command.rb`:
|
|
9
|
+
- From `service/db.rb`
|
|
10
|
+
- Uses `External::Database::`, `External::SSH`, `Utils::`
|
|
11
|
+
- Methods: `branch_create`, `branch_list`, `branch_restore`, `branch_download`
|
|
12
|
+
|
|
13
|
+
Under `Nvoi::CLI::Db` namespace.
|
|
14
|
+
|
|
15
|
+
## Validate
|
|
16
|
+
|
|
17
|
+
- [ ] `ls lib/nvoi/cli/db/` shows command.rb
|
|
18
|
+
- [ ] All branch methods present
|
|
19
|
+
|
|
20
|
+
## Test
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
24
|
+
ruby -e "require './lib/nvoi/cli/db/command'; p Nvoi::CLI::Db::Command"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commit
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git add -A && git commit -m "Phase 10: Build cli/db/"
|
|
31
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 11 - CLI Router Execution
|
|
2
|
+
|
|
3
|
+
## Reference
|
|
4
|
+
Read from: `/Users/ben/Desktop/nvoi-rb/lib/nvoi/`
|
|
5
|
+
|
|
6
|
+
## Build
|
|
7
|
+
|
|
8
|
+
Create `lib/nvoi/cli.rb`:
|
|
9
|
+
- Thor routing only (~50-80 lines)
|
|
10
|
+
- Lazy requires for each command
|
|
11
|
+
- Delegates to `CLI::Deploy::Command`, `CLI::Delete::Command`, etc.
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
# Structure
|
|
15
|
+
module Nvoi
|
|
16
|
+
class CLI < Thor
|
|
17
|
+
desc "deploy", "Deploy application"
|
|
18
|
+
def deploy
|
|
19
|
+
require_relative "cli/deploy/command"
|
|
20
|
+
CLI::Deploy::Command.new(options).run
|
|
21
|
+
end
|
|
22
|
+
# ... etc
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Validate
|
|
28
|
+
|
|
29
|
+
- [ ] `wc -l lib/nvoi/cli.rb` < 100 lines
|
|
30
|
+
- [ ] No business logic in cli.rb
|
|
31
|
+
- [ ] All commands delegate to `cli/*/command.rb`
|
|
32
|
+
|
|
33
|
+
## Test
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd /Users/ben/Desktop/nvoi-rb-refactor
|
|
37
|
+
ruby -e "require './lib/nvoi/cli'; p Nvoi::CLI"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Commit
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git add -A && git commit -m "Phase 11: Build cli.rb router"
|
|
44
|
+
```
|