ezhst 1.3.0 → 1.3.2
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/auth.js +1 -1
- package/dist/commands/billing.js +37 -0
- package/dist/commands/build.js +97 -36
- package/dist/commands/db.js +4 -1
- package/dist/commands/deploy.js +20 -14
- package/dist/commands/projects.js +1 -1
- package/dist/commands/skill.js +2 -2
- package/dist/commands/storage.js +7 -4
- package/dist/index.js +22 -52
- package/dist/lib/api.js +1 -4
- package/dist/lib/config.js +1 -1
- package/package.json +2 -2
- package/skill/SKILL.md +27 -22
package/dist/commands/auth.js
CHANGED
|
@@ -10,7 +10,7 @@ const saveSession = (apiUrl, token, user, message) => {
|
|
|
10
10
|
output({ user, token }, () => {
|
|
11
11
|
log.success(`${message} ${user.name} <${user.email}>`);
|
|
12
12
|
if (!user.verified && !isInteractive()) {
|
|
13
|
-
log.warn("Verify your email before using
|
|
13
|
+
log.warn("Verify your email before using Reverhost: run `ezhst verify <code>` with the 6-digit code we emailed you.");
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
import { request } from "../lib/api.js";
|
|
3
|
+
import { formatBytes, log, output } from "../lib/ui.js";
|
|
4
|
+
export const showBilling = async () => {
|
|
5
|
+
const overview = await request("/billing");
|
|
6
|
+
output(overview, () => {
|
|
7
|
+
const { plan } = overview;
|
|
8
|
+
log.info(`${pc.bold("Plan")} ${plan.name} ($${plan.price}/mo)`);
|
|
9
|
+
if (overview.subscription) {
|
|
10
|
+
log.info(`${pc.bold("Status")} ${overview.subscription.status.toLowerCase().replace("_", " ")}`);
|
|
11
|
+
}
|
|
12
|
+
if (overview.subscription?.renewsAt) {
|
|
13
|
+
log.info(`${pc.bold("Renews")} ${new Date(overview.subscription.renewsAt).toLocaleDateString()}`);
|
|
14
|
+
}
|
|
15
|
+
log.info(`${pc.bold("Tokens")} ${overview.tokenBalance}`);
|
|
16
|
+
log.info(`${pc.bold("Projects")} ${overview.projects.length} / ${plan.projects}`);
|
|
17
|
+
for (const project of overview.projects) {
|
|
18
|
+
let paused = "";
|
|
19
|
+
if (!project.allowed) {
|
|
20
|
+
paused = pc.red(" paused");
|
|
21
|
+
}
|
|
22
|
+
log.info(` ${project.slug.padEnd(40)} apps ${project.usage.apps}/${plan.apps} db ${formatBytes(project.usage.dbBytes)}/${formatBytes(plan.dbBytes)} storage ${formatBytes(project.usage.storageBytes)}/${formatBytes(plan.storageBytes)}${paused}`);
|
|
23
|
+
}
|
|
24
|
+
if (plan.id === "FREE") {
|
|
25
|
+
const pro = overview.plans.pro;
|
|
26
|
+
log.info(`Upgrade to Pro ($${pro.price}/mo, ${pro.projects} projects, ${pro.monthlyTokens} AI tokens a month) with \`ezhst billing upgrade\`.`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export const upgradeBilling = async () => {
|
|
31
|
+
const { url } = await request("/billing/checkout", { method: "POST" });
|
|
32
|
+
output({ url }, () => log.info(`Finish checkout in your browser: ${url}`));
|
|
33
|
+
};
|
|
34
|
+
export const billingPortal = async () => {
|
|
35
|
+
const { url } = await request("/billing/portal");
|
|
36
|
+
output({ url }, () => log.info(`Manage billing: ${url}`));
|
|
37
|
+
};
|
package/dist/commands/build.js
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { select } from "@inquirer/prompts";
|
|
1
3
|
import { json, request } from "../lib/api.js";
|
|
2
4
|
import { resolveApp } from "../lib/project.js";
|
|
3
|
-
import { log, output } from "../lib/ui.js";
|
|
5
|
+
import { fail, isInteractive, log, output } from "../lib/ui.js";
|
|
4
6
|
const settingsOf = (project) => ({
|
|
5
|
-
nodeVersion: project.nodeVersion,
|
|
6
7
|
rootDir: project.rootDir,
|
|
7
|
-
|
|
8
|
-
buildCommand: project.buildCommand,
|
|
9
|
-
startCommand: project.startCommand,
|
|
8
|
+
dockerfile: project.dockerfile,
|
|
10
9
|
});
|
|
11
10
|
const printSettings = (project) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
["Build command", project.buildCommand],
|
|
17
|
-
["Start command", project.startCommand],
|
|
18
|
-
];
|
|
19
|
-
for (const [label, value] of rows) {
|
|
20
|
-
log.info(`${label.padEnd(17)} ${value ?? "auto"}`);
|
|
11
|
+
log.info(`Root directory ${project.rootDir ?? "project root"}`);
|
|
12
|
+
if (!project.dockerfile) {
|
|
13
|
+
log.info("Dockerfile not set");
|
|
14
|
+
return;
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (value === undefined) {
|
|
25
|
-
return current ?? "";
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
16
|
+
log.info("Dockerfile:\n");
|
|
17
|
+
process.stdout.write(`${project.dockerfile}\n`);
|
|
28
18
|
};
|
|
29
19
|
const saveSettings = async (project, settings) => {
|
|
30
20
|
const { app } = await request(`/apps/${project.id}/build`, json("PUT", settings));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
return app;
|
|
22
|
+
};
|
|
23
|
+
const readStdin = async () => {
|
|
24
|
+
const chunks = [];
|
|
25
|
+
for await (const chunk of process.stdin) {
|
|
26
|
+
chunks.push(chunk);
|
|
27
|
+
}
|
|
28
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
29
|
+
};
|
|
30
|
+
const readDockerfile = async (file) => {
|
|
31
|
+
if (file === "-") {
|
|
32
|
+
return readStdin();
|
|
33
|
+
}
|
|
34
|
+
if (!existsSync(file)) {
|
|
35
|
+
return fail(`${file} not found.`);
|
|
36
|
+
}
|
|
37
|
+
return readFileSync(file, "utf8");
|
|
38
|
+
};
|
|
39
|
+
const listTemplates = async () => {
|
|
40
|
+
const { templates } = await request("/apps/dockerfile-templates");
|
|
41
|
+
return templates;
|
|
35
42
|
};
|
|
36
43
|
export const showBuild = async (options) => {
|
|
37
44
|
const project = await resolveApp(options);
|
|
@@ -39,19 +46,73 @@ export const showBuild = async (options) => {
|
|
|
39
46
|
};
|
|
40
47
|
export const setBuild = async (options) => {
|
|
41
48
|
const project = await resolveApp(options);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
nodeVersion,
|
|
48
|
-
rootDir: pick(options.rootDir, project.rootDir),
|
|
49
|
-
installCommand: pick(options.install, project.installCommand),
|
|
50
|
-
buildCommand: pick(options.build, project.buildCommand),
|
|
51
|
-
startCommand: pick(options.start, project.startCommand),
|
|
52
|
-
});
|
|
49
|
+
if (options.rootDir === undefined) {
|
|
50
|
+
fail("Nothing to change. Pass --root-dir <dir>.");
|
|
51
|
+
}
|
|
52
|
+
const app = await saveSettings(project, { rootDir: options.rootDir });
|
|
53
|
+
output({ build: settingsOf(app) }, () => log.success(`Root directory set to ${app.rootDir ?? "project root"}. Run \`ezhst redeploy\` to apply it.`));
|
|
53
54
|
};
|
|
54
55
|
export const resetBuild = async (options) => {
|
|
55
56
|
const project = await resolveApp(options);
|
|
56
|
-
await saveSettings(project, {
|
|
57
|
+
const app = await saveSettings(project, { rootDir: "", dockerfile: "" });
|
|
58
|
+
output({ build: settingsOf(app) }, () => log.success("Build settings cleared. Set a Dockerfile before the next deploy."));
|
|
59
|
+
};
|
|
60
|
+
export const showDockerfile = async (options) => {
|
|
61
|
+
const project = await resolveApp(options);
|
|
62
|
+
output({ dockerfile: project.dockerfile }, () => {
|
|
63
|
+
if (!project.dockerfile) {
|
|
64
|
+
log.info("No Dockerfile set. Run `ezhst build dockerfile template` to list templates.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
process.stdout.write(`${project.dockerfile}\n`);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export const setDockerfile = async (options) => {
|
|
71
|
+
const project = await resolveApp(options);
|
|
72
|
+
const content = await readDockerfile(options.file);
|
|
73
|
+
const app = await saveSettings(project, { dockerfile: content });
|
|
74
|
+
output({ build: settingsOf(app) }, () => log.success("Dockerfile saved. Run `ezhst deploy` or `ezhst redeploy` to build with it."));
|
|
75
|
+
};
|
|
76
|
+
export const dockerfileTemplate = async (id, options) => {
|
|
77
|
+
const templates = await listTemplates();
|
|
78
|
+
if (!id) {
|
|
79
|
+
output({ templates: templates.map((template) => ({ id: template.id, label: template.label })) }, () => {
|
|
80
|
+
for (const template of templates) {
|
|
81
|
+
log.info(`${template.id.padEnd(8)} ${template.label}`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const template = templates.find((item) => item.id === id);
|
|
87
|
+
if (!template) {
|
|
88
|
+
return fail(`Unknown template ${id}. Available: ${templates.map((item) => item.id).join(", ")}`);
|
|
89
|
+
}
|
|
90
|
+
if (!options.apply) {
|
|
91
|
+
output({ template }, () => process.stdout.write(template.content));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const project = await resolveApp(options);
|
|
95
|
+
const app = await saveSettings(project, { dockerfile: template.content });
|
|
96
|
+
output({ build: settingsOf(app) }, () => log.success(`${template.label} Dockerfile saved. Review it with \`ezhst build dockerfile show\`.`));
|
|
97
|
+
};
|
|
98
|
+
export const ensureDockerfile = async (project) => {
|
|
99
|
+
if (project.dockerfile) {
|
|
100
|
+
return project;
|
|
101
|
+
}
|
|
102
|
+
const hint = "This app has no Dockerfile. Write one and run `ezhst build dockerfile set -f Dockerfile`, or start from a template with `ezhst build dockerfile template <id> --apply`.";
|
|
103
|
+
if (!isInteractive()) {
|
|
104
|
+
fail(hint);
|
|
105
|
+
}
|
|
106
|
+
const templates = await listTemplates();
|
|
107
|
+
const choice = await select({
|
|
108
|
+
message: "This app has no Dockerfile. Start from a template?",
|
|
109
|
+
choices: [...templates.map((template) => ({ name: template.label, value: template.id })), { name: "Cancel", value: "" }],
|
|
110
|
+
});
|
|
111
|
+
const template = templates.find((item) => item.id === choice);
|
|
112
|
+
if (!template) {
|
|
113
|
+
return fail(hint);
|
|
114
|
+
}
|
|
115
|
+
const app = await saveSettings(project, { dockerfile: template.content });
|
|
116
|
+
log.success(`${template.label} Dockerfile saved. Edit it later with \`ezhst build dockerfile set -f <file>\`.`);
|
|
117
|
+
return app;
|
|
57
118
|
};
|
package/dist/commands/db.js
CHANGED
|
@@ -17,7 +17,10 @@ export const databaseInfo = async (options) => {
|
|
|
17
17
|
const detail = await request(`/databases/${database.id}`, {}, project.id);
|
|
18
18
|
output(detail, () => {
|
|
19
19
|
const info = detail.database;
|
|
20
|
-
log.info(`${pc.bold(info.name)} ${pc.dim(`(${info.dbName}, ${formatBytes(info.sizeBytes)})`)}`);
|
|
20
|
+
log.info(`${pc.bold(info.name)} ${pc.dim(`(${info.dbName}, ${formatBytes(info.sizeBytes)} of ${formatBytes(info.limitBytes)} used)`)}`);
|
|
21
|
+
if (info.blocked) {
|
|
22
|
+
log.warn("Blocked: the database is over its size limit. Truncate or drop tables in the dashboard to free space.");
|
|
23
|
+
}
|
|
21
24
|
log.info(`DATABASE_URL: ${info.connectionString}`);
|
|
22
25
|
log.info(`SHADOW_DATABASE_URL: ${info.shadowConnectionString}`);
|
|
23
26
|
log.info(`Tables: ${detail.tables.length}`);
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdtempSync, openAsBlob,
|
|
1
|
+
import { existsSync, mkdtempSync, openAsBlob, 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";
|
|
@@ -7,7 +7,24 @@ import ora from "ora";
|
|
|
7
7
|
import { request } from "../lib/api.js";
|
|
8
8
|
import { resolveApp, resolveAppDetail } from "../lib/project.js";
|
|
9
9
|
import { fail, isJsonMode, log, output } from "../lib/ui.js";
|
|
10
|
-
|
|
10
|
+
import { ensureDockerfile } from "./build.js";
|
|
11
|
+
const IGNORED_DIRS = new Set([
|
|
12
|
+
"node_modules",
|
|
13
|
+
".next",
|
|
14
|
+
".git",
|
|
15
|
+
".vercel",
|
|
16
|
+
".turbo",
|
|
17
|
+
".swc",
|
|
18
|
+
"__pycache__",
|
|
19
|
+
".venv",
|
|
20
|
+
"venv",
|
|
21
|
+
".pytest_cache",
|
|
22
|
+
".mypy_cache",
|
|
23
|
+
"target",
|
|
24
|
+
"zig-out",
|
|
25
|
+
".zig-cache",
|
|
26
|
+
"zig-cache",
|
|
27
|
+
]);
|
|
11
28
|
const IGNORED_FILES = new Set([".DS_Store", ".easyhost.json"]);
|
|
12
29
|
const isIgnored = (entry) => {
|
|
13
30
|
const parts = entry.replace(/^\.\//, "").split("/");
|
|
@@ -20,16 +37,6 @@ const isIgnored = (entry) => {
|
|
|
20
37
|
}
|
|
21
38
|
return name.startsWith(".env") && name !== ".env.example";
|
|
22
39
|
};
|
|
23
|
-
const assertNodeProject = (cwd) => {
|
|
24
|
-
const pkgFile = path.join(cwd, "package.json");
|
|
25
|
-
if (!existsSync(pkgFile)) {
|
|
26
|
-
fail("No package.json found. Run this inside your Node.js app.");
|
|
27
|
-
}
|
|
28
|
-
const pkg = JSON.parse(readFileSync(pkgFile, "utf8"));
|
|
29
|
-
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg)) {
|
|
30
|
-
fail("package.json must contain a JSON object.");
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
40
|
const packSource = async (cwd) => {
|
|
34
41
|
const stage = mkdtempSync(path.join(tmpdir(), "easyhost-"));
|
|
35
42
|
const archive = path.join(stage, "app.tgz");
|
|
@@ -157,8 +164,7 @@ const finish = (project, deploymentId, url, result, cwd) => {
|
|
|
157
164
|
};
|
|
158
165
|
export const deploy = async (options) => {
|
|
159
166
|
const cwd = process.cwd();
|
|
160
|
-
|
|
161
|
-
const project = await resolveApp(options, true);
|
|
167
|
+
const project = await ensureDockerfile(await resolveApp(options, true));
|
|
162
168
|
log.info(`\nDeploying ${pc.bold(project.name)}\n`);
|
|
163
169
|
const { stage, archive } = await withSpinner("Packaging source", () => "Packaged source", () => packSource(cwd));
|
|
164
170
|
try {
|
|
@@ -38,7 +38,7 @@ export const renameProject = async (name, options) => {
|
|
|
38
38
|
};
|
|
39
39
|
export const deleteProject = async (options) => {
|
|
40
40
|
const project = await resolveProject(options);
|
|
41
|
-
confirmed(options.yes, `Deleting ${project.slug} removes all apps, deployments,
|
|
41
|
+
confirmed(options.yes, `Deleting ${project.slug} removes all apps, deployments, storage and database.`);
|
|
42
42
|
const result = await request(`/projects/${project.id}`, { method: "DELETE" });
|
|
43
43
|
output(result, () => log.success(`Deleted ${project.slug}`));
|
|
44
44
|
};
|
package/dist/commands/skill.js
CHANGED
|
@@ -46,7 +46,7 @@ export const installSkill = async (options) => {
|
|
|
46
46
|
mkdirSync(directory, { recursive: true });
|
|
47
47
|
copyFileSync(SKILL_SOURCE, target);
|
|
48
48
|
output({ agent: agentKey, scope, path: target }, () => {
|
|
49
|
-
log.success(`Installed the
|
|
50
|
-
log.info('Ask your agent: "Deploy this app to
|
|
49
|
+
log.success(`Installed the Reverhost skill for ${agent.name} at ${target}`);
|
|
50
|
+
log.info('Ask your agent: "Deploy this app to Reverhost."');
|
|
51
51
|
});
|
|
52
52
|
};
|
package/dist/commands/storage.js
CHANGED
|
@@ -6,12 +6,12 @@ import { resolveProject } from "../lib/project.js";
|
|
|
6
6
|
import { confirmed, fail, formatBytes, log, output } from "../lib/ui.js";
|
|
7
7
|
const findBucket = async (options) => {
|
|
8
8
|
const project = await resolveProject(options);
|
|
9
|
-
const { buckets } = await request("/storage/buckets", {}, project.id);
|
|
9
|
+
const { buckets, usedBytes, limitBytes } = await request("/storage/buckets", {}, project.id);
|
|
10
10
|
const bucket = buckets[0];
|
|
11
11
|
if (!bucket) {
|
|
12
12
|
return fail("This project has no storage yet. Create it with `ezhst storage create <name>`.");
|
|
13
13
|
}
|
|
14
|
-
return { project, bucket };
|
|
14
|
+
return { project, bucket, usedBytes, limitBytes };
|
|
15
15
|
};
|
|
16
16
|
const listObjects = async (projectId, bucketId, prefix = "") => {
|
|
17
17
|
const query = new URLSearchParams({ prefix });
|
|
@@ -28,9 +28,12 @@ const printCredentials = (bucket) => {
|
|
|
28
28
|
log.dim("Use path-style addressing (forcePathStyle: true).");
|
|
29
29
|
};
|
|
30
30
|
export const storageInfo = async (options) => {
|
|
31
|
-
const { project, bucket } = await findBucket(options);
|
|
31
|
+
const { project, bucket, usedBytes, limitBytes } = await findBucket(options);
|
|
32
32
|
const { bucket: detail } = await listObjects(project.id, bucket.id);
|
|
33
|
-
output({ bucket: detail }, () =>
|
|
33
|
+
output({ bucket: detail, usedBytes, limitBytes }, () => {
|
|
34
|
+
printCredentials(detail);
|
|
35
|
+
log.info(`Used: ${formatBytes(usedBytes)} of ${formatBytes(limitBytes)}`);
|
|
36
|
+
});
|
|
34
37
|
};
|
|
35
38
|
export const createStorage = async (name, options) => {
|
|
36
39
|
const project = await resolveProject(options);
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,16 @@ import { Command } from "commander";
|
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { forgotPassword, login, logout, register, resendVerification, verify, whoami } from "./commands/auth.js";
|
|
5
5
|
import { createApp, deleteApp, listApps } from "./commands/apps.js";
|
|
6
|
-
import { createSchedule, deleteSchedule, listSchedules, scheduleLogs, setScheduleState, updateSchedule } from "./commands/schedules.js";
|
|
7
6
|
import { createProject, deleteProject, link, listProjects, logs, projectInfo, renameProject, start, stop } from "./commands/projects.js";
|
|
8
7
|
import { deploy, deploymentLog, listDeployments, redeploy } from "./commands/deploy.js";
|
|
9
8
|
import { importEnv, listEnv, setEnv, unsetEnv } from "./commands/env.js";
|
|
10
|
-
import { resetBuild, setBuild, showBuild } from "./commands/build.js";
|
|
9
|
+
import { dockerfileTemplate, resetBuild, setBuild, setDockerfile, showBuild, showDockerfile } from "./commands/build.js";
|
|
11
10
|
import { addDomain, listDomains, removeDomain, verifyDomain } from "./commands/domains.js";
|
|
12
11
|
import { createStorage, deleteStorage, downloadStorage, listStorage, removeStorageObject, rotateStorageKeys, storageInfo, uploadStorage, } from "./commands/storage.js";
|
|
13
12
|
import { createDatabase, databaseInfo, deleteDatabase, queryDatabase, resetDatabasePassword, tableRows } from "./commands/db.js";
|
|
14
|
-
import { createSender, deleteSender, emailInfo, emailLogs, sendEmail } from "./commands/email.js";
|
|
15
|
-
import { createKey, listKeys, revokeKey } from "./commands/keys.js";
|
|
16
13
|
import { acceptInvite, inviteMember, leaveProject, listMembers, removeMember, revokeInvite } from "./commands/members.js";
|
|
17
14
|
import { installSkill } from "./commands/skill.js";
|
|
15
|
+
import { billingPortal, showBilling, upgradeBilling } from "./commands/billing.js";
|
|
18
16
|
import { fail, setJsonMode } from "./lib/ui.js";
|
|
19
17
|
const packageMetadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
20
18
|
if (!packageMetadata || typeof packageMetadata !== "object" || !("version" in packageMetadata) || typeof packageMetadata.version !== "string") {
|
|
@@ -23,7 +21,7 @@ if (!packageMetadata || typeof packageMetadata !== "object" || !("version" in pa
|
|
|
23
21
|
const program = new Command();
|
|
24
22
|
program
|
|
25
23
|
.name("ezhst")
|
|
26
|
-
.description("
|
|
24
|
+
.description("Reverhost from the terminal: deploy apps and manage storage and databases")
|
|
27
25
|
.version(packageMetadata.version)
|
|
28
26
|
.option("--json", "Print machine-readable JSON")
|
|
29
27
|
.hook("preAction", (_command, action) => {
|
|
@@ -63,7 +61,7 @@ scoped(projects.command("info").description("Show project details")).action(proj
|
|
|
63
61
|
scoped(projects.command("rename").description("Rename a project").argument("<name>")).action(renameProject);
|
|
64
62
|
scoped(projects.command("delete").description("Delete a project and everything in it").option("--yes", "Confirm")).action(deleteProject);
|
|
65
63
|
appScoped(program.command("link").description("Link the current folder to a project")).action(link);
|
|
66
|
-
appScoped(program.command("deploy").description("Upload and deploy the
|
|
64
|
+
appScoped(program.command("deploy").description("Upload and deploy the app in this folder").option("--verbose", "Stream the build log")).action(deploy);
|
|
67
65
|
appScoped(program.command("redeploy").description("Rebuild the latest upload").option("--verbose", "Stream the build log")).action(redeploy);
|
|
68
66
|
appScoped(program.command("start").description("Start a stopped app")).action(start);
|
|
69
67
|
appScoped(program.command("stop").description("Stop the running app")).action(stop);
|
|
@@ -76,41 +74,31 @@ appScoped(env.command("list").description("List variables")).action(listEnv);
|
|
|
76
74
|
appScoped(env.command("set").description("Set variables").argument("<pairs...>", "KEY=VALUE pairs")).action(setEnv);
|
|
77
75
|
appScoped(env.command("unset").description("Remove variables").argument("<keys...>")).action(unsetEnv);
|
|
78
76
|
appScoped(env.command("import").description("Merge variables from a .env file").argument("<file>")).action(importEnv);
|
|
79
|
-
const build = program.command("build").description("Build settings
|
|
80
|
-
appScoped(build.command("show").description("Show
|
|
81
|
-
appScoped(build
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
.
|
|
89
|
-
|
|
77
|
+
const build = program.command("build").description("Build settings: root directory and the Dockerfile every deploy builds with");
|
|
78
|
+
appScoped(build.command("show").description("Show the root directory and Dockerfile")).action(showBuild);
|
|
79
|
+
appScoped(build.command("set").description("Change the root directory (build context)").option("--root-dir <dir>", 'Folder with the app, relative to the project root ("" for the root)')).action(setBuild);
|
|
80
|
+
appScoped(build.command("reset").description("Clear the root directory and Dockerfile")).action(resetBuild);
|
|
81
|
+
const dockerfile = build.command("dockerfile").description("The Dockerfile stored on the app (a Dockerfile in your repo is ignored)");
|
|
82
|
+
appScoped(dockerfile.command("show").description("Print the Dockerfile")).action(showDockerfile);
|
|
83
|
+
appScoped(dockerfile.command("set").description("Save a Dockerfile").requiredOption("-f, --file <path>", 'Dockerfile to upload ("-" reads stdin)')).action(setDockerfile);
|
|
84
|
+
appScoped(dockerfile
|
|
85
|
+
.command("template")
|
|
86
|
+
.description("List templates, print one, or save one with --apply")
|
|
87
|
+
.argument("[id]", "node, bun, python, go, ruby, php, rust or zig")
|
|
88
|
+
.option("--apply", "Save the template as the app's Dockerfile")).action(dockerfileTemplate);
|
|
90
89
|
const domains = program.command("domains").description("Custom domains");
|
|
91
90
|
appScoped(domains.command("list").description("List domains and the DNS target")).action(listDomains);
|
|
92
91
|
appScoped(domains.command("add").description("Add a domain").argument("<hostname>")).action(addDomain);
|
|
93
92
|
appScoped(domains.command("verify").description("Check DNS and issue HTTPS").argument("<hostname>")).action(verifyDomain);
|
|
94
93
|
appScoped(domains.command("remove").description("Remove a domain").argument("<hostname>")).action(removeDomain);
|
|
95
|
-
const apps = program.command("apps").description("Manage
|
|
94
|
+
const apps = program.command("apps").description("Manage the apps in a project (2 per project)");
|
|
96
95
|
scoped(apps.command("list").description("List apps in a project")).action(listApps);
|
|
97
96
|
scoped(apps.command("create").description("Create an app").argument("<name>")).action(createApp);
|
|
98
97
|
appScoped(apps.command("delete").description("Delete one app and its deployments").option("--yes", "Confirm")).action(deleteApp);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
.option("--every <minutes>", "Interval in minutes, 1 to 43200")
|
|
104
|
-
.option("--method <method>", "HTTP method")
|
|
105
|
-
.option("--headers <json>", "Headers as a JSON object")
|
|
106
|
-
.option("--body <text>", "Request body")
|
|
107
|
-
.option("--paused", "Save the schedule paused");
|
|
108
|
-
scheduleOptions(schedules.command("create").description("Create a schedule").argument("<name>")).action(createSchedule);
|
|
109
|
-
scheduleOptions(schedules.command("update").description("Edit a schedule").argument("<id>").option("--name <name>")).action(updateSchedule);
|
|
110
|
-
scoped(schedules.command("pause").description("Pause a schedule").argument("<id>")).action((id, options) => setScheduleState(id, false, options));
|
|
111
|
-
scoped(schedules.command("resume").description("Resume a schedule").argument("<id>")).action((id, options) => setScheduleState(id, true, options));
|
|
112
|
-
scoped(schedules.command("logs").description("Show recent runs").argument("<id>")).action(scheduleLogs);
|
|
113
|
-
scoped(schedules.command("delete").description("Delete a schedule").argument("<id>").option("--yes", "Confirm")).action(deleteSchedule);
|
|
98
|
+
const billing = program.command("billing").description("Plan, usage and the Pro subscription");
|
|
99
|
+
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 ($10/mo)").action(upgradeBilling);
|
|
101
|
+
billing.command("portal").description("Print the link to manage or cancel your subscription").action(billingPortal);
|
|
114
102
|
const storage = program.command("storage").description("S3 compatible storage");
|
|
115
103
|
scoped(storage.command("info").description("Show the bucket and S3 credentials")).action(storageInfo);
|
|
116
104
|
scoped(storage.command("create").description("Create the project's bucket").argument("<name>")).action(createStorage);
|
|
@@ -127,24 +115,6 @@ scoped(db.command("query").description("Run SQL").argument("[sql]").option("--fi
|
|
|
127
115
|
scoped(db.command("rows").description("Browse a table").argument("<table>").option("--page <n>", "Page", "1")).action(tableRows);
|
|
128
116
|
scoped(db.command("reset-password").description("Rotate the database password")).action(resetDatabasePassword);
|
|
129
117
|
scoped(db.command("delete").description("Delete the database and its data").option("--yes", "Confirm")).action(deleteDatabase);
|
|
130
|
-
const email = program.command("email", { hidden: true }).description("Transactional email (coming soon)");
|
|
131
|
-
scoped(email.command("info").description("Show the sender address and usage")).action(emailInfo);
|
|
132
|
-
const sender = email.command("sender").description("Sender address");
|
|
133
|
-
scoped(sender.command("create").description("Create <username>@easyhost.fun").argument("<username>")).action(createSender);
|
|
134
|
-
scoped(sender.command("delete").description("Delete the sender address")).action(deleteSender);
|
|
135
|
-
scoped(email
|
|
136
|
-
.command("send")
|
|
137
|
-
.description("Send an email")
|
|
138
|
-
.option("--from <address>")
|
|
139
|
-
.option("--to <addresses...>")
|
|
140
|
-
.option("--subject <text>")
|
|
141
|
-
.option("--text <body>")
|
|
142
|
-
.option("--html <html>")).action(sendEmail);
|
|
143
|
-
scoped(email.command("logs").description("Show sent emails").option("--page <n>", "Page", "1")).action(emailLogs);
|
|
144
|
-
const keys = program.command("keys", { hidden: true }).description("API keys for the HTTP API");
|
|
145
|
-
scoped(keys.command("list").description("List API keys")).action(listKeys);
|
|
146
|
-
scoped(keys.command("create").description("Create an API key").argument("<name>")).action(createKey);
|
|
147
|
-
scoped(keys.command("revoke").description("Revoke an API key").argument("<id>")).action(revokeKey);
|
|
148
118
|
const members = program.command("members").description("Project members and invites");
|
|
149
119
|
scoped(members.command("list").description("List the owner, members and pending invites")).action(listMembers);
|
|
150
120
|
scoped(members.command("invite").description("Invite someone by email (owner only)").argument("<email>")).action(inviteMember);
|
|
@@ -155,7 +125,7 @@ program.command("accept-invite").description("Accept a project invite").argument
|
|
|
155
125
|
const skill = program.command("skill").description("Agent skill");
|
|
156
126
|
skill
|
|
157
127
|
.command("install")
|
|
158
|
-
.description("Install the
|
|
128
|
+
.description("Install the Reverhost agent skill")
|
|
159
129
|
.option("--agent <agent>", "Target agent: claude, codex or cursor")
|
|
160
130
|
.option("--global", "Install to the agent's home skills folder for all projects")
|
|
161
131
|
.option("--local", "Install to the agent's skills folder in the current project")
|
package/dist/lib/api.js
CHANGED
|
@@ -32,14 +32,11 @@ export const request = async (pathname, init = {}, projectId) => {
|
|
|
32
32
|
if (data.code === "EMAIL_NOT_VERIFIED") {
|
|
33
33
|
throw new ApiError("Your email is not verified. Run `ezhst verify <code>` with the 6-digit code from your inbox, or `ezhst resend-verification` to get a new code.", res.status);
|
|
34
34
|
}
|
|
35
|
-
if (data.code === "EMAIL_COMING_SOON") {
|
|
36
|
-
throw new ApiError("Email is coming soon. It is not available on EasyHost yet.", res.status);
|
|
37
|
-
}
|
|
38
35
|
if (typeof data.error === "string") {
|
|
39
36
|
throw new ApiError(data.error, res.status);
|
|
40
37
|
}
|
|
41
38
|
if (res.status >= 500) {
|
|
42
|
-
throw new ApiError(`
|
|
39
|
+
throw new ApiError(`Reverhost is having trouble right now (status ${res.status}). Try again in a minute.`, res.status);
|
|
43
40
|
}
|
|
44
41
|
throw new ApiError(`Request failed with status ${res.status}.`, res.status);
|
|
45
42
|
}
|
package/dist/lib/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
const CONFIG_DIR = path.join(homedir(), ".easyhost");
|
|
5
5
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
6
6
|
const PROJECT_FILE = ".easyhost.json";
|
|
7
|
-
const PRODUCTION_API_URL = "https://api.
|
|
7
|
+
const PRODUCTION_API_URL = "https://api.reverhost.com";
|
|
8
8
|
export const readConfig = () => {
|
|
9
9
|
let config = { apiUrl: PRODUCTION_API_URL };
|
|
10
10
|
if (existsSync(CONFIG_FILE)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezhst",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "Reverhost CLI: agent-first hosting for Node.js apps with storage and databases",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ezhst": "dist/index.js"
|
package/skill/SKILL.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: easyhost
|
|
3
|
-
description: Deploy and manage apps on
|
|
3
|
+
description: 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.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Reverhost
|
|
7
7
|
|
|
8
|
-
|
|
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. Run it with `npx ezhst <command>` (or `ezhst` if installed globally with `npm i -g ezhst`).
|
|
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 `.easyhost.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`, `
|
|
16
|
-
- Never print secrets (passwords, S3 secret keys,
|
|
15
|
+
- Destructive commands (`projects delete`, `apps delete`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
|
|
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
|
|
@@ -26,7 +26,7 @@ Check first: `npx ezhst whoami --json`. If it fails with "Not logged in":
|
|
|
26
26
|
|
|
27
27
|
## 2. Pick or create a project
|
|
28
28
|
|
|
29
|
-
A project contains up to
|
|
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
32
|
npx ezhst projects list --json
|
|
@@ -36,12 +36,19 @@ npx ezhst link --project <slug> --json
|
|
|
36
36
|
|
|
37
37
|
## 3. Deploy
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Every app builds from a Dockerfile stored on the app (a Dockerfile in the repo is ignored, so upload it explicitly). Run inside the app folder:
|
|
40
|
+
|
|
41
|
+
1. Inspect the repo and write a `Dockerfile` (start from `npx ezhst build dockerfile template <id>`; ids: node, bun, python, go, ruby, php, rust, zig).
|
|
42
|
+
2. The app must listen on `0.0.0.0` and `$PORT` (3000).
|
|
43
|
+
3. 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`.
|
|
44
|
+
4. Keep the image under 1 GB (slim bases, multi-stage builds for compiled languages). Containers get 256 MB of memory and half a CPU.
|
|
45
|
+
5. Do not use `# syntax=` lines or images from the Reverhost registry; they are rejected.
|
|
40
46
|
|
|
41
47
|
```
|
|
42
48
|
npx ezhst apps create <name> --project <project-slug> --json
|
|
43
49
|
npx ezhst link --project <project-slug> --app <app-slug> --json
|
|
44
50
|
npx ezhst env import .env --json
|
|
51
|
+
npx ezhst build dockerfile set -f Dockerfile --json
|
|
45
52
|
npx ezhst deploy --json
|
|
46
53
|
```
|
|
47
54
|
|
|
@@ -55,7 +62,9 @@ Common fixes:
|
|
|
55
62
|
- Missing env var at build time: `ezhst env set KEY=VALUE`, then `ezhst redeploy`.
|
|
56
63
|
- `npm ci` says the lockfile is out of sync: delete `node_modules` and `package-lock.json`, run `npm install`, deploy again.
|
|
57
64
|
- Monorepo: `ezhst build set --root-dir apps/web`.
|
|
58
|
-
-
|
|
65
|
+
- Build fails: fix the Dockerfile, `ezhst build dockerfile set -f Dockerfile`, then `ezhst redeploy` (rebuilds the last upload, even a failed one).
|
|
66
|
+
- App starts but the URL fails: it is not listening on `0.0.0.0:$PORT`.
|
|
67
|
+
- Daily build limit reached (10 per day on Free, 50 on Pro): wait or upgrade; do not loop deploys.
|
|
59
68
|
|
|
60
69
|
After changing env vars or build settings, run `npx ezhst redeploy --json` (rebuilds the last upload). After changing code, run `deploy` again.
|
|
61
70
|
|
|
@@ -70,8 +79,8 @@ Projects and runtime:
|
|
|
70
79
|
|
|
71
80
|
Environment and build:
|
|
72
81
|
- `env list | set KEY=VALUE... | unset KEY... | import <file>`
|
|
73
|
-
- `build show`, `build set
|
|
74
|
-
-
|
|
82
|
+
- `build show`, `build set --root-dir <dir>` (build context, `""` for the project root), `build reset`
|
|
83
|
+
- `build dockerfile show`, `build dockerfile set -f <file>` (`-` reads stdin), `build dockerfile template [id] [--apply]`
|
|
75
84
|
|
|
76
85
|
Custom domains:
|
|
77
86
|
- `domains list | add <hostname> | verify <hostname> | remove <hostname>`
|
|
@@ -79,21 +88,13 @@ Custom domains:
|
|
|
79
88
|
|
|
80
89
|
Storage (S3 compatible, one bucket per project, files are public by URL):
|
|
81
90
|
- `storage create <name> | info | rotate-keys | ls [prefix] | upload <files...> [--prefix dir/] | download <key> [output] | rm <key> | delete --yes`
|
|
82
|
-
- In app code use any S3 client with endpoint `https://storage.
|
|
91
|
+
- 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>`.
|
|
83
92
|
- Typical setup: `storage create files`, then `env set S3_ENDPOINT=... S3_BUCKET=... S3_ACCESS_KEY_ID=... S3_SECRET_ACCESS_KEY=...` from `storage info --json`.
|
|
84
93
|
|
|
85
94
|
Database (Postgres, one per project):
|
|
86
95
|
- `db create <name> | info | query "<sql>" | query --file <file.sql> | rows <table> [--page n] | reset-password | delete --yes`
|
|
87
96
|
- `db info --json` returns `connectionString` and `shadowConnectionString` (for `prisma migrate dev`). Set `DATABASE_URL` with `env set`, and run migrations from the local machine against it (for Prisma: `prisma migrate deploy`).
|
|
88
97
|
|
|
89
|
-
Email: coming soon. The `email` commands and the email API return "Email is coming soon." Do not set up or send email on EasyHost yet.
|
|
90
|
-
|
|
91
|
-
Schedules (up to five per project, intervals in minutes):
|
|
92
|
-
- `schedules list`, `schedules create <name> --url <url> --every <minutes> [--method POST] [--headers '<json>'] [--body '<text>'] [--paused]`
|
|
93
|
-
- `schedules update <id> [--name <name>] [--url <url>] [--every <minutes>] [--method <method>] [--headers '<json>'] [--body '<text>']`
|
|
94
|
-
- `schedules pause <id>`, `schedules resume <id>`, `schedules logs <id>`, `schedules delete <id> --yes`
|
|
95
|
-
- Public HTTP/HTTPS URLs only, intervals 1 to 43200 minutes, 30-second timeout, no redirects. First call follows one interval; saving/resuming restarts it. Latest 100 runs retained, latest 10 shown. Missed intervals are skipped; execution has up to 10 seconds of polling delay. Requests in progress may finish after pausing/deleting.
|
|
96
|
-
|
|
97
98
|
Members:
|
|
98
99
|
- `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.
|
|
99
100
|
- `accept-invite <link-or-token>` joins a project. The logged-in email must match the invited email.
|
|
@@ -101,10 +102,14 @@ Members:
|
|
|
101
102
|
Account:
|
|
102
103
|
- `whoami`, `logout`, `verify <code>`, `resend-verification`, `forgot-password --email <email>`
|
|
103
104
|
- 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).
|
|
104
|
-
- Limit errors ("You can have
|
|
105
|
+
- 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.
|
|
106
|
+
- "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.
|
|
107
|
+
|
|
108
|
+
Billing:
|
|
109
|
+
- `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 or cancel.
|
|
105
110
|
|
|
106
111
|
## Limits
|
|
107
112
|
|
|
108
|
-
Free: 3 projects. Per project:
|
|
113
|
+
Free: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to 1,000 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.
|
|
109
114
|
|
|
110
|
-
Docs: https://
|
|
115
|
+
Docs: https://reverhost.com/docs
|