Migrate to warehack.ing deployment convention

Single compose file with profiles, standardized Makefile targets,
.dockerignore for lean builds, production domain mcnanovna.warehack.ing.
This commit is contained in:
Ryan Malloy 2026-03-06 18:19:29 -07:00
parent 5edac3007c
commit 6314313e1f
6 changed files with 56 additions and 87 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
node_modules
dist
.git
.env
*.md

View File

@ -1,8 +1,3 @@
# Project identifier (prevents container name collisions)
COMPOSE_PROJECT=mcnanovna-docs COMPOSE_PROJECT=mcnanovna-docs
DOMAIN=mcnanovna.warehack.ing
# Domain for caddy-docker-proxy
DOMAIN=mcnanovna.l.zmesh.systems
# Mode: prod or dev (used by Makefile to select compose files)
MODE=prod MODE=prod

View File

@ -1,77 +1,45 @@
# mcnanovna docs - Makefile for docker compose management .PHONY: prod dev down logs build rebuild shell clean help
# Usage:
# make up - Start production (static site)
# make dev - Start development (hot-reload)
# make down - Stop containers
# make logs - Follow container logs
# make build - Rebuild container images
# make shell - Open shell in running container
.PHONY: up down logs build rebuild shell dev clean help
# Load environment variables
include .env include .env
export export
# Compose command shortcuts
COMPOSE := docker compose
COMPOSE_DEV := docker compose -f docker-compose.yml -f docker-compose.dev.yml
# Default target
help: help:
@echo "mcnanovna docs - Astro/Starlight documentation site" @echo "mcnanovna docs"
@echo "" @echo ""
@echo "Usage:" @echo " make prod Production (static Caddy)"
@echo " make up Start production (static Caddy server)" @echo " make dev Development (Vite hot-reload)"
@echo " make dev Start development (Vite hot-reload)" @echo " make down Stop containers"
@echo " make down Stop all containers" @echo " make logs Follow logs"
@echo " make logs Follow container logs" @echo " make build Build image"
@echo " make build Build production image"
@echo " make rebuild Force rebuild (no cache)" @echo " make rebuild Force rebuild (no cache)"
@echo " make shell Open shell in running container" @echo " make shell Shell into running container"
@echo " make clean Remove containers, images, volumes" @echo " make clean Remove containers, images, volumes"
@echo "" @echo ""
@echo "Environment:"
@echo " DOMAIN = $(DOMAIN)" @echo " DOMAIN = $(DOMAIN)"
@echo " MODE = $(MODE)"
# Production mode prod:
up: .env docker compose up -d --build
$(COMPOSE) up -d
$(COMPOSE) logs -f
# Development mode with hot-reload dev:
dev: .env docker compose --profile dev up --build
$(COMPOSE_DEV) up -d --build
$(COMPOSE_DEV) logs -f
# Stop containers
down: down:
$(COMPOSE) down docker compose --profile dev down
$(COMPOSE_DEV) down 2>/dev/null || true
# View logs
logs: logs:
$(COMPOSE) logs -f docker compose logs -f
# Build image
build: build:
$(COMPOSE) build docker compose build
# Rebuild without cache
rebuild: rebuild:
$(COMPOSE) build --no-cache docker compose build --no-cache
# Shell into running container
shell: shell:
$(COMPOSE) exec docs sh docker compose exec docs sh
# Clean everything
clean: clean:
$(COMPOSE) down -v --rmi local docker compose --profile dev down -v --rmi local
$(COMPOSE_DEV) down -v --rmi local 2>/dev/null || true
# Create .env from example if missing
.env: .env:
@echo "Creating .env from .env.example..."
@cp .env.example .env @cp .env.example .env

View File

@ -2,7 +2,7 @@ import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight'; import starlight from '@astrojs/starlight';
export default defineConfig({ export default defineConfig({
site: 'https://mcnanovna.l.zmesh.systems', site: 'https://mcnanovna.warehack.ing',
telemetry: false, telemetry: false,
devToolbar: { enabled: false }, devToolbar: { enabled: false },
integrations: [ integrations: [
@ -15,7 +15,7 @@ export default defineConfig({
replacesTitle: false, replacesTitle: false,
}, },
social: { social: {
github: 'https://git.supported.systems/rf/mcnanovna', github: 'https://git.supported.systems/warehack.ing/mcnanovna',
}, },
sidebar: [ sidebar: [
{ {

View File

@ -1,27 +0,0 @@
# Development overrides - hot-reload with volume mounts
# Usage: docker compose -f docker-compose.yml -f docker-compose.dev.yml up
services:
docs:
build:
target: dev
volumes:
- .:/app
- /app/node_modules # Anonymous volume to preserve node_modules
environment:
- NODE_ENV=development
- ASTRO_TELEMETRY_DISABLED=1
- VITE_HMR_HOST=${DOMAIN:-mcnanovna.l.zmesh.systems}
labels:
# Override reverse proxy to Vite dev server port
caddy.reverse_proxy: "{{upstreams 4321}}"
# WebSocket support for Vite HMR
caddy.reverse_proxy.flush_interval: "-1"
caddy.reverse_proxy.transport: "http"
caddy.reverse_proxy.transport.read_timeout: "0"
caddy.reverse_proxy.transport.write_timeout: "0"
caddy.reverse_proxy.transport.keepalive: "5m"
caddy.reverse_proxy.transport.keepalive_idle_conns: "10"
caddy.reverse_proxy.stream_timeout: "24h"
caddy.reverse_proxy.stream_close_delay: "5s"

View File

@ -10,10 +10,38 @@ services:
environment: environment:
- ASTRO_TELEMETRY_DISABLED=1 - ASTRO_TELEMETRY_DISABLED=1
labels: labels:
# caddy-docker-proxy configuration caddy: ${DOMAIN:-mcnanovna.warehack.ing}
caddy: ${DOMAIN:-mcnanovna.l.zmesh.systems}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
docs-dev:
build:
context: .
target: dev
container_name: ${COMPOSE_PROJECT:-mcnanovna-docs}-dev
restart: unless-stopped
profiles:
- dev
networks:
- caddy
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
- ASTRO_TELEMETRY_DISABLED=1
- VITE_HMR_HOST=${DOMAIN:-mcnanovna.l.warehack.ing}
labels:
caddy: ${DOMAIN:-mcnanovna.l.warehack.ing}
caddy.reverse_proxy: "{{upstreams 4321}}"
caddy.reverse_proxy.flush_interval: "-1"
caddy.reverse_proxy.transport: "http"
caddy.reverse_proxy.transport.read_timeout: "0"
caddy.reverse_proxy.transport.write_timeout: "0"
caddy.reverse_proxy.transport.keepalive: "5m"
caddy.reverse_proxy.transport.keepalive_idle_conns: "10"
caddy.reverse_proxy.stream_timeout: "24h"
caddy.reverse_proxy.stream_close_delay: "5s"
networks: networks:
caddy: caddy:
external: true external: true