fix(deploy): postgres in the project, no restart on an empty list, image named with dashes #1
No files matched your search
@@ -13,7 +13,7 @@
|
||||
{%- set has_script = dynamic_config and svc_modules -%}
|
||||
{%- set has_scripts = dynamic_config or 'kurigram_userbot' in backend_services -%}
|
||||
COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose
|
||||
{% if svc_modules %}IMAGE := {{ project_slug }}/backend
|
||||
{% if svc_modules %}IMAGE := {{ project_slug | replace('_', '-') }}/backend
|
||||
IMAGE_INPUTS := pyproject.toml uv.lock Dockerfile
|
||||
CODE := src{% if has_scripts %} scripts{% endif %}{% if serve_spa %} ../frontend{% endif %}
|
||||
SERVICES := {{ app_services | join(' ') }}
|
||||
@@ -39,13 +39,13 @@ pre-deploy:
|
||||
@if $(call changed,refs/deploy/backend,$(IMAGE_INPUTS)) || ! docker image inspect $(IMAGE) >/dev/null 2>&1; then \
|
||||
$(MAKE) build && $(call stamp,refs/deploy/backend) && $(call stamp,refs/deploy/backend-code); \
|
||||
fi
|
||||
{% if database == 'postgres' %} @$(COMPOSE) config --services | grep -qx postgres && $(COMPOSE) up -d postgres || true
|
||||
{% if database == 'postgres' %} @if ($(COMPOSE) config --services) | grep -qx postgres; then ($(COMPOSE) up -d --wait postgres); fi
|
||||
$(MAKE) migrate
|
||||
{% endif %}
|
||||
post-deploy:
|
||||
@if $(call changed,refs/deploy/backend-code,$(CODE)); then \
|
||||
running=$$($(COMPOSE) ps --services --status running | grep -x $(addprefix -e ,$(SERVICES))); \
|
||||
[ -z "$$running" ] || $(COMPOSE) restart $$running; \
|
||||
if [ -n "$$running" ]; then ($(COMPOSE) restart $$running); fi; \
|
||||
$(call stamp,refs/deploy/backend-code); \
|
||||
fi
|
||||
{% endif %}{% if layout == 'root' %}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{%- if 'scheduler' in backend_services %}{% set _ = app_services.append({'name': 'scheduler', 'command': ('[worker, scheduler]' if 'taskiq_worker' in backend_services else '[scheduler]')}) %}{% endif -%}
|
||||
{%- macro backend_service(name, command) %} {{ name }}:
|
||||
build: {{ part_dir }}
|
||||
image: {{ project_slug }}/backend
|
||||
image: {{ project_slug | replace('_', '-') }}/backend
|
||||
profiles: [{{ name }}, services]
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
@@ -87,7 +87,7 @@ services:
|
||||
|
||||
migrator:
|
||||
build: {{ part_dir }}
|
||||
image: {{ project_slug }}/backend
|
||||
image: {{ project_slug | replace('_', '-') }}/backend
|
||||
profiles: [migrate]
|
||||
env_file:
|
||||
- path: .env
|
||||
|
||||
Reference in new issue
Block a user