- go.mod: dcntrlized-auth v0.1.1 -> v0.1.2 (tlsutil.IsDev/AuthBaseURL and the identity-mount client fallback). - docker-compose.debug.yaml: DEV_MODE replaced by DCNTRLIZED_DEV=true (the single dev selector); mount the devboot-issued identity at the shared-module default /dcntrlized/pki so the authproxy edge is mTLS. INSECURE_INTERNAL=1 stays: the RN-facing listener must stay plaintext.
114 lines
3.5 KiB
YAML
114 lines
3.5 KiB
YAML
# Source: https://oneuptime.com/blog/post/2026-01-07-go-hot-reloading-docker-air/view#step-4-set-up-docker-compose
|
|
|
|
# docker-compose.yml
|
|
# Development environment with hot reloading
|
|
|
|
services:
|
|
# Main Go application with Air hot reloading
|
|
keepnote-debug:
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
|
|
image: keepnote-debug
|
|
container_name: keepnote-debug
|
|
|
|
# Build from our development Dockerfile
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.debug
|
|
network: host
|
|
|
|
|
|
# Expose ports: host:container
|
|
ports:
|
|
- "8081:8080" # Application port
|
|
# Delve: no host port — auth-debug owns 2345; attach via the container's
|
|
# 2345 when needed.
|
|
# - "8081:8081" # HTTP Dev interface
|
|
|
|
|
|
# Volume mounts - THE KEY TO HOT RELOADING
|
|
# Mount source code as a volume so changes are reflected immediately
|
|
volumes:
|
|
- ./src:/app
|
|
- go-mod-cache:/go/pkg/mod
|
|
- go-build-cache:/root/.cache/go-build
|
|
- /app/src/tmp # Exclude Air's tmp dir from syncing
|
|
# mTLS identity for the auth edge: the certs Maestro issued for the dev
|
|
# fleet (devboot, DCNTRLIZED_DEV=true) at the shared-module default paths,
|
|
# so the authproxy client authenticates to the mTLS auth hub.
|
|
- ${DCNTRLIZED_DATA_DIR:-$HOME/.dcntrlized}/pki/ca.crt:/dcntrlized/pki/ca.crt:ro
|
|
- ${DCNTRLIZED_DATA_DIR:-$HOME/.dcntrlized}/pki/keepnote/tls.crt:/dcntrlized/pki/tls.crt:ro
|
|
- ${DCNTRLIZED_DATA_DIR:-$HOME/.dcntrlized}/pki/keepnote/tls.key:/dcntrlized/pki/tls.key:ro
|
|
|
|
working_dir: /app/
|
|
|
|
# Environment variables for the application
|
|
environment:
|
|
# DCNTRLIZED_DEV is the single dev selector (registry/auth URLs).
|
|
- DCNTRLIZED_DEV=true
|
|
# Security theme M2 §2: keep THIS listener plaintext so the RN client
|
|
# (direct mode) and hot reload work without certs. The auth proxy edge
|
|
# is still mTLS (mounted identity above).
|
|
- INSECURE_INTERNAL=1
|
|
# Application configuration
|
|
# - PORT=8080
|
|
# - ENVIRONMENT=development
|
|
# - LOG_LEVEL=debug
|
|
|
|
# Database connection (shared database on the dcntrlized network)
|
|
- DATABASE_URL=postgres://postgres:@dcntrlized-db:5432/dcntrlized
|
|
|
|
# Go specific settings
|
|
- GO111MODULE=on
|
|
- GOPROXY=http://192.168.122.183:3000/api/packages/Dcntrlized/go,https://proxy.golang.org,direct
|
|
- GONOSUMDB=git.dcntrlized.org
|
|
|
|
depends_on:
|
|
- migrate
|
|
|
|
# Restart policy for development
|
|
restart: unless-stopped
|
|
|
|
# Network for service communication
|
|
networks:
|
|
- dcntrlized_net
|
|
|
|
cap_add:
|
|
- SYS_PTRACE
|
|
security_opt:
|
|
- apparmor:unconfined
|
|
|
|
migrate:
|
|
image: postgres:16-alpine
|
|
container_name: keepnote-migrate
|
|
labels:
|
|
org.dcntrlized.oneoff: "true"
|
|
networks:
|
|
- dcntrlized_net
|
|
volumes:
|
|
- ./database/migrations:/migrations:ro
|
|
environment:
|
|
- PGHOST=dcntrlized-db
|
|
- PGPORT=5432
|
|
- PGUSER=postgres
|
|
- PGPASSWORD=
|
|
- PGDATABASE=dcntrlized
|
|
command: >
|
|
sh -c 'until pg_isready -h dcntrlized-db -U postgres -d dcntrlized; do sleep 2; done;
|
|
for f in /migrations/*.sql; do [ -f "$$f" ] || continue; echo "Applying $$f"; psql -v ON_ERROR_STOP=1 -d dcntrlized -f "$$f" || exit 1; done'
|
|
|
|
# Named volumes for data persistence and caching
|
|
volumes:
|
|
# Go module cache - shared across rebuilds
|
|
go-mod-cache:
|
|
driver: local
|
|
|
|
# Go build cache - speeds up compilation
|
|
go-build-cache:
|
|
driver: local
|
|
|
|
networks:
|
|
dcntrlized_net:
|
|
external: true
|