learnhouse 1.5.1 → 1.6.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.
Files changed (3) hide show
  1. package/README.md +41 -26
  2. package/dist/bin/learnhouse.js +3743 -2779
  3. package/package.json +18 -15
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # LearnHouse CLI
2
2
 
3
- The official [LearnHouse](https://learnhouse.app) CLI — deploy, manage, and operate your LearnHouse instance.
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
 
@@ -36,8 +36,8 @@ npx learnhouse@1.0.0 setup
36
36
 
37
37
  ## Requirements
38
38
 
39
- - **Node.js** >= 18
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 --version <x.y.z>` | Update to a specific version |
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` | Backup database |
56
- | `learnhouse restore <archive>` | Restore database from a backup |
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. **Install directory** — where files are generated
68
- 2. **Domain** — hostname, port, HTTPS/SSL
69
- 3. **Database & Redis** — local (Docker) or external
70
- 4. **Organization** — name for your instance
71
- 5. **Admin account** — email and password
72
- 6. **Features** — AI, email, S3, OAuth, Unsplash
68
+ 1. **Install directory**: where files are generated
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 --version 1.2.0
87
+ npx learnhouse update --to 1.2.0
87
88
  ```
88
89
 
89
- The update command pulls the new image, restarts services, and asks if you want to run database migrations. Check [docs.learnhouse.app](https://docs.learnhouse.app) for migration guides before proceeding.
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,26 @@ learnhouse/
101
110
 
102
111
  ## CI / Non-interactive Mode
103
112
 
104
- All commands support non-interactive usage for CI pipelines:
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
122
  --port 80 \
112
- --admin-email admin@example.com \
113
- --admin-password secretpass123
123
+ --admin-email admin@example.com
124
+
125
+ # Re-running setup --ci on the same --name reconfigures it in place
126
+ # (same deployment, database password and secrets).
127
+
128
+ # Update to a specific version (migrations run by default)
129
+ npx learnhouse update --to 1.2.0
114
130
 
115
- # Update with auto-migration
116
- npx learnhouse update --version 1.2.0 --migrate
131
+ # Restore without a prompt
132
+ npx learnhouse restore backups/learnhouse-backup-<timestamp>.tar.gz --yes
117
133
 
118
134
  # Update without migrations
119
135
  npx learnhouse update --no-migrate
@@ -128,8 +144,8 @@ npx learnhouse setup --ci --admin-password pass123 --no-start
128
144
  # Unit tests (no Docker required)
129
145
  bun run test
130
146
 
131
- # E2E tests (requires Docker)
132
- bun run test:e2e
147
+ # Integration tests (requires Docker)
148
+ bun run test:integration
133
149
 
134
150
  # All tests
135
151
  bun run test:all
@@ -137,15 +153,14 @@ bun run test:all
137
153
 
138
154
  **Unit tests** cover template generation (docker-compose, .env, nginx, caddyfile) and config store operations.
139
155
 
140
- **E2E tests** run the full lifecycle with real Docker containers: setup → start → status → health → doctor → stop → restart. They use `--ci` mode to run without prompts.
156
+ **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
157
 
142
158
  **Not yet tested:**
143
- - Interactive commands (backup create/restore, env editor, shell, deployments scaling)
159
+ - Interactive commands against a real terminal (env editor, shell, deployments scaling)
144
160
  - `update` with actual version swap between two published images
145
161
  - `update --migrate` with pending Alembic migrations
146
162
  - `logs` (streams indefinitely)
147
163
  - `dev` mode (requires full monorepo source)
148
- - Multi-installation discovery (`findInstallDir` with multiple `~/.learnhouse/*` entries)
149
164
  - Error recovery (Docker daemon down, port conflicts, corrupted config)
150
165
 
151
166
  ## License