keep the dynamism of make in pure shell
Two mechanisms, matching what the make engine actually did:
Lazy defaults. A stack setting is a function myos_default_<VAR>, called only
when the variable has no value, and called again at every reference. That is
exactly a recursive ?=: an explicit value wins, and the default follows a
DOMAIN that a .env changes later. The prefix is what makes it safe; the first
version used a bare function named after the variable, and the test suite
caught it running /usr/bin/host for a stack group called host.
Templates. myos env-update fills a .env from the .env.dist files, expanding
${VAR} against the current values and running $(command), forward references
included.
Also fixed: the project .env now wins over /etc/conf.d/myos, which is what the
documentation claimed and the code did not.
share/make/shim.mk lets a project keep make as a front end: every myos command
becomes a target that shells out to bin/myos, and the project keeps its own
targets and its stack .mk files. It sits outside make/ because the legacy
engine globs every .mk in there.
This commit is contained in:
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
MYOS ?= /usr/local/lib/myos
|
||||
include $(MYOS)/share/make/shim.mk
|
||||
@@ -0,0 +1,12 @@
|
||||
services:
|
||||
consul:
|
||||
image: hashicorp/consul:1.15
|
||||
container_name: ${HOST_COMPOSE_PROJECT_NAME:-localhost}-consul
|
||||
network_mode: host
|
||||
restart: always
|
||||
environment:
|
||||
CONSUL_HTTP_TOKEN: ${HOST_CONSUL_HTTP_TOKEN}
|
||||
volumes:
|
||||
- consul:/consul/data
|
||||
volumes:
|
||||
consul:
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
fabio:
|
||||
image: fabiolb/fabio:1.6.3
|
||||
container_name: ${HOST_COMPOSE_PROJECT_NAME:-localhost}-fabio
|
||||
depends_on: [consul]
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
environment:
|
||||
FABIO_REGISTRY_CONSUL_ADDR: ${DOCKER_HOST_INET4:-127.0.0.1}:8500
|
||||
FABIO_LOG_ACCESS_TARGET: ${HOST_FABIO_LOG_ACCESS:-}
|
||||
networks:
|
||||
- public
|
||||
@@ -0,0 +1,7 @@
|
||||
host ?= host/consul host/fabio
|
||||
|
||||
# a target of the project, on top of the myos commands: this is what make is
|
||||
# kept for, and what the shim leaves alone
|
||||
.PHONY: host-certs
|
||||
host-certs:
|
||||
@echo "would renew the certificates of $(host)"
|
||||
@@ -0,0 +1,9 @@
|
||||
services:
|
||||
registrator:
|
||||
image: gliderlabs/registrator:master
|
||||
container_name: ${HOST_COMPOSE_PROJECT_NAME:-localhost}-registrator
|
||||
network_mode: host
|
||||
depends_on: [consul]
|
||||
command: -internal=false -useIpFromLabel SERVICE_ADDRESS consul://127.0.0.1:8500
|
||||
volumes:
|
||||
- ${DOCKER_SOCKET_LOCATION:-/var/run/docker.sock}:/tmp/docker.sock
|
||||
Reference in New Issue
Block a user