wip
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
CODEDEPLOY_APP_NAME ?= $(APP)
|
||||
CODEDEPLOY_DEPLOYMENT_GROUP ?= $(CODEDEPLOY_APP_NAME)_$(ENV)
|
||||
CODEDEPLOY_DEPLOYMENT_CONFIG ?= CodeDeployDefault.AllAtOnce
|
||||
CODEDEPLOY_DESCRIPTION ?= app: *$(APP)* branch: *$(BRANCH)* env: *$(ENV)* version: *$(VERSION)*
|
||||
CODEDEPLOY_GITHUB_REPO ?= $(patsubst $(call pop,$(call pop,$(GIT_REPOSITORY)))/%,%,$(GIT_REPOSITORY))
|
||||
CODEDEPLOY_GITHUB_COMMIT_ID ?= $(COMMIT)
|
||||
DEPLOY ?= false
|
||||
DEPLOY_HASH ?= $(shell date +%s)
|
||||
DEPLOY_HOOK_TEXT ?= app: *$(APP)* branch: *$(BRANCH)* env: *$(ENV)* version: *$(VERSION)* container: *$(CONTAINER)* host: *$(HOST)*
|
||||
|
||||
@@ -18,7 +18,7 @@ COMPOSE_IGNORE_ORPHANS ?= false
|
||||
COMPOSE_PROJECT_NAME ?= $(USER)_$(ENV)_$(APP)
|
||||
COMPOSE_SERVICE_NAME ?= $(subst _,-,$(COMPOSE_PROJECT_NAME))
|
||||
CONTEXT += COMPOSE_FILE DOCKER_IMAGE_TAG DOCKER_REPOSITORY DOCKER_SERVICE
|
||||
CONTEXT_DEBUG += DOCKER_REGISTRY_REPOSITORY
|
||||
CONTEXT_DEBUG += DOCKER_REGISTRY
|
||||
DOCKER_BUILD_ARGS ?= $(if $(filter $(DOCKER_BUILD_NO_CACHE),true),--pull --no-cache) $(foreach var,$(DOCKER_BUILD_VARS),$(if $($(var)),--build-arg $(var)='$($(var))'))
|
||||
DOCKER_BUILD_CACHE ?= true
|
||||
DOCKER_BUILD_NO_CACHE ?= false
|
||||
@@ -145,7 +145,7 @@ define docker-stack-update
|
||||
$(eval version := $(or $(2),$(if $(findstring :,$(stack)),$(lastword $(subst :, ,$(stack))),latest)))
|
||||
$(eval path := $(patsubst %/,%,$(or $(3),$(if $(findstring /,$(1)),$(if $(wildcard stack/$(1) stack/$(1).yml),stack/$(if $(findstring .yml,$(1)),$(dir $(1)),$(if $(wildcard stack/$(1).yml),$(dir $(1)),$(1))),$(dir $(1)))),stack/$(name))))
|
||||
$(eval COMPOSE_FILE += $(wildcard $(path)/$(name).yml $(path)/$(name).$(ENV).yml $(path)/$(name).$(ENV).$(version).yml $(path)/$(name).$(version).yml))
|
||||
$(if $(wildcard $(path)/.env.dist),$(call .env,,$(path)/.env.dist,$(wildcard $(PARAMETERS)/$(ENV)/$(APP)/.env $(path)/.env.$(ENV) .env)))
|
||||
$(if $(wildcard $(path)/.env.dist),$(call .env,,$(path)/.env.dist,$(wildcard $(CONFIG)/$(ENV)/$(APP)/.env $(path)/.env.$(ENV) .env)))
|
||||
endef
|
||||
# function docker-tag: Tag docker image
|
||||
define docker-tag
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# function install-parameters: copy PARAMETERS files to application config folder
|
||||
define install-parameters
|
||||
# function install-config: copy CONFIG files to application config folder
|
||||
define install-config
|
||||
$(eval path:=$(or $(1),$(APP)))
|
||||
$(eval file:=$(or $(2),$(DOCKER_SERVICE)))
|
||||
$(eval dest:=$(or $(3),config))
|
||||
$(eval env:=$(or $(4),$(ENV)))
|
||||
$(if $(wildcard $(dest)/$(file)),,$(if $(wildcard $(PARAMETERS)/$(env)/$(path)/$(file)),$(ECHO) cp -a $(PARAMETERS)/$(env)/$(path)/$(file) $(dest)))
|
||||
$(if $(wildcard $(dest)/$(file)),,$(if $(wildcard $(CONFIG)/$(env)/$(path)/$(file)),$(ECHO) cp -a $(CONFIG)/$(env)/$(path)/$(file) $(dest)))
|
||||
endef
|
||||
|
||||
+12
-12
@@ -24,17 +24,17 @@ install-pgsql-database-%: myos-base
|
||||
$(call exec,[ $$(PGPASSWORD=$* psql -h postgres -U $* -d $* -c "\d" 2>/dev/null |wc -l) -eq 0 ] && [ -f "${APP_DIR}/$*.pgsql.gz" ] && gzip -cd "${APP_DIR}/$*.pgsql.gz" |PGPASSWORD="postgres" psql -h postgres -U postgres -d $* || true)
|
||||
$(call exec,[ $$(PGPASSWORD=$* psql -h postgres -U $* -d $* -c "\d" 2>/dev/null |wc -l) -eq 0 ] && [ -f "${APP_DIR}/$*.pgsql" ] && PGPASSWORD="postgres" psql -h postgres -U postgres -c "ALTER ROLE $* WITH SUPERUSER" && PGPASSWORD="postgres" pg_restore -h postgres --no-owner --role=$* -U postgres -d $* ${APP_DIR}/$*.pgsql && PGPASSWORD="postgres" psql -h postgres -U postgres -c "ALTER ROLE $* WITH NOSUPERUSER" || true)
|
||||
|
||||
# target install-build-parameters: Call install-parameters with file * and dest build
|
||||
.PHONY: install-build-parameters
|
||||
install-build-parameters:
|
||||
$(call install-parameters,,*,build)
|
||||
# target install-build-config: Call install-config with file * and dest build
|
||||
.PHONY: install-build-config
|
||||
install-build-config:
|
||||
$(call install-config,,*,build)
|
||||
|
||||
# target install-parameters: Call install-parameters
|
||||
.PHONY: install-parameters
|
||||
install-parameters:
|
||||
$(call install-parameters)
|
||||
# target install-config: Call install-config
|
||||
.PHONY: install-config
|
||||
install-config:
|
||||
$(call install-config)
|
||||
|
||||
# target install-parameters-%: Call install-parameters with app %
|
||||
.PHONY: install-parameters-%
|
||||
install-parameters-%:
|
||||
$(call install-parameters,$*)
|
||||
# target install-config-%: Call install-config with app %
|
||||
.PHONY: install-config-%
|
||||
install-config-%:
|
||||
$(call install-config,$*)
|
||||
|
||||
Reference in New Issue
Block a user