Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea78a12a83 | ||
|
|
0a3511a44b | ||
|
|
3dc3a03066 |
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose
|
COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose
|
||||||
IMAGE := {{ project_slug }}/{{ part }}
|
IMAGE := {{ project_slug | replace('_', '-') }}/{{ part }}
|
||||||
changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null
|
changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null
|
||||||
stamp = { git update-ref $(1) HEAD 2>/dev/null || true; }
|
stamp = { git update-ref $(1) HEAD 2>/dev/null || true; }
|
||||||
|
|
||||||
@@ -23,8 +23,15 @@ post-deploy:
|
|||||||
@:
|
@:
|
||||||
{% if layout == 'root' %}
|
{% if layout == 'root' %}
|
||||||
env:
|
env:
|
||||||
@test -f .env || cp .env.example .env
|
@fresh=; test -f .env || { cp .env.example .env; fresh=1; }; \
|
||||||
@test -f docker-compose.override.yml || cp docker-compose.override.yml.example docker-compose.override.yml
|
if ! test -f docker-compose.override.yml; then \
|
||||||
|
cp docker-compose.override.yml.example docker-compose.override.yml; \
|
||||||
|
for port in $$(sed -n 's/.*127\.0\.0\.1:\([0-9]*\):.*/\1/p' docker-compose.override.yml | sort -u); do \
|
||||||
|
random=$$((20000 + $$(od -An -N2 -tu2 /dev/urandom) % 40000)); \
|
||||||
|
sed "s/127\.0\.0\.1:$$port:/127.0.0.1:$$random:/" docker-compose.override.yml > docker-compose.override.yml.tmp && mv docker-compose.override.yml.tmp docker-compose.override.yml; \
|
||||||
|
test -z "$$fresh" || { sed "s|localhost:$$port/|localhost:$$random/|" .env > .env.tmp && mv .env.tmp .env; }; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
recreate:
|
recreate:
|
||||||
$(COMPOSE) up -d --force-recreate
|
$(COMPOSE) up -d --force-recreate
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
{{ service }}:
|
{{ service }}:
|
||||||
build: {{ part_dir }}
|
build: {{ part_dir }}
|
||||||
image: {{ project_slug }}/{{ part }}
|
image: {{ project_slug | replace('_', '-') }}/{{ part }}
|
||||||
profiles: [{{ service }}, services]
|
profiles: [{{ service }}, services]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
@@ -10,3 +10,5 @@ make recreate
|
|||||||
`make env` creates `.env` and `docker-compose.override.yml` from their examples. `make recreate` starts the selected profiles, `make rebuild` builds the image first, `make logs`, `make restart` and `make down` do what they say.
|
`make env` creates `.env` and `docker-compose.override.yml` from their examples. `make recreate` starts the selected profiles, `make rebuild` builds the image first, `make logs`, `make restart` and `make down` do what they say.
|
||||||
|
|
||||||
To deploy, `git pull && make deploy`. It runs `make pre-deploy`, which rebuilds the image only when something in the repository changed, then `docker compose up -d`. A deploy system with its own `up` step calls `make pre-deploy` before it and `make post-deploy` after. What was built is remembered as `refs/deploy/*` in the clone.
|
To deploy, `git pull && make deploy`. It runs `make pre-deploy`, which rebuilds the image only when something in the repository changed, then `docker compose up -d`. A deploy system with its own `up` step calls `make pre-deploy` before it and `make post-deploy` after. What was built is remembered as `refs/deploy/*` in the clone.
|
||||||
|
|
||||||
|
In the fleet, production is deployed from `infra/komodo` instead (git mode of Komodo, see `docs/architecture.md` there): Komodo clones this repo, and a layer plus `deploy.sh` in the stack's directory tag images by the hash of what they bake in and write `.env` from sops. The repo only has to stay a plain recipe: images built from `build:` in compose, `caddy/site.caddy`. `make deploy` and `refs/deploy/*` are for a checkout deployed by hand.
|
||||||
Reference in new issue
Block a user