42 lines
1.4 KiB
Makefile
42 lines
1.4 KiB
Makefile
# PX360 deployment helpers for the `target` tool.
|
|
#
|
|
# First time (per environment):
|
|
# make init-dev # creates deploy/env.dev from the template
|
|
# $EDITOR deploy/env.dev # fill in SECRET_KEY, API keys, DB password, etc.
|
|
#
|
|
# Deploy (builds image, ships the whole .env, runs compose up):
|
|
# make deploy-dev
|
|
# make deploy-prod
|
|
#
|
|
# Each environment is a single gitignored file (deploy/env.dev / deploy/env.prod)
|
|
# holding ALL config + secrets. `target deploy` ships it to the server as .env.
|
|
|
|
.PHONY: deploy-dev deploy-prod init-dev init-prod check-dev check-prod
|
|
|
|
# --- One-time: create the gitignored env file from the committed template ---
|
|
init-dev:
|
|
cp -n deploy/env.dev.example deploy/env.dev 2>/dev/null || true
|
|
@echo "Created deploy/env.dev — edit it and fill in the secrets, then: make deploy-dev"
|
|
|
|
init-prod:
|
|
cp -n deploy/env.prod.example deploy/env.prod 2>/dev/null || true
|
|
@echo "Created deploy/env.prod — edit it and fill in the secrets, then: make deploy-prod"
|
|
|
|
# --- Guards ---
|
|
check-dev:
|
|
@if [ ! -f deploy/env.dev ]; then \
|
|
echo "ERROR: deploy/env.dev not found. Run: make init-dev"; exit 1; \
|
|
fi
|
|
|
|
check-prod:
|
|
@if [ ! -f deploy/env.prod ]; then \
|
|
echo "ERROR: deploy/env.prod not found. Run: make init-prod"; exit 1; \
|
|
fi
|
|
|
|
# --- Deploy (builds image, ships .env, runs compose up) ---
|
|
deploy-dev: check-dev
|
|
target deploy --config deploy/target.dev.yaml
|
|
|
|
deploy-prod: check-prod
|
|
target deploy --config deploy/target.prod.yaml
|