create-archlast-forge 0.1.0 → 0.2.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/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -66,7 +66,7 @@ export async function gather(flags: Flags, interactive: boolean, io: Io = {}): P
|
|
|
66
66
|
? await ask<StackService[]>((o) =>
|
|
67
67
|
p.multiselect<StackService>({
|
|
68
68
|
...o,
|
|
69
|
-
message:
|
|
69
|
+
message: "Which services will production need? (space selects, enter confirms; none keeps SQLite, with no database container)",
|
|
70
70
|
required: false,
|
|
71
71
|
initialValues: DEFAULT_SERVICES[mode],
|
|
72
72
|
options: (Object.keys(SERVICES) as StackService[]).map((s) => ({ value: s, label: SERVICES[s].label, hint: SERVICES[s].hint })),
|
package/src/options.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const USAGE = `Usage: bun create archlast-forge [directory] [options]
|
|
|
22
22
|
-y, --yes take the default for everything not given, and ask nothing
|
|
23
23
|
-h, --help
|
|
24
24
|
|
|
25
|
-
Without options you are asked. Defaults: framework mode with
|
|
25
|
+
Without options you are asked. Defaults: framework mode with postgres, redis, s3 and caddy;
|
|
26
26
|
backend mode with postgres, redis and s3.`;
|
|
27
27
|
|
|
28
28
|
export function parseFlags(argv: string[]): Flags {
|
package/src/stack.ts
CHANGED
|
@@ -16,8 +16,8 @@ export const SERVICES = {
|
|
|
16
16
|
} as const;
|
|
17
17
|
export type StackService = keyof typeof SERVICES;
|
|
18
18
|
|
|
19
|
-
/** Services a mode starts with.
|
|
20
|
-
export const DEFAULT_SERVICES: Record<Mode, StackService[]> = { framework: [], backend: ["postgres", "redis", "s3"] };
|
|
19
|
+
/** Services a mode starts with: what a production deployment needs. An app gets HTTPS too; a backend is usually put behind a proxy of its own. */
|
|
20
|
+
export const DEFAULT_SERVICES: Record<Mode, StackService[]> = { framework: ["postgres", "redis", "s3", "caddy"], backend: ["postgres", "redis", "s3"] };
|
|
21
21
|
|
|
22
22
|
/** archlast-forge.json */
|
|
23
23
|
export interface ProjectConfig {
|
|
@@ -74,9 +74,10 @@ export function renderEnv(services: StackService[], secrets?: Secrets): string {
|
|
|
74
74
|
"# Opens the dashboard (/_dashboard) and the CLI's data commands.",
|
|
75
75
|
`ADMIN_KEY=${v("ADMIN_KEY")}`,
|
|
76
76
|
"",
|
|
77
|
-
|
|
78
|
-
has("caddy")
|
|
79
|
-
|
|
77
|
+
// DOMAIN comes first: Compose fills ${DOMAIN} only from lines above the one that uses it.
|
|
78
|
+
...(has("caddy")
|
|
79
|
+
? ["# Your domain; point its DNS (and s3.<domain>) at this machine.", "DOMAIN=localhost", "", "# The address people use to reach the app.", "BETTER_AUTH_URL=https://${DOMAIN}"]
|
|
80
|
+
: ["# The address people use to reach the app.", "BETTER_AUTH_URL=http://localhost:3000", "# Plain http is only for trying things out; remove this once BETTER_AUTH_URL is https.", "ALLOW_INSECURE_HTTP=1", "PORT=3000"]),
|
|
80
81
|
];
|
|
81
82
|
if (has("postgres")) lines.push("", "POSTGRES_PASSWORD=" + v("POSTGRES_PASSWORD"));
|
|
82
83
|
if (has("s3")) lines.push("", `S3_ACCESS_KEY=${v("S3_ACCESS_KEY")}`, `S3_SECRET_KEY=${v("S3_SECRET_KEY")}`, "# Where browsers upload to and download from.", has("caddy") ? "S3_PUBLIC_ENDPOINT=https://s3.${DOMAIN}" : "S3_PUBLIC_ENDPOINT=http://localhost:9000");
|
|
@@ -36,4 +36,4 @@ bun run logs
|
|
|
36
36
|
bun run down # stops it; data stays in Docker volumes
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`compose.yaml` is the stack. It is yours to edit. Secrets live in `.env`, which `
|
|
39
|
+
`compose.yaml` is the stack. It is yours to edit. Secrets live in `.env`, which `init` created with fresh keys and git ignores (`up` makes one only if it's missing); `.env.example` lists the keys. To put it on a server, copy the project there and run `bun run up` (or `docker compose up -d --build`).
|
|
@@ -7,6 +7,8 @@ bun install
|
|
|
7
7
|
bun run dev # http://localhost:3000, reloading as you edit
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
`dev` starts the services in `archlast-forge.json` (PostgreSQL, Redis, S3 storage) in Docker. `bun run dev -- --no-docker` skips them and uses SQLite.
|
|
11
|
+
|
|
10
12
|
## Where things are
|
|
11
13
|
|
|
12
14
|
```
|
|
@@ -30,4 +32,6 @@ bun run up # builds the image, starts the stack from compose.yaml, waits u
|
|
|
30
32
|
bun run down
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
`
|
|
35
|
+
`compose.yaml` runs the app with PostgreSQL, Redis, S3 storage (RustFS) and Caddy, which serves HTTPS on ports 80 and 443. Before the first real deploy, open `.env` and set `DOMAIN` to your domain, and point its DNS and `s3.<domain>` at the machine. Caddy then gets the certificates itself.
|
|
36
|
+
|
|
37
|
+
`bun run build && bun run start` runs the production bundles on this machine without Docker. `compose.yaml` is yours to edit; secrets are in `.env`, which `init` created with fresh keys and git ignores (`up` makes one only if it's missing).
|