This repository has been archived on 2026-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
wedding-app/Makefile

83 lines
2.0 KiB
Makefile
Raw Normal View History

feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
.PHONY: help network up down restart status \
up-main up-gitea up-wedding \
down-main down-gitea down-wedding \
logs-main logs-gitea logs-wedding \
pull-main pull-gitea pull-wedding \
rebuild-wedding
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
NET := infra-net
DC_MAIN := docker compose -f infra/main/docker-compose.yml --env-file infra/main/.env
DC_GITEA := docker compose -f infra/gitea/docker-compose.yml --env-file infra/gitea/.env
DC_WEDDING := docker compose -f infra/wedding_photo/docker-compose.yml --env-file infra/wedding_photo/.env
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
help:
@echo "Stacks: main (postgres+redis+minio+pgadmin+caddy) | gitea | wedding_photo"
@echo ""
@echo " make up Sobe tudo na ordem (main -> gitea -> wedding)"
@echo " make down Desce tudo na ordem inversa"
@echo " make restart down + up"
@echo " make status ps de todas as stacks"
@echo ""
@echo " make up-main Sobe só a stack main"
@echo " make up-gitea Sobe só o gitea"
@echo " make up-wedding Build + up do app wedding"
@echo " make rebuild-wedding Force rebuild do app wedding"
@echo " make down-{main,gitea,wedding}"
@echo " make logs-{main,gitea,wedding}"
@echo " make pull-{main,gitea,wedding}"
@echo " make network Cria a network external '$(NET)' (idempotente)"
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
network:
@./network.sh
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
up: network up-main up-gitea up-wedding
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
down: down-wedding down-gitea down-main
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
restart: down up
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
status:
@$(DC_MAIN) ps || true
@$(DC_GITEA) ps || true
@$(DC_WEDDING) ps || true
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
up-main: network
$(DC_MAIN) up -d
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
up-gitea: network
$(DC_GITEA) up -d
feat: rewrite backend in Python (FastAPI + SQLAlchemy + boto3) Same routes, same Docker topology, same env vars. Frontend untouched. Backend swap: - Hono on Node -> FastAPI on Python 3.12, served by uvicorn behind Caddy. - Drizzle on Node -> SQLAlchemy 2.0 async (asyncpg driver) with declarative models that mirror the previous schema 1:1. Migrations are still plain SQL files (apps/api/app/migrations/) run idempotently at startup by app/db/migrate.py via asyncpg, tracking each file's sha256 in a schema_migrations table. - aws4fetch -> boto3 wrapped in asyncio.to_thread so the async routes do not block on MinIO/S3 calls. The presign_put / init_multipart / complete_multipart / head / delete contract is unchanged so the React client sees the same /api/uploads/* payloads. - Cookie+JWT admin auth -> pyjwt + FastAPI Cookie() dependency. constant-time password compare. Same 7-day HttpOnly cookie shape. - QR code: qrcode lib + reportlab. /api/qrcode keeps format=png|svg|pdf; the PDF is still A6 with the couple's names + 'Aponte a câmera' CTA. - Pydantic-settings replaces the zod env loader and still fails fast on missing required vars. Routes ported with identical paths and JSON shapes: - public: /api/event, /api/gallery, /api/qrcode, /api/stats - uploads: /api/uploads/init, /{id}/confirm, /{id}/abort - admin: /login, /logout, /me, /event (GET+PATCH), /uploads (GET with ?status, ?kind=photo|video, ?q= for search), /uploads/{id} (PATCH for author/message edit), /uploads/{id}/{approve,reject,cover}, /uploads/{id} (DELETE), /event/cover (DELETE), /uploads/bulk, /stats. Build pipeline: - Dockerfile: stage 1 builds the React/Vite SPA with pnpm; stage 2 is python:3.12-slim that installs deps via uv (fast, reproducible), copies the app/, and copies the SPA dist from stage 1 into /app/public so the FastAPI process serves both /api/* and the SPA assets. - docker-compose.yml unchanged: postgres + minio + minio-init + app + caddy. Same env vars (DATABASE_URL, S3_*, ADMIN_PASSWORD, SESSION_SECRET, ALLOWED_ADMIN_EMAILS, AUTO_MIGRATE). - Removed apps/api from the pnpm workspace; root package.json now only scripts the web. Makefile centralizes dev/build/docker commands so the Python side has the same DX as the Node side did.
2026-06-07 19:45:20 -03:00
feat: split into 3 docker-compose stacks (main / gitea / wedding_photo) Repo passa a viver dentro de infra/, com três stacks isoladas que compartilham uma network Docker externa ('infra-net'): main/ infra base: postgres + redis + minio + minio-init + pgadmin + caddy. Postgres roda em modo multi-banco; o init script cria os DBs 'wedding' e 'gitea' com roles dedicadas. MinIO tem um bucket inicial criado pelo minio-init com anonymous download + CORS. Caddy é o único container expondo 80/443 e roteia por hostname: gitea.{DOMAIN_BASE} / wedding.* / pgadmin.* / minio.* / media.* (rewrite de bucket). gitea/ gitea + act_runner. Gitea liga no postgres compartilhado e usa redis pra cache+sessões. O runner ganha um Dockerfile pequeno que adiciona docker CLI por cima do gitea/act_runner pra workflows poderem chamar 'docker build'. Bootstrap do token de runner documentado no .env.example. wedding_photo/ Só a aplicação: 'wedding_app' (FastAPI + SPA) + postgres-backup + media-backup. Os bancos e o MinIO vêm da stack main/. A app usa extra_hosts: host-gateway pra alcançar media.{DOMAIN_BASE} via Caddy mesmo em dev local — assim a assinatura S3 fecha com o host que o browser usa pra fazer PUT. Orquestração: - Makefile no root: 'make up' sobe tudo na ordem (main -> gitea -> wedding_photo). 'make up-{main,gitea,wedding}' pra controle granular. 'make logs-*', 'make down', 'make status', 'make pull-*'. - network.sh cria a 'infra-net' antes de qualquer up; idempotente. - Cada stack tem seu próprio .env.example. As creds compartilhadas (DOMAIN_BASE, MINIO_ROOT_*, WEDDING_DB_*) precisam casar entre main/.env e o consumidor (gitea/.env ou wedding_photo/.env). - .gitignore ignora todas as pastas data/ dos volumes.
2026-06-08 20:34:14 -03:00
up-wedding: network
$(DC_WEDDING) up -d --build
rebuild-wedding: network
$(DC_WEDDING) build --no-cache
$(DC_WEDDING) up -d
down-main:
$(DC_MAIN) down
down-gitea:
$(DC_GITEA) down
down-wedding:
$(DC_WEDDING) down
logs-main:
$(DC_MAIN) logs -f
logs-gitea:
$(DC_GITEA) logs -f
logs-wedding:
$(DC_WEDDING) logs -f
pull-main:
$(DC_MAIN) pull
pull-gitea:
$(DC_GITEA) pull
pull-wedding:
$(DC_WEDDING) pull