Aligns with the warehack-ing host convention (matches birdcage-docs):
Dockerfile — multi-stage with named targets:
base shared npm ci + COPY
dev npx astro dev --host 0.0.0.0 --port 4321 (HMR enabled)
build npx astro build (produces /app/dist)
prod caddy:2-alpine serves /srv with /health probe + HEALTHCHECK
docker-compose.yml — picks the target via APP_ENV in .env:
build.target = ${APP_ENV:-dev}
caddy.reverse_proxy upstream port = ${APP_PORT:-4321}
Adds the streaming/HMR caddy labels CLAUDE.md requires for Vite-over-
Caddy: flush_interval=-1, transport.read/write_timeout=0, keepalive,
stream_timeout=24h, stream_close_delay=5s
Volume mounts ./src, ./public, astro.config.mjs (live in dev, harmless
in prod since the prod stage doesn't reference /app)
astro.config.mjs — vite.server.hmr block now picks up VITE_HMR_HOST
env var and configures host/protocol/clientPort for wss-on-443 HMR
through Caddy. Falls back to undefined when unset so plain
'npm run dev' still works.
Caddyfile — adds /health endpoint for the Dockerfile HEALTHCHECK,
SPA-style try_files fallback chain (path -> path/index.html -> /index.html).
Makefile — adds 'make dev' / 'make prod' that rewrite APP_ENV+APP_PORT
in .env then rebuild. Tail-logs after up/restart so you see startup
diagnostics without a separate 'make logs'.
.env.example — five vars (COMPOSE_PROJECT_NAME, APP_ENV, APP_PORT,
PUBLIC_DOMAIN, VITE_HMR_HOST), defaulting to prod mode against the
public hai-omni-pro-ii.warehack.ing domain. .env stays gitignored so
each environment (local, remote) can override.
Local container rebuilt + recreated, healthy, /health returns 200,
PUBLIC_DOMAIN locally still set to .l.warehack.ing in the host .env.
101 lines
2.7 KiB
JavaScript
101 lines
2.7 KiB
JavaScript
// @ts-check
|
|
import { defineConfig } from 'astro/config';
|
|
import starlight from '@astrojs/starlight';
|
|
import icon from 'astro-icon';
|
|
|
|
// https://astro.build/config
|
|
export default defineConfig({
|
|
site: 'https://hai-omni-pro-ii.l.warehack.ing',
|
|
telemetry: false,
|
|
devToolbar: { enabled: false },
|
|
integrations: [
|
|
icon({
|
|
include: {
|
|
lucide: ['*'],
|
|
},
|
|
}),
|
|
starlight({
|
|
title: 'HAI Omni Pro II — omni-pca docs',
|
|
description:
|
|
'Reverse-engineered Python library and Home Assistant integration for HAI/Leviton Omni Pro II home automation panels.',
|
|
logo: {
|
|
src: './src/assets/logo.svg',
|
|
replacesTitle: false,
|
|
},
|
|
favicon: '/favicon.svg',
|
|
customCss: ['./src/styles/theme.css'],
|
|
social: [
|
|
{
|
|
icon: 'github',
|
|
label: 'GitHub',
|
|
href: 'https://git.supported.systems/warehack.ing/omni-pca',
|
|
},
|
|
],
|
|
editLink: {
|
|
// Placeholder — update once the docs repo lives somewhere on GitHub.
|
|
baseUrl: 'https://git.supported.systems/warehack.ing/omni-pca-docs/edit/main/',
|
|
},
|
|
lastUpdated: true,
|
|
pagination: true,
|
|
sidebar: [
|
|
{
|
|
label: 'Start here',
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'Overview', slug: '' },
|
|
{ label: 'Quick start', slug: 'start/quickstart' },
|
|
],
|
|
},
|
|
{
|
|
label: 'Tutorials',
|
|
collapsed: true,
|
|
items: [{ autogenerate: { directory: 'tutorials' } }],
|
|
},
|
|
{
|
|
label: 'How-to guides',
|
|
collapsed: true,
|
|
items: [{ autogenerate: { directory: 'how-to' } }],
|
|
},
|
|
{
|
|
label: 'Reference',
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'Protocol', slug: 'reference/protocol' },
|
|
{ label: 'File format', slug: 'reference/file-format' },
|
|
{ label: 'Library API', slug: 'reference/library-api' },
|
|
{ label: 'HA entities', slug: 'reference/ha-entities' },
|
|
{ label: 'HA services', slug: 'reference/ha-services' },
|
|
],
|
|
},
|
|
{
|
|
label: 'Explanation',
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'Two non-public quirks', slug: 'explanation/quirks' },
|
|
{ label: 'Architecture', slug: 'explanation/architecture' },
|
|
{ label: 'The PC Access bug', slug: 'explanation/pc-access-bug' },
|
|
],
|
|
},
|
|
{ label: 'Journey', slug: 'journey' },
|
|
{ label: 'Changelog', slug: 'changelog' },
|
|
],
|
|
}),
|
|
],
|
|
vite: {
|
|
server: {
|
|
host: '0.0.0.0',
|
|
// HMR behind Caddy reverse proxy: explicit hostname + wss + 443
|
|
// (per CLAUDE.md "HMR Behind Reverse Proxy" section). Falls
|
|
// back to defaults when no VITE_HMR_HOST env var is set so
|
|
// `npm run dev` outside Docker still works.
|
|
hmr: process.env.VITE_HMR_HOST
|
|
? {
|
|
host: process.env.VITE_HMR_HOST,
|
|
protocol: 'wss',
|
|
clientPort: 443,
|
|
}
|
|
: undefined,
|
|
},
|
|
},
|
|
});
|