add make target 'deploy-full'; reorder Makefile

This commit is contained in:
Lexi / Zoe 2019-10-21 02:32:51 +02:00
parent 2e3be76e31
commit 4caa216548
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
1 changed files with 11 additions and 8 deletions

View File

@ -11,7 +11,7 @@ GIT_CRYPT_KEY ?= ~/.git-crypt-keys/$(APP_NAME)-$(STAGE).key
DOCKER_COMPOSE_YML := .deployment/$(STAGE)/docker-compose.yml DOCKER_COMPOSE_YML := .deployment/$(STAGE)/docker-compose.yml
APP_CONTAINER_NAME := django APP_CONTAINER_NAME := django
.PHONY: run docker-build docker-run decrypt deploy log-show live-collectstatic live-migrate live-shell .PHONY: run docker-build docker-run decrypt deploy deploy-full live-log live-migrate live-collectstatic live-shell
# Default target: none # Default target: none
all: all:
@ -38,22 +38,25 @@ docker-run:
decrypt: decrypt:
git-crypt unlock $(GIT_CRYPT_KEY) git-crypt unlock $(GIT_CRYPT_KEY)
# Meta target for deploying: docker-compose up, migrate and collectstatic
deploy-full: deploy live-migrate live-collectstatic
# Deploy on production using docker-compose # Deploy on production using docker-compose
deploy: deploy:
docker-compose -f $(DOCKER_COMPOSE_YML) up --build --detach docker-compose -f $(DOCKER_COMPOSE_YML) up --build --detach
# Show logs for running container # Show logs for running container
log-show: live-log:
docker-compose -f $(DOCKER_COMPOSE_YML) logs -f docker-compose -f $(DOCKER_COMPOSE_YML) logs -f
# Run django 'collectstatic' command on live container # Run shell in live container
live-collectstatic: live-shell:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py collectstatic --no-input --clear docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} sh
# Run django 'migrate' command on live container # Run django 'migrate' command on live container
live-migrate: live-migrate:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py migrate --no-input docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py migrate --no-input
# Run shell in live container # Run django 'collectstatic' command on live container
live-shell: live-collectstatic:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} sh docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py collectstatic --no-input --clear