The backend image now builds the SPA and serves it on the API's own origin (fluksio/spa.py), so an instance is a single container with no proxy, DNS, port 80 or .env: `docker compose up -d` with the new compose.yml runs it on localhost:8080. It starts on fluksio serve (persisted secret key, first admin printed once) and brings its own Redis when REDIS_HOST is unset. Slimmer: python:3.13-slim, no dev group, uv once, fastapi without the cloud CLI. Optional features are per-feature extras (mqtt, influx, email, sentry, ml, server for all) picked with the EXTRAS build argument; numpy moved to `ml`. ffmpeg left the image for imageio-ffmpeg via the Modules screen. The operator stack runs the same image with app. and api. routed to it; the nginx frontend service, the LAN nginx proxy and DOMAIN in the backend are gone, and the MCP issuer is FRONTEND_HOST.
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import path from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
import dotenv from "dotenv"
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
dotenv.config({ path: path.join(__dirname, "../../.env") })
|
|
|
|
function getEnvVar(name: string): string {
|
|
const value = process.env[name]
|
|
if (!value) {
|
|
throw new Error(`Environment variable ${name} is undefined`)
|
|
}
|
|
return value
|
|
}
|
|
|
|
export const firstSuperuser = getEnvVar("FIRST_SUPERUSER")
|
|
export const firstSuperuserPassword = getEnvVar("FIRST_SUPERUSER_PASSWORD")
|
|
|
|
/**
|
|
* The two origins a run talks to: the app in the browser, and the API for the
|
|
* setup and teardown around a spec.
|
|
*
|
|
* Deliberately *not* taken from `VITE_API_URL`, even though `../../.env` above
|
|
* has one. That variable belongs to the app build, and in a checkout configured
|
|
* for a deployment it names the deployment — so a suite reading it would drive
|
|
* a browser at the local stack while sending its `DELETE`s to the live
|
|
* instance. Both origins come from the same place instead: whatever the browser
|
|
* is pointed at is what teardown may write to.
|
|
*/
|
|
export const appUrl =
|
|
process.env.PLAYWRIGHT_BASE_URL || "http://app.test.localhost"
|
|
|
|
/** The API is a path on the origin that serves the dashboard. */
|
|
export const apiUrl = process.env.PLAYWRIGHT_API_URL || new URL(appUrl).origin
|