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
Leandro Ronetto 98dcafdf26
Some checks failed
Deploy / deploy (push) Failing after 1s
feat(ci): deploy automático via Gitea Actions + rename branch para main
- .gitea/workflows/deploy.yml: push na main (paths do app/infra) ou
  disparo manual -> SSH no host -> make deploy + health check /api/health
- Makefile: alvo `deploy` (git reset --hard + up-wedding com build), BRANCH=main
- CLAUDE.md: documenta o fluxo de deploy e o setup de secrets

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 06:19:31 -03:00

95 lines
2.4 KiB
Makefile

.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 deploy
NET := infra-net
BRANCH ?= main
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
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 deploy git reset --hard + up-wedding (usado pelo CI)"
@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)"
network:
@./network.sh
up: network up-main up-gitea up-wedding
down: down-wedding down-gitea down-main
restart: down up
status:
@$(DC_MAIN) ps || true
@$(DC_GITEA) ps || true
@$(DC_WEDDING) ps || true
up-main: network
$(DC_MAIN) up -d
up-gitea: network
$(DC_GITEA) up -d
up-wedding: network
$(DC_WEDDING) up -d --build
rebuild-wedding: network
$(DC_WEDDING) build --no-cache
$(DC_WEDDING) up -d
# Deploy automático: atualiza o código e sobe só o app wedding com build.
# Chamado pelo workflow .gitea/workflows/deploy.yml via SSH no host.
# BRANCH pode ser sobrescrito: `make deploy BRANCH=main`
deploy: network
git fetch --all --prune
git checkout $(BRANCH)
git reset --hard origin/$(BRANCH)
$(DC_WEDDING) up -d --build
$(DC_WEDDING) ps
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