ezhst 1.3.4 → 1.4.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/dist/commands/apps.js +22 -1
- package/dist/commands/billing.js +21 -2
- package/dist/commands/db.js +1 -0
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/skill.js +3 -4
- package/dist/commands/storage.js +2 -2
- package/dist/embedded.js +2 -0
- package/dist/index.js +15 -10
- package/package.json +8 -3
- package/skill/SKILL.md +22 -22
package/dist/commands/apps.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { json, request } from "../lib/api.js";
|
|
2
|
+
import { readLinkedProject, writeLinkedProject } from "../lib/config.js";
|
|
2
3
|
import { resolveApp, resolveProject } from "../lib/project.js";
|
|
3
|
-
import { confirmed, log, output } from "../lib/ui.js";
|
|
4
|
+
import { confirmed, fail, log, output } from "../lib/ui.js";
|
|
4
5
|
export const listApps = async (options) => {
|
|
5
6
|
await resolveProject(options);
|
|
6
7
|
const result = await request("/apps");
|
|
@@ -22,3 +23,23 @@ export const deleteApp = async (options) => {
|
|
|
22
23
|
const result = await request(`/apps/${app.id}`, { method: "DELETE" });
|
|
23
24
|
output(result, () => log.success(`Deleted ${app.slug}`));
|
|
24
25
|
};
|
|
26
|
+
export const renameApp = async (name, options) => {
|
|
27
|
+
const current = await resolveApp(options);
|
|
28
|
+
const { app } = await request(`/apps/${current.id}`, json("PUT", { name }));
|
|
29
|
+
output({ app }, () => log.success(`Renamed to ${app.name}`));
|
|
30
|
+
};
|
|
31
|
+
export const transferApp = async (options) => {
|
|
32
|
+
const app = await resolveApp(options);
|
|
33
|
+
const { projects } = await request("/projects");
|
|
34
|
+
const target = projects.find((project) => project.slug === options.to || project.id === options.to);
|
|
35
|
+
if (!target) {
|
|
36
|
+
return fail(`Project ${options.to} not found. List projects with \`ezhst projects list\`.`);
|
|
37
|
+
}
|
|
38
|
+
confirmed(options.yes, `Transferring ${app.slug} moves it, its deployments, environment variables and domains to ${target.slug}.`);
|
|
39
|
+
const result = await request(`/apps/${app.id}/transfer`, json("POST", { projectId: target.id }));
|
|
40
|
+
const linked = readLinkedProject();
|
|
41
|
+
if (linked?.appId === app.id) {
|
|
42
|
+
writeLinkedProject({ projectId: target.id, slug: target.slug, appId: app.id });
|
|
43
|
+
}
|
|
44
|
+
output(result, () => log.success(result.message));
|
|
45
|
+
};
|
package/dist/commands/billing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pc from "picocolors";
|
|
2
2
|
import { request } from "../lib/api.js";
|
|
3
|
-
import { formatBytes, log, output } from "../lib/ui.js";
|
|
3
|
+
import { fail, formatBytes, log, output } from "../lib/ui.js";
|
|
4
4
|
export const showBilling = async () => {
|
|
5
5
|
const overview = await request("/billing");
|
|
6
6
|
output(overview, () => {
|
|
@@ -23,7 +23,7 @@ export const showBilling = async () => {
|
|
|
23
23
|
}
|
|
24
24
|
if (plan.id === "FREE") {
|
|
25
25
|
const pro = overview.plans.pro;
|
|
26
|
-
log.info(`Upgrade to Pro ($${pro.price}/mo, ${pro.projects} projects
|
|
26
|
+
log.info(`Upgrade to Pro ($${pro.price}/mo, ${pro.projects} projects) with \`ezhst billing upgrade\`.`);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
};
|
|
@@ -31,6 +31,25 @@ export const upgradeBilling = async () => {
|
|
|
31
31
|
const { url } = await request("/billing/checkout", { method: "POST" });
|
|
32
32
|
output({ url }, () => log.info(`Finish checkout in your browser: ${url}`));
|
|
33
33
|
};
|
|
34
|
+
export const buyTokens = async (amount) => {
|
|
35
|
+
const tokens = Number(amount);
|
|
36
|
+
if (!Number.isInteger(tokens)) {
|
|
37
|
+
fail("Tokens must be a whole number");
|
|
38
|
+
}
|
|
39
|
+
const { url, purchaseId } = await request("/tokens/checkout", {
|
|
40
|
+
method: "POST",
|
|
41
|
+
body: JSON.stringify({ tokens }),
|
|
42
|
+
});
|
|
43
|
+
output({ url, purchaseId }, () => log.info(`Finish checkout in your browser: ${url}`));
|
|
44
|
+
};
|
|
45
|
+
export const cancelBilling = async () => {
|
|
46
|
+
const result = await request("/billing/cancel", { method: "POST" });
|
|
47
|
+
output(result, () => log.info("Pro is cancelled and stays active until the end of the billing period."));
|
|
48
|
+
};
|
|
49
|
+
export const resumeBilling = async () => {
|
|
50
|
+
const result = await request("/billing/resume", { method: "POST" });
|
|
51
|
+
output(result, () => log.info("Pro is active again and will renew."));
|
|
52
|
+
};
|
|
34
53
|
export const billingPortal = async () => {
|
|
35
54
|
const { url } = await request("/billing/portal");
|
|
36
55
|
output({ url }, () => log.info(`Manage billing: ${url}`));
|
package/dist/commands/db.js
CHANGED
|
@@ -22,6 +22,7 @@ export const databaseInfo = async (options) => {
|
|
|
22
22
|
log.warn("Blocked: the database is over its size limit. Truncate or drop tables in the dashboard to free space.");
|
|
23
23
|
}
|
|
24
24
|
log.info(`DATABASE_URL: ${info.connectionString}`);
|
|
25
|
+
log.info(`DIRECT_URL: ${info.directConnectionString}`);
|
|
25
26
|
log.info(`SHADOW_DATABASE_URL: ${info.shadowConnectionString}`);
|
|
26
27
|
log.info(`Tables: ${detail.tables.length}`);
|
|
27
28
|
for (const item of detail.tables) {
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdtempSync,
|
|
1
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import * as tar from "tar";
|
|
@@ -169,7 +169,7 @@ export const deploy = async (options) => {
|
|
|
169
169
|
const { stage, archive } = await withSpinner("Packaging source", () => "Packaged source", () => packSource(cwd));
|
|
170
170
|
try {
|
|
171
171
|
const { deployment, url } = await withSpinner("Uploading", (result) => `Uploaded ${result.size}`, async () => {
|
|
172
|
-
const blob =
|
|
172
|
+
const blob = new Blob([readFileSync(archive)]);
|
|
173
173
|
const form = new FormData();
|
|
174
174
|
form.append("file", blob, "app.tgz");
|
|
175
175
|
const result = await request(`/apps/${project.id}/deploy`, {
|
package/dist/commands/skill.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { select } from "@inquirer/prompts";
|
|
2
|
-
import {
|
|
2
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { fail, log, output, required } from "../lib/ui.js";
|
|
7
|
-
|
|
6
|
+
import { SKILL } from "../embedded.js";
|
|
8
7
|
const AGENTS = {
|
|
9
8
|
claude: { name: "Claude Code", folder: ".claude" },
|
|
10
9
|
codex: { name: "Codex", folder: ".agents" },
|
|
@@ -44,7 +43,7 @@ export const installSkill = async (options) => {
|
|
|
44
43
|
const directory = path.join(base, agent.folder, "skills", "reverhost");
|
|
45
44
|
const target = path.join(directory, "SKILL.md");
|
|
46
45
|
mkdirSync(directory, { recursive: true });
|
|
47
|
-
|
|
46
|
+
writeFileSync(target, SKILL);
|
|
48
47
|
output({ agent: agentKey, scope, path: target }, () => {
|
|
49
48
|
log.success(`Installed the Reverhost skill for ${agent.name} at ${target}`);
|
|
50
49
|
log.info('Ask your agent: "Deploy this app to Reverhost."');
|
package/dist/commands/storage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import pc from "picocolors";
|
|
4
4
|
import { json, request } from "../lib/api.js";
|
|
@@ -73,7 +73,7 @@ export const uploadStorage = async (files, options) => {
|
|
|
73
73
|
const uploaded = [];
|
|
74
74
|
for (const file of files) {
|
|
75
75
|
const form = new FormData();
|
|
76
|
-
form.append("file",
|
|
76
|
+
form.append("file", new Blob([readFileSync(file)]), path.basename(file));
|
|
77
77
|
if (options.prefix) {
|
|
78
78
|
form.append("prefix", options.prefix);
|
|
79
79
|
}
|
package/dist/embedded.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const VERSION = "1.4.0";
|
|
2
|
+
export const SKILL = "---\nname: reverhost\ndescription: Deploy and manage apps on Reverhost (free hosting) with the ezhst CLI. Use when the user asks to deploy, host, publish or ship an app (any language, built from a Dockerfile) to Reverhost, or to manage its environment variables, build settings, logs, custom domains, S3 storage or Postgres database.\n---\n\n# Reverhost\n\nReverhost is free hosting for apps in any language, built from a Dockerfile you write, with built-in S3 storage and Postgres. It is in beta. Everything is done through the `ezhst` CLI. If `ezhst --version` fails, install it: `npm i -g ezhst` (needs Node.js), or the standalone binary with no Node.js: `curl -fsSL https://reverhost.com/install.sh | sh` on macOS and Linux, `irm https://reverhost.com/install.ps1 | iex` in PowerShell on Windows.\n\n## Rules for agents\n\n- Always pass `--json` and parse stdout. Progress and hints go to stderr. On failure the process exits with code 1 and prints `{\"error\": \"...\"}`.\n- The CLI never prompts without a TTY. Pass every value as a flag.\n- Commands that act on a project use the project linked in `.reverhost.json`, or `--project <slug>`. App commands also use `--app <slug-or-id>` or the linked app. With multiple apps, select one explicitly.\n- Destructive commands (`projects delete`, `apps delete`, `apps transfer`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.\n- Never print secrets (passwords, S3 secret keys, connection strings) back to the user unless they ask. Put them in env vars with `ezhst env set` instead.\n- `.env` files are never uploaded. Environment variables must be set with `ezhst env set` or `ezhst env import .env`.\n\n## 1. Authenticate\n\nCheck first: `ezhst whoami --json`. If it fails with \"Not logged in\":\n\n- Existing account: ask the user for email and password, then `ezhst login --email <email> --password <password> --json`\n- New account: ask for name, email and password, then `ezhst register --name <name> --email <email> --password <password> --json`. Verification is mandatory: ask the user for the 6-digit code from their inbox and run `ezhst verify <code> --json` before any other command (`ezhst resend-verification` sends a new code).\n- CI: set `EZHST_TOKEN` instead of logging in.\n\n## 2. Pick or create a project\n\nA project contains up to 2 apps, and shared storage and database. Each app has its own slug and URL: `https://<app-slug>.easyhost.fun`. Existing project apps retain their URLs.\n\n```\nezhst projects list --json\nezhst projects create <name> --link --json\nezhst link --project <slug> --json\n```\n\n## 3. Deploy\n\nEvery app builds from a Dockerfile stored on the app, not from a file in the repo. Never create, edit or upload a `Dockerfile` file in the user's project. Always write the Dockerfile straight to the app through the CLI. Run inside the app folder:\n\n1. Inspect the repo, then always fetch the current template list from the API with `ezhst build dockerfile template --json` and pick the id that matches the framework. `ezhst build dockerfile template <id> --json` returns one template with its Dockerfile. A Dockerfile already in the repo is only a reference: read it, adapt it, and send the result through the CLI like any other.\n2. Adapt the template to the repo, then save it to the app by piping it through stdin with a quoted heredoc (`<<'EOF'`, so the shell does not expand `$PORT` or `$(...)`). If the template fits unchanged, `ezhst build dockerfile template <id> --apply --json` saves it directly.\n3. The app must listen on `0.0.0.0` and `$PORT` (3000).\n4. Env vars are runtime env. If the build step needs them, use `RUN --mount=type=secret,id=appenv,target=/run/secrets/appenv sh -c 'set -a; . /run/secrets/appenv; set +a; <build command>'`. Never put secrets in `ARG` or `ENV`.\n5. Keep the image under 1 GB (slim bases, multi-stage builds for compiled languages). Containers get 256 MB of memory and half a CPU. Download toolchains from fast sources (package managers, official images); a slow download is billed build time and builds stop after 20 minutes.\n6. Do not use `# syntax=` lines or images from the Reverhost registry; they are rejected.\n\n```\nezhst apps create <name> --project <project-slug> --json\nezhst link --project <project-slug> --app <app-slug> --json\nezhst env import .env --json\nezhst build dockerfile set -f - --json <<'EOF'\nFROM node:22-alpine\n...\nEOF\nezhst deploy --json\n```\n\nSuccess prints `{\"deploymentId\", \"status\": \"RUNNING\", \"url\"}`. On failure read the build log and fix the cause:\n\n```\nezhst deployments log --json\n```\n\nCommon fixes:\n- Missing env var at build time: `ezhst env set KEY=VALUE`, then `ezhst redeploy`.\n- `npm ci` says the lockfile is out of sync: delete `node_modules` and `package-lock.json`, run `npm install`, deploy again.\n- Monorepo: `ezhst build set --root-dir apps/web`.\n- Build fails: read the stored Dockerfile with `ezhst build dockerfile show --json`, fix it, send it back with `ezhst build dockerfile set -f - <<'EOF'`, then `ezhst redeploy` (rebuilds the last upload, even a failed one).\n- App starts but the URL fails: it is not listening on `0.0.0.0:$PORT`.\n- Daily build limit reached (10 per day on Free, 50 on Pro): wait or upgrade; do not loop deploys.\n\nAfter changing env vars or build settings, run `ezhst redeploy --json` (rebuilds the last upload). After changing code, run `deploy` again.\n\n## Commands\n\nProjects and runtime:\n- `projects list | info | rename <name> | delete --yes`, `projects create <name> [--link]`, `link --project <slug>`\n- `apps list | create <name> | rename <name> | transfer --to <project-slug> --yes | delete --yes` (transfer moves an app to another project you own; only when the user asks)\n- `deploy [--verbose] [--app <slug>]`, `redeploy`, `start` (also wakes a sleeping app), `stop`\n- `logs [--tail 200]` runtime logs\n- `deployments list`, `deployments log [deploymentId]` build logs\n\nEnvironment and build:\n- `env list | set KEY=VALUE... | unset KEY... | import <file>`\n- `build show`, `build set --root-dir <dir>` (build context, `\"\"` for the project root), `build reset`\n- `build dockerfile show`, `build dockerfile set -f -` (reads stdin; agents always use this), `build dockerfile template [id] [--apply]`\n\nCustom domains:\n- `domains list | add <hostname> | verify <hostname> | remove <hostname>`\n- DNS: CNAME to `<slug>.easyhost.fun`, or an A record to the IP from `domains list` for a root domain. Run `verify` after DNS is set; it issues HTTPS.\n\nStorage (S3 compatible, one bucket per project, files are public by URL):\n- `storage create <name> | info | rotate-keys | ls [prefix] | upload <files...> [--prefix dir/] | download <key> [output] | rm <key> | delete --yes`\n- In app code use any S3 client with endpoint `https://storage.reverhost.com`, region `us-east-1`, `forcePathStyle: true`, and the bucket name and keys from `storage info`. Public file URL: `https://storage.reverhost.com/<bucket>/<key>`.\n- Typical setup: `storage create files`, then `env set S3_ENDPOINT=... S3_BUCKET=... S3_ACCESS_KEY_ID=... S3_SECRET_ACCESS_KEY=...` from `storage info --json`.\n\nDatabase (Postgres, one per project):\n- `db create <name> | info | query \"<sql>\" | query --file <file.sql> | rows <table> [--page n] | reset-password | delete --yes`\n- `db info --json` returns `connectionString` (pooled, for the app), `directConnectionString` (for migrations) and `shadowConnectionString` (for `prisma migrate dev`). Set `DATABASE_URL` to `connectionString` with `env set`. Run migrations against `directConnectionString` (for Prisma set `directUrl = env(\"DIRECT_URL\")` and run `prisma migrate deploy`). The pooled URL runs in transaction mode, so `LISTEN/NOTIFY`, session `SET`, advisory locks and temp tables need the direct URL.\n\nMembers:\n- `members list | invite <email> | revoke <email> | remove <email> --yes | leave --yes`. Only the owner can invite, revoke, remove, rename or delete the project. Members can do everything else.\n- `accept-invite <link-or-token>` joins a project. The logged-in email must match the invited email.\n\nAccount:\n- `whoami`, `logout`, `verify <code>`, `resend-verification`, `forgot-password --email <email>`\n- If a command fails with \"Your email is not verified\", ask the user for the 6-digit code from their inbox and run `verify <code>`. Codes expire after 10 minutes; `resend-verification` sends a new one (once a minute).\n- Limit errors (\"You can have 3 projects on the Free plan...\", \"This project can have 2 apps.\") are plan limits: suggest deleting something the user no longer needs, or Pro for more projects.\n- \"This app is paused\" or \"This database is over its size limit\": the project is over its plan, so its apps are stopped. Free space (drop tables or delete files) or, for paused projects, upgrade to Pro.\n\nBilling:\n- `billing` shows the plan, limits and usage per project. `billing upgrade` prints a Pro checkout link for the user to open (never pay for them). `billing tokens <amount>` prints a checkout link to buy AI tokens (never pay for them). `billing cancel` cancels Pro at the end of the period and `billing resume` undoes it (only when the user asks). `billing portal` prints the link to manage payment details and invoices.\n\n## Limits\n\nFree: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to 500 every month. Per project on both: 2 apps, one bucket (256 MB) and one database (128 MB). One build at a time; 512 MB RAM and 1 CPU per app. A full bucket rejects uploads; a database over its size is blocked and the project's apps stop. On Free, an app with no traffic for 1 hour goes to sleep (status `SLEEPING`) and wakes on the next request after a short loading page; API clients get a 503 with `Retry-After` while it starts. Pro apps never sleep.\n\nDocs: https://reverhost.com/docs\n";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
3
|
import { forgotPassword, login, logout, register, resendVerification, verify, whoami } from "./commands/auth.js";
|
|
5
|
-
import { createApp, deleteApp, listApps } from "./commands/apps.js";
|
|
4
|
+
import { createApp, deleteApp, listApps, renameApp, transferApp } from "./commands/apps.js";
|
|
6
5
|
import { createProject, deleteProject, link, listProjects, logs, projectInfo, renameProject, start, stop } from "./commands/projects.js";
|
|
7
6
|
import { deploy, deploymentLog, listDeployments, redeploy } from "./commands/deploy.js";
|
|
8
7
|
import { importEnv, listEnv, setEnv, unsetEnv } from "./commands/env.js";
|
|
@@ -12,17 +11,14 @@ import { createStorage, deleteStorage, downloadStorage, listStorage, removeStora
|
|
|
12
11
|
import { createDatabase, databaseInfo, deleteDatabase, queryDatabase, resetDatabasePassword, tableRows } from "./commands/db.js";
|
|
13
12
|
import { acceptInvite, inviteMember, leaveProject, listMembers, removeMember, revokeInvite } from "./commands/members.js";
|
|
14
13
|
import { installSkill } from "./commands/skill.js";
|
|
15
|
-
import { billingPortal, showBilling, upgradeBilling } from "./commands/billing.js";
|
|
14
|
+
import { billingPortal, buyTokens, cancelBilling, resumeBilling, showBilling, upgradeBilling } from "./commands/billing.js";
|
|
16
15
|
import { fail, setJsonMode } from "./lib/ui.js";
|
|
17
|
-
|
|
18
|
-
if (!packageMetadata || typeof packageMetadata !== "object" || !("version" in packageMetadata) || typeof packageMetadata.version !== "string") {
|
|
19
|
-
throw new Error("CLI package version is missing or malformed");
|
|
20
|
-
}
|
|
16
|
+
import { VERSION } from "./embedded.js";
|
|
21
17
|
const program = new Command();
|
|
22
18
|
program
|
|
23
19
|
.name("ezhst")
|
|
24
20
|
.description("Reverhost from the terminal: deploy apps and manage storage and databases")
|
|
25
|
-
.version(
|
|
21
|
+
.version(VERSION)
|
|
26
22
|
.option("--json", "Print machine-readable JSON")
|
|
27
23
|
.hook("preAction", (_command, action) => {
|
|
28
24
|
setJsonMode(!!action.optsWithGlobals().json);
|
|
@@ -63,7 +59,7 @@ scoped(projects.command("delete").description("Delete a project and everything i
|
|
|
63
59
|
appScoped(program.command("link").description("Link the current folder to a project")).action(link);
|
|
64
60
|
appScoped(program.command("deploy").description("Upload and deploy the app in this folder").option("--verbose", "Stream the build log")).action(deploy);
|
|
65
61
|
appScoped(program.command("redeploy").description("Rebuild the latest upload").option("--verbose", "Stream the build log")).action(redeploy);
|
|
66
|
-
appScoped(program.command("start").description("Start a stopped app")).action(start);
|
|
62
|
+
appScoped(program.command("start").description("Start a stopped app or wake a sleeping one")).action(start);
|
|
67
63
|
appScoped(program.command("stop").description("Stop the running app")).action(stop);
|
|
68
64
|
appScoped(program.command("logs").description("Show runtime logs").option("--tail <lines>", "Number of lines", "200")).action(logs);
|
|
69
65
|
const deployments = program.command("deployments").description("Deployments and build logs");
|
|
@@ -94,10 +90,19 @@ appScoped(domains.command("remove").description("Remove a domain").argument("<ho
|
|
|
94
90
|
const apps = program.command("apps").description("Manage the apps in a project (2 per project)");
|
|
95
91
|
scoped(apps.command("list").description("List apps in a project")).action(listApps);
|
|
96
92
|
scoped(apps.command("create").description("Create an app").argument("<name>")).action(createApp);
|
|
93
|
+
appScoped(apps.command("rename").description("Rename an app").argument("<name>")).action(renameApp);
|
|
94
|
+
appScoped(apps
|
|
95
|
+
.command("transfer")
|
|
96
|
+
.description("Move an app to another project you own")
|
|
97
|
+
.requiredOption("--to <project>", "Target project slug or ID")
|
|
98
|
+
.option("--yes", "Confirm")).action(transferApp);
|
|
97
99
|
appScoped(apps.command("delete").description("Delete one app and its deployments").option("--yes", "Confirm")).action(deleteApp);
|
|
98
100
|
const billing = program.command("billing").description("Plan, usage and the Pro subscription");
|
|
99
101
|
billing.command("show", { isDefault: true }).description("Show your plan, limits and usage").action(showBilling);
|
|
100
|
-
billing.command("upgrade").description("Print a checkout link for Pro
|
|
102
|
+
billing.command("upgrade").description("Print a checkout link for Pro").action(upgradeBilling);
|
|
103
|
+
billing.command("tokens").description("Print a checkout link to buy AI tokens").argument("<amount>", "Number of tokens").action(buyTokens);
|
|
104
|
+
billing.command("cancel").description("Cancel Pro at the end of the billing period").action(cancelBilling);
|
|
105
|
+
billing.command("resume").description("Undo a scheduled cancellation").action(resumeBilling);
|
|
101
106
|
billing.command("portal").description("Print the link to manage or cancel your subscription").action(billingPortal);
|
|
102
107
|
const storage = program.command("storage").description("S3 compatible storage");
|
|
103
108
|
scoped(storage.command("info").description("Show the bucket and S3 credentials")).action(storageInfo);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezhst",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Reverhost CLI:
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Reverhost CLI: deploy apps in any language with storage and databases",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ezhst": "dist/index.js"
|
|
@@ -11,9 +11,14 @@
|
|
|
11
11
|
"skill"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"embed": "node scripts/embed.mjs",
|
|
15
|
+
"predev": "npm run embed",
|
|
14
16
|
"dev": "tsx src/index.ts",
|
|
17
|
+
"prebuild": "npm run embed",
|
|
15
18
|
"build": "tsc",
|
|
16
|
-
"
|
|
19
|
+
"pretypecheck": "npm run embed",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"build:bin": "node scripts/build-binaries.mjs"
|
|
17
22
|
},
|
|
18
23
|
"dependencies": {
|
|
19
24
|
"@inquirer/prompts": "^8.7.2",
|
package/skill/SKILL.md
CHANGED
|
@@ -5,23 +5,23 @@ description: Deploy and manage apps on Reverhost (free hosting) with the ezhst C
|
|
|
5
5
|
|
|
6
6
|
# Reverhost
|
|
7
7
|
|
|
8
|
-
Reverhost is free hosting for apps in any language, built from a Dockerfile you write, with built-in S3 storage and Postgres. It is in beta. Everything is done through the `ezhst` CLI.
|
|
8
|
+
Reverhost is free hosting for apps in any language, built from a Dockerfile you write, with built-in S3 storage and Postgres. It is in beta. Everything is done through the `ezhst` CLI. If `ezhst --version` fails, install it: `npm i -g ezhst` (needs Node.js), or the standalone binary with no Node.js: `curl -fsSL https://reverhost.com/install.sh | sh` on macOS and Linux, `irm https://reverhost.com/install.ps1 | iex` in PowerShell on Windows.
|
|
9
9
|
|
|
10
10
|
## Rules for agents
|
|
11
11
|
|
|
12
12
|
- Always pass `--json` and parse stdout. Progress and hints go to stderr. On failure the process exits with code 1 and prints `{"error": "..."}`.
|
|
13
13
|
- The CLI never prompts without a TTY. Pass every value as a flag.
|
|
14
14
|
- Commands that act on a project use the project linked in `.reverhost.json`, or `--project <slug>`. App commands also use `--app <slug-or-id>` or the linked app. With multiple apps, select one explicitly.
|
|
15
|
-
- Destructive commands (`projects delete`, `apps delete`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
|
|
15
|
+
- Destructive commands (`projects delete`, `apps delete`, `apps transfer`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
|
|
16
16
|
- Never print secrets (passwords, S3 secret keys, connection strings) back to the user unless they ask. Put them in env vars with `ezhst env set` instead.
|
|
17
17
|
- `.env` files are never uploaded. Environment variables must be set with `ezhst env set` or `ezhst env import .env`.
|
|
18
18
|
|
|
19
19
|
## 1. Authenticate
|
|
20
20
|
|
|
21
|
-
Check first: `
|
|
21
|
+
Check first: `ezhst whoami --json`. If it fails with "Not logged in":
|
|
22
22
|
|
|
23
|
-
- Existing account: ask the user for email and password, then `
|
|
24
|
-
- New account: ask for name, email and password, then `
|
|
23
|
+
- Existing account: ask the user for email and password, then `ezhst login --email <email> --password <password> --json`
|
|
24
|
+
- New account: ask for name, email and password, then `ezhst register --name <name> --email <email> --password <password> --json`. Verification is mandatory: ask the user for the 6-digit code from their inbox and run `ezhst verify <code> --json` before any other command (`ezhst resend-verification` sends a new code).
|
|
25
25
|
- CI: set `EZHST_TOKEN` instead of logging in.
|
|
26
26
|
|
|
27
27
|
## 2. Pick or create a project
|
|
@@ -29,37 +29,37 @@ Check first: `npx ezhst whoami --json`. If it fails with "Not logged in":
|
|
|
29
29
|
A project contains up to 2 apps, and shared storage and database. Each app has its own slug and URL: `https://<app-slug>.easyhost.fun`. Existing project apps retain their URLs.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
ezhst projects list --json
|
|
33
|
+
ezhst projects create <name> --link --json
|
|
34
|
+
ezhst link --project <slug> --json
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 3. Deploy
|
|
38
38
|
|
|
39
39
|
Every app builds from a Dockerfile stored on the app, not from a file in the repo. Never create, edit or upload a `Dockerfile` file in the user's project. Always write the Dockerfile straight to the app through the CLI. Run inside the app folder:
|
|
40
40
|
|
|
41
|
-
1. Inspect the repo
|
|
42
|
-
2. Adapt the template to the repo, then save it to the app by piping it through stdin with a quoted heredoc (`<<'EOF'`, so the shell does not expand `$PORT` or `$(...)`). If the template fits unchanged, `
|
|
41
|
+
1. Inspect the repo, then always fetch the current template list from the API with `ezhst build dockerfile template --json` and pick the id that matches the framework. `ezhst build dockerfile template <id> --json` returns one template with its Dockerfile. A Dockerfile already in the repo is only a reference: read it, adapt it, and send the result through the CLI like any other.
|
|
42
|
+
2. Adapt the template to the repo, then save it to the app by piping it through stdin with a quoted heredoc (`<<'EOF'`, so the shell does not expand `$PORT` or `$(...)`). If the template fits unchanged, `ezhst build dockerfile template <id> --apply --json` saves it directly.
|
|
43
43
|
3. The app must listen on `0.0.0.0` and `$PORT` (3000).
|
|
44
44
|
4. Env vars are runtime env. If the build step needs them, use `RUN --mount=type=secret,id=appenv,target=/run/secrets/appenv sh -c 'set -a; . /run/secrets/appenv; set +a; <build command>'`. Never put secrets in `ARG` or `ENV`.
|
|
45
45
|
5. Keep the image under 1 GB (slim bases, multi-stage builds for compiled languages). Containers get 256 MB of memory and half a CPU. Download toolchains from fast sources (package managers, official images); a slow download is billed build time and builds stop after 20 minutes.
|
|
46
46
|
6. Do not use `# syntax=` lines or images from the Reverhost registry; they are rejected.
|
|
47
47
|
|
|
48
48
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
ezhst apps create <name> --project <project-slug> --json
|
|
50
|
+
ezhst link --project <project-slug> --app <app-slug> --json
|
|
51
|
+
ezhst env import .env --json
|
|
52
|
+
ezhst build dockerfile set -f - --json <<'EOF'
|
|
53
53
|
FROM node:22-alpine
|
|
54
54
|
...
|
|
55
55
|
EOF
|
|
56
|
-
|
|
56
|
+
ezhst deploy --json
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Success prints `{"deploymentId", "status": "RUNNING", "url"}`. On failure read the build log and fix the cause:
|
|
60
60
|
|
|
61
61
|
```
|
|
62
|
-
|
|
62
|
+
ezhst deployments log --json
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Common fixes:
|
|
@@ -70,14 +70,14 @@ Common fixes:
|
|
|
70
70
|
- App starts but the URL fails: it is not listening on `0.0.0.0:$PORT`.
|
|
71
71
|
- Daily build limit reached (10 per day on Free, 50 on Pro): wait or upgrade; do not loop deploys.
|
|
72
72
|
|
|
73
|
-
After changing env vars or build settings, run `
|
|
73
|
+
After changing env vars or build settings, run `ezhst redeploy --json` (rebuilds the last upload). After changing code, run `deploy` again.
|
|
74
74
|
|
|
75
75
|
## Commands
|
|
76
76
|
|
|
77
77
|
Projects and runtime:
|
|
78
78
|
- `projects list | info | rename <name> | delete --yes`, `projects create <name> [--link]`, `link --project <slug>`
|
|
79
|
-
- `apps list | create <name> | delete --yes`
|
|
80
|
-
- `deploy [--verbose] [--app <slug>]`, `redeploy`, `start
|
|
79
|
+
- `apps list | create <name> | rename <name> | transfer --to <project-slug> --yes | delete --yes` (transfer moves an app to another project you own; only when the user asks)
|
|
80
|
+
- `deploy [--verbose] [--app <slug>]`, `redeploy`, `start` (also wakes a sleeping app), `stop`
|
|
81
81
|
- `logs [--tail 200]` runtime logs
|
|
82
82
|
- `deployments list`, `deployments log [deploymentId]` build logs
|
|
83
83
|
|
|
@@ -97,7 +97,7 @@ Storage (S3 compatible, one bucket per project, files are public by URL):
|
|
|
97
97
|
|
|
98
98
|
Database (Postgres, one per project):
|
|
99
99
|
- `db create <name> | info | query "<sql>" | query --file <file.sql> | rows <table> [--page n] | reset-password | delete --yes`
|
|
100
|
-
- `db info --json` returns `connectionString` and `shadowConnectionString` (for `prisma migrate dev`). Set `DATABASE_URL` with `env set
|
|
100
|
+
- `db info --json` returns `connectionString` (pooled, for the app), `directConnectionString` (for migrations) and `shadowConnectionString` (for `prisma migrate dev`). Set `DATABASE_URL` to `connectionString` with `env set`. Run migrations against `directConnectionString` (for Prisma set `directUrl = env("DIRECT_URL")` and run `prisma migrate deploy`). The pooled URL runs in transaction mode, so `LISTEN/NOTIFY`, session `SET`, advisory locks and temp tables need the direct URL.
|
|
101
101
|
|
|
102
102
|
Members:
|
|
103
103
|
- `members list | invite <email> | revoke <email> | remove <email> --yes | leave --yes`. Only the owner can invite, revoke, remove, rename or delete the project. Members can do everything else.
|
|
@@ -110,10 +110,10 @@ Account:
|
|
|
110
110
|
- "This app is paused" or "This database is over its size limit": the project is over its plan, so its apps are stopped. Free space (drop tables or delete files) or, for paused projects, upgrade to Pro.
|
|
111
111
|
|
|
112
112
|
Billing:
|
|
113
|
-
- `billing` shows the plan, limits and usage per project. `billing upgrade` prints a Pro checkout link for the user to open (never pay for them). `billing portal` prints the link to manage
|
|
113
|
+
- `billing` shows the plan, limits and usage per project. `billing upgrade` prints a Pro checkout link for the user to open (never pay for them). `billing tokens <amount>` prints a checkout link to buy AI tokens (never pay for them). `billing cancel` cancels Pro at the end of the period and `billing resume` undoes it (only when the user asks). `billing portal` prints the link to manage payment details and invoices.
|
|
114
114
|
|
|
115
115
|
## Limits
|
|
116
116
|
|
|
117
|
-
Free: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to
|
|
117
|
+
Free: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to 500 every month. Per project on both: 2 apps, one bucket (256 MB) and one database (128 MB). One build at a time; 512 MB RAM and 1 CPU per app. A full bucket rejects uploads; a database over its size is blocked and the project's apps stop. On Free, an app with no traffic for 1 hour goes to sleep (status `SLEEPING`) and wakes on the next request after a short loading page; API clients get a 503 with `Retry-After` while it starts. Pro apps never sleep.
|
|
118
118
|
|
|
119
119
|
Docs: https://reverhost.com/docs
|