wip
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ connect@%:
|
||||
|
||||
# target deploy: Fire deploy@% for ENV
|
||||
.PHONY: deploy
|
||||
deploy: deploy@$(ENV) ## Deploy application dockers
|
||||
deploy: $(if $(filter $(ENV),$(ENV_DEPLOY)),deploy-localhost,deploy@$(ENV)) ## Deploy application dockers
|
||||
|
||||
# target down: Remove application dockers
|
||||
# on local host
|
||||
|
||||
@@ -63,8 +63,8 @@ endif
|
||||
ifeq ($(OPERATING_SYSTEM),Darwin)
|
||||
DOCKER_HOST_IFACE ?= $(shell docker run --rm -it --net=host alpine /sbin/ip -4 route list match 0/0 2>/dev/null |awk '{print $$5}' |awk '!seen[$$0]++' |head -1)
|
||||
DOCKER_HOST_INET ?= $(shell docker run --rm -it --net=host alpine /sbin/ip -4 addr show $(DOCKER_HOST_IFACE) 2>/dev/null |awk '$$1 == "inet" {sub(/\/.*/,"",$$2); print $$2}')
|
||||
DOCKER_INTERNAL_DOCKER_GATEWAY ?= $(shell docker run --rm -it alpine getent hosts gateway.docker.internal |awk '{print $$1}' |head -1)
|
||||
DOCKER_INTERNAL_DOCKER_HOST ?= $(shell docker run --rm -it alpine getent hosts host.docker.internal |awk '{print $$1}' |head -1)
|
||||
DOCKER_INTERNAL_DOCKER_GATEWAY ?= $(shell docker run --rm -it alpine getent hosts gateway.docker.internal 2>/dev/null |awk '{print $$1}' |head -1)
|
||||
DOCKER_INTERNAL_DOCKER_HOST ?= $(shell docker run --rm -it alpine getent hosts host.docker.internal 2>/dev/null |awk '{print $$1}' |head -1)
|
||||
else
|
||||
DOCKER_HOST_IFACE ?= $(shell /sbin/ip -4 route list match 0/0 2>/dev/null |awk '{print $$5}' |awk '!seen[$$0]++' |head -1)
|
||||
DOCKER_HOST_INET ?= $(shell /sbin/ip -4 addr show $(DOCKER_HOST_IFACE) 2>/dev/null |awk '$$1 == "inet" {sub(/\/.*/,"",$$2); print $$2}')
|
||||
|
||||
+12
-1
@@ -8,7 +8,7 @@
|
||||
.PHONY: deploy@%
|
||||
deploy@%: myos-base build@% ## Deploy application docker images
|
||||
$(call make,docker-login docker-tag docker-push)
|
||||
$(call make,myos-ansible-pull@$(ENV) ANSIBLE_DOCKER_IMAGE_TAG=$(VERSION) ANSIBLE_TAGS=aws AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY),,APP)
|
||||
$(call make,myos-ansible-pull@$(ENV) ANSIBLE_DOCKER_IMAGE_TAG=$(VERSION) ANSIBLE_TAGS=deploy AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY),,APP)
|
||||
$(call make,docker-tag-latest docker-push-latest)
|
||||
|
||||
# target deploy-hook: Fire app-deploy deploy-hook-ping
|
||||
@@ -27,3 +27,14 @@ deploy-hook-ping-curl:
|
||||
'payload={"text": "$(DEPLOY_HOOK_TEXT)"}' \
|
||||
$(DEPLOY_HOOK_URL) \
|
||||
||: )
|
||||
|
||||
# target deploy-localhost@%: Deploy application docker images
|
||||
## it tags and pushes docker images to docker registry
|
||||
## it runs ansible-pull on localhost to pull docker images from the registry
|
||||
## it tags and pushes docker images as latest to docker registry
|
||||
.PHONY: deploy-localhost
|
||||
deploy-localhost: myos-base build@$(ENV) ## Deploy application docker images
|
||||
$(call make,docker-login docker-tag docker-push)
|
||||
$(call make,myos-ansible-pull ANSIBLE_DOCKER_IMAGE_TAG=$(VERSION) ANSIBLE_TAGS=deploy,,APP MYOS_TAGS_JSON)
|
||||
$(call make,docker-tag-latest docker-push-latest)
|
||||
deploy-localhost: app-deploy deploy-hook-ping
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
CMDS += ssh-run
|
||||
COMPOSE_IGNORE_ORPHANS := true
|
||||
ENV_VARS += COMPOSE_IGNORE_ORPHANS DOCKER_IMAGE_CLI DOCKER_IMAGE_SSH DOCKER_NAME_CLI DOCKER_NAME_SSH
|
||||
ENV_VARS += COMPOSE_IGNORE_ORPHANS MYOS_TAGS_JSON
|
||||
HOME ?= /home/$(USER)
|
||||
MYOS_TAGS_VARS ?= env user
|
||||
MYOS_TAGS_ARGS ?= $(foreach var,$(filter $(MYOS_TAGS_VARS),$(MAKE_FILE_VARS)),$(if $($(var)),$(var)='$($(var))'))
|
||||
MYOS_TAGS_JSON ?= "{$(foreach var,$(filter $(MYOS_TAGS_VARS),$(MAKE_FILE_VARS)),$(if $($(var)), '$(var)': '$($(var))'$(comma))) }"
|
||||
NFS_DISK ?= $(NFS_HOST):/$(notdir $(SHARED))
|
||||
NFS_OPTIONS ?= rw,rsize=8192,wsize=8192,bg,hard,intr,nfsvers=3,noatime,nodiratime,actimeo=3
|
||||
NFS_PATH ?= /srv/$(subst $(space),/,$(strip $(call reverse,$(subst ., ,$(NFS_HOST)))))$(subst ..,,$(SHARED))
|
||||
SHELL ?= /bin/sh
|
||||
STACK ?= base
|
||||
|
||||
env ?= $(ENV)
|
||||
user ?= $(USER)
|
||||
|
||||
Reference in New Issue
Block a user