| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** The framework-integration package that drives the Octane build. */ |
| 5 | export const OCTANE_FRAMEWORK_SPECIFIER = |
| 6 | "@alchemy.run/frontend-frameworks/octane"; |
| 7 | |
| 8 | /** The Node container deploy target for the Octane build. */ |
| 9 | export const OCTANE_NODE_TARGET_SPECIFIER = |
| 10 | "@alchemy.run/frontend-frameworks/octane/node"; |
| 11 | |
| 12 | export interface OctaneProps extends FrameworkSiteProps {} |
| 13 | |
| 14 | /** |
| 15 | * Deploy an [OctaneJS](https://octanejs.dev) application to a Hetzner |
| 16 | * Cloud Server: Octane's SSR server as a systemd unit on port 3000, |
| 17 | * static assets baked into the unit. |
| 18 | * |
| 19 | * `Hetzner.Website.Octane` selects hosting and automatically wraps Octane's |
| 20 | * default native Node output. Keep compiler and route settings in |
| 21 | * `octane.config.ts` without an adapter. The legacy Node marker adapter |
| 22 | * remains optional for existing projects. |
| 23 | * |
| 24 | * ### Creating Octane Sites |
| 25 | * **Example:** Basic Octane App |
| 26 | * ```typescript |
| 27 | * const site = yield* Hetzner.Website.Octane("Web", { |
| 28 | * rootDir: "./app", |
| 29 | * }); |
| 30 | * ``` |
| 31 | * |
| 32 | * **Example:** Custom Domain |
| 33 | * ```typescript |
| 34 | * const site = yield* Hetzner.Website.Octane("Web", { |
| 35 | * rootDir: "./app", |
| 36 | * domain: "app.example.com", |
| 37 | * zone, |
| 38 | * }); |
| 39 | * ``` |
| 40 | * |
| 41 | * @resource |
| 42 | * @product Website |
| 43 | */ |
| 44 | export const Octane = (id: string, props: OctaneProps = {}) => |
| 45 | makeFrameworkSite(id, props, { |
| 46 | name: "Octane", |
| 47 | framework: OCTANE_FRAMEWORK_SPECIFIER, |
| 48 | target: OCTANE_NODE_TARGET_SPECIFIER, |
| 49 | }).pipe(Namespace.push(id)); |