DispelEvilBot/Makefile

60 lines
1.8 KiB
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Управление контурами test/prod.
# Пример: make up E=test
#
# Используем .RECIPEPREFIX, чтобы не зависеть от табов (рецепты начинаются с ">").
E ?= test
FILE := env/$(E).env
COMPOSE := docker compose -p $(E) --env-file $(FILE) -f docker-compose.prod.yml
.DEFAULT_GOAL := help
.RECIPEPREFIX := >
.PHONY: help up pull down restart logs ps images check psql ch backup
help:
> @echo "Контур задаётся через E=test|prod (по умолчанию test):"
> @echo " make up E=test поднять контур"
> @echo " make pull E=test подтянуть образ из registry"
> @echo " make down E=test остановить (данные сохраняются)"
> @echo " make restart E=test пересоздать контейнеры"
> @echo " make logs E=test стримить логи"
> @echo " make ps E=test статус сервисов"
> @echo " make images E=test образы контура"
> @echo " make check E=test проверка контура (скрипт)"
> @echo " make psql E=test psql в БД контура"
> @echo " make ch E=test clickhouse-client контура"
> @echo " make backup E=test бэкап событий с VPS (запускать на домашнем сервере)"
up:
> $(COMPOSE) up -d
pull:
> $(COMPOSE) pull
down:
> $(COMPOSE) down
restart:
> $(COMPOSE) up -d --force-recreate
logs:
> $(COMPOSE) logs -f
ps:
> $(COMPOSE) ps
images:
> $(COMPOSE) images
check:
> ./scripts/check_contour.sh $(E)
psql:
> $(COMPOSE) exec postgres sh -lc 'psql -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"'
ch:
> $(COMPOSE) exec clickhouse sh -lc 'clickhouse-client --user "$$CLICKHOUSE_USER" --password "$$CLICKHOUSE_PASSWORD" --database analytics'
backup:
> ./scripts/clickhouse_backup.sh $(E)