learnhouse 1.5.1 → 1.7.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/README.md +43 -27
- package/dist/bin/learnhouse.js +4145 -3005
- package/package.json +19 -16
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# LearnHouse CLI
|
|
2
2
|
|
|
3
|
-
The official [LearnHouse](https://learnhouse.app) CLI
|
|
3
|
+
The official [LearnHouse](https://learnhouse.app) CLI for deploying, managing, and operating your LearnHouse instance.
|
|
4
4
|
|
|
5
5
|
[Website](https://learnhouse.app) | [Documentation](https://docs.learnhouse.app) | [GitHub](https://github.com/learnhouse/learnhouse)
|
|
6
6
|
|
|
@@ -31,13 +31,13 @@ npx learnhouse@latest setup
|
|
|
31
31
|
### Install a specific version
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npx learnhouse@1.
|
|
34
|
+
npx learnhouse@1.7.0 setup
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## Requirements
|
|
38
38
|
|
|
39
|
-
- **Node.js** >=
|
|
40
|
-
- **Docker**
|
|
39
|
+
- **Node.js** >= 22
|
|
40
|
+
- **Docker** with the Compose v2 plugin (`docker compose`)
|
|
41
41
|
|
|
42
42
|
## Commands
|
|
43
43
|
|
|
@@ -45,16 +45,17 @@ npx learnhouse@1.0.0 setup
|
|
|
45
45
|
|---------|-------------|
|
|
46
46
|
| `learnhouse setup` | Interactive setup wizard |
|
|
47
47
|
| `learnhouse start` | Start all services |
|
|
48
|
-
| `learnhouse stop` | Stop all services |
|
|
48
|
+
| `learnhouse stop` | Stop all services (containers are kept) |
|
|
49
49
|
| `learnhouse update` | Update to the latest version |
|
|
50
|
-
| `learnhouse update --
|
|
50
|
+
| `learnhouse update --to <x.y.z>` | Update to a specific version |
|
|
51
51
|
| `learnhouse logs` | Stream service logs |
|
|
52
52
|
| `learnhouse config` | Show current configuration |
|
|
53
53
|
| `learnhouse status` | Show service status |
|
|
54
54
|
| `learnhouse health` | Run health checks |
|
|
55
|
-
| `learnhouse backup` |
|
|
56
|
-
| `learnhouse restore <archive>` | Restore
|
|
55
|
+
| `learnhouse backup` | Back up the database, `.env` and uploaded content |
|
|
56
|
+
| `learnhouse restore <archive>` | Restore a backup (or a `.sql.gz` dump written by `update`) |
|
|
57
57
|
| `learnhouse deployments` | View deployments and set resource limits |
|
|
58
|
+
| `learnhouse scale` | Set memory limits per service |
|
|
58
59
|
| `learnhouse doctor` | Diagnose common issues |
|
|
59
60
|
| `learnhouse shell` | Open a shell in a running container |
|
|
60
61
|
| `learnhouse env` | Edit environment variables |
|
|
@@ -64,12 +65,12 @@ npx learnhouse@1.0.0 setup
|
|
|
64
65
|
|
|
65
66
|
The setup wizard walks through:
|
|
66
67
|
|
|
67
|
-
1. **
|
|
68
|
-
2. **Domain
|
|
69
|
-
3. **Database & Redis
|
|
70
|
-
4. **Organization
|
|
71
|
-
5. **Admin account
|
|
72
|
-
6. **Features
|
|
68
|
+
1. **Installation name**: files go in `~/.learnhouse/<name>`
|
|
69
|
+
2. **Domain**: hostname, port, HTTPS/SSL
|
|
70
|
+
3. **Database & Redis**: local (Docker) or external
|
|
71
|
+
4. **Organization**: name for your instance
|
|
72
|
+
5. **Admin account**: email and password
|
|
73
|
+
6. **Features**: AI, email, S3, OAuth
|
|
73
74
|
|
|
74
75
|
You can go back to any step, and edit from the summary before confirming.
|
|
75
76
|
|
|
@@ -83,10 +84,18 @@ npx learnhouse backup
|
|
|
83
84
|
npx learnhouse update
|
|
84
85
|
|
|
85
86
|
# Or a specific version
|
|
86
|
-
npx learnhouse update --
|
|
87
|
+
npx learnhouse update --to 1.2.0
|
|
87
88
|
```
|
|
88
89
|
|
|
89
|
-
The update command pulls the new image, restarts services
|
|
90
|
+
The update command backs up the database to `backups/db-pre-upgrade-*.sql.gz`, pulls the new image, runs the database migrations with it before it starts, then restarts services. If a step fails, the previous version keeps running. To roll back the database, run `npx learnhouse restore backups/db-pre-upgrade-<timestamp>.sql.gz`.
|
|
91
|
+
|
|
92
|
+
## Choosing an installation
|
|
93
|
+
|
|
94
|
+
Commands act on the installation in the current directory, otherwise on the only one under `~/.learnhouse`. With several, pass `--dir`:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx learnhouse --dir ~/.learnhouse/production status
|
|
98
|
+
```
|
|
90
99
|
|
|
91
100
|
## Generated Files
|
|
92
101
|
|
|
@@ -101,19 +110,27 @@ learnhouse/
|
|
|
101
110
|
|
|
102
111
|
## CI / Non-interactive Mode
|
|
103
112
|
|
|
104
|
-
|
|
113
|
+
`setup --ci`, `start`, `stop`, `update`, `status`, `health`, `doctor`, `config`, `logs`, `backup` and `restore --yes` run without prompts. `env`, `scale`, `deployments` and `shell` are interactive and exit with code 2 when there is no terminal. `health` and `doctor` exit with code 1 when a check fails. The update check is skipped in CI; set `LEARNHOUSE_NO_UPDATE_CHECK=1` to turn it off elsewhere.
|
|
114
|
+
|
|
115
|
+
Secrets can be passed as environment variables instead of flags, which keeps them out of the process list and shell history: `LEARNHOUSE_ADMIN_PASSWORD`, `LEARNHOUSE_LICENSE_KEY`, `LEARNHOUSE_CF_API_TOKEN`, `LEARNHOUSE_EXTERNAL_DB`, `LEARNHOUSE_EXTERNAL_REDIS`.
|
|
105
116
|
|
|
106
117
|
```bash
|
|
107
118
|
# Setup without prompts
|
|
108
|
-
npx learnhouse setup --ci \
|
|
119
|
+
LEARNHOUSE_ADMIN_PASSWORD=secretpass123 npx learnhouse setup --ci \
|
|
109
120
|
--name production \
|
|
110
121
|
--domain example.com \
|
|
111
|
-
--port 80 \
|
|
112
122
|
--admin-email admin@example.com \
|
|
113
|
-
--
|
|
123
|
+
--https auto
|
|
124
|
+
|
|
125
|
+
# Re-running setup --ci on the same --name reconfigures it in place
|
|
126
|
+
# (same deployment, secrets, HTTPS mode, feature settings and any
|
|
127
|
+
# variables added to .env by hand).
|
|
128
|
+
|
|
129
|
+
# Update to a specific version (migrations run by default)
|
|
130
|
+
npx learnhouse update --to 1.2.0
|
|
114
131
|
|
|
115
|
-
#
|
|
116
|
-
npx learnhouse
|
|
132
|
+
# Restore without a prompt
|
|
133
|
+
npx learnhouse restore backups/learnhouse-backup-<timestamp>.tar.gz --yes
|
|
117
134
|
|
|
118
135
|
# Update without migrations
|
|
119
136
|
npx learnhouse update --no-migrate
|
|
@@ -128,8 +145,8 @@ npx learnhouse setup --ci --admin-password pass123 --no-start
|
|
|
128
145
|
# Unit tests (no Docker required)
|
|
129
146
|
bun run test
|
|
130
147
|
|
|
131
|
-
#
|
|
132
|
-
bun run test:
|
|
148
|
+
# Integration tests (requires Docker)
|
|
149
|
+
bun run test:integration
|
|
133
150
|
|
|
134
151
|
# All tests
|
|
135
152
|
bun run test:all
|
|
@@ -137,15 +154,14 @@ bun run test:all
|
|
|
137
154
|
|
|
138
155
|
**Unit tests** cover template generation (docker-compose, .env, nginx, caddyfile) and config store operations.
|
|
139
156
|
|
|
140
|
-
**
|
|
157
|
+
**Integration tests** run the full lifecycle with real Docker containers: setup → start → status → health → doctor → stop → restart. They use `--ci` mode to run without prompts.
|
|
141
158
|
|
|
142
159
|
**Not yet tested:**
|
|
143
|
-
- Interactive commands
|
|
160
|
+
- Interactive commands against a real terminal (env editor, shell, deployments scaling)
|
|
144
161
|
- `update` with actual version swap between two published images
|
|
145
162
|
- `update --migrate` with pending Alembic migrations
|
|
146
163
|
- `logs` (streams indefinitely)
|
|
147
164
|
- `dev` mode (requires full monorepo source)
|
|
148
|
-
- Multi-installation discovery (`findInstallDir` with multiple `~/.learnhouse/*` entries)
|
|
149
165
|
- Error recovery (Docker daemon down, port conflicts, corrupted config)
|
|
150
166
|
|
|
151
167
|
## License
|