dev/start.ts was checked by hand: musique starting alone on a fresh database, an unknown name refused, a taken port stopping both servers, and Ctrl+C or SIGTERM leaving no server behind. The compose project couldn't be run here (no Docker in the workspace): its YAML parses and resolves as intended, but it is untested; tsc, eslint, deno check, deno fmt, deno lint and doc:lint, which now covers dev/, are clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
/**
|
|
* Lists the dev instances of gerbeur, each an API server and a Vite server of
|
|
* its own, run side by side so that federated sign-in between instances can be
|
|
* tried on one machine. In the devcontainer each is a service of
|
|
* `.devcontainer/compose.yaml`, which starts with it; outside, `deno task dev`
|
|
* starts them all, or `deno task dev <name>…` those named. Both run
|
|
* `dev/start.ts`. A new instance is an entry here, and a service there.
|
|
*
|
|
* Every instance follows the same rule, which `start.ts` applies:
|
|
*
|
|
* - its API at `http://localhost:<apiPort>`, its pages at
|
|
* `http://localhost:<webPort>`;
|
|
* - its database at `api/sql/<name>.db`, its uploads under
|
|
* `api/uploads/<name>/`;
|
|
* - the base `.env` for everything else, `env` overriding it.
|
|
*
|
|
* A new database starts with the user `admin` / `admin`. The instances may
|
|
* reach each other over http on localhost; whether one trusts another is up to
|
|
* its admin, on `/manage`.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/** One instance of {@link INSTANCES}. */
|
|
export interface DevInstance {
|
|
/**
|
|
* Names its database and uploads, and prefixes its output. Lowercase
|
|
* letters, digits and hyphens.
|
|
*/
|
|
name: string;
|
|
/** The port of its API server, `GERBEUR_PORT`. */
|
|
apiPort: number;
|
|
/** The port of its Vite server, where its pages are. */
|
|
webPort: number;
|
|
/**
|
|
* `GERBEUR_*` settings of its own, over the base `.env`: a site name, an
|
|
* emoji or a style, to tell the instances apart.
|
|
*/
|
|
env?: Record<string, string>;
|
|
}
|
|
|
|
/**
|
|
* The instances `deno task dev` starts, in this order. The first keeps the
|
|
* ports the single dev server always had.
|
|
*/
|
|
export const INSTANCES: readonly DevInstance[] = [
|
|
{ name: "gerbeur", apiPort: 8000, webPort: 3000 },
|
|
{
|
|
name: "musique",
|
|
apiPort: 8001,
|
|
webPort: 3001,
|
|
env: {
|
|
GERBEUR_SITE_NAME: "musique",
|
|
GERBEUR_SITE_EMOJI: "🎵",
|
|
GERBEUR_DEFAULT_STYLE: "kanagawa",
|
|
},
|
|
},
|
|
];
|