Sha256: d4fc164fca9e8adc0d4d298c269b0968089ec06f66e1675115ff9bcf830c4bd3

Contents?: true

Size: 1.63 KB

Versions: 22

Compression:

Stored size: 1.63 KB

Contents

-include .env
export

ifneq (,$(RAILS_ENV))
  env:=$(RAILS_ENV)
else ifneq (,$(RACK_ENV))
  env:=$(RACK_ENV)
endif

verify-environment:
ifndef CONTAINER_PORT
  @$(error `CONTAINER_PORT` must be defined in environment)
endif

ifndef env
  @$(error Either `env`, `RACK_ENV` or `RAILS_ENV` must be defined in environment)
endif

project_name:=%%REPOSITORY%%_${env}
compose_base:=env HOST_UID=$(shell id -u) \
              DOCKER_ORGANIZATION=%%ORGANIZATION%% \
              DOCKER_REPOSITORY=%%REPOSITORY%%:%%VERSION%% \
              docker-compose \
              -p ${project_name} \
              -f docker-compose.yml

compose:=${compose_base} -f docker-compose.production.yml -f docker-compose.override.yml

.PHONY: deploy
deploy:
ifndef manager
	@$(error Missing `manager` parameter: `make deploy manager=swarm-manager.example.com`)
else
	@tar -cf - . | ssh ${manager} 'cd $$(mktemp -d) ; chmod 0700 . ; cat - | tar -x ; make deploy-stack ; rm -r $$(pwd)'
endif

.PHONY: deploy-stack
deploy-stack:
	@${compose} config | docker stack deploy --prune --with-registry-auth -c - ${project_name}

.PHONY: console
service := app
command := /bin/bash
console:
	@echo "Creating temporary container..."
	@${compose} run --rm ${service} ${command}

.PHONY: config
config:
	@${compose} config

.PHONY: pull
pull:
	@${compose} pull

.PHONY: logs
logs: service := app
logs:
ifndef manager
	@$(error Missing `manager` parameter: `make logs manager=swarm-manager.example.com`)
else
	ssh ${manager} "docker service logs -f ${project_name}_${service}"
endif

.PHONY: migrate
migrate:
	@${compose} run --rm app bundle exec rake db:migrate

.PHONY: compose
compose:
	@echo ${compose}

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
orchestration-0.5.0 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.21 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.20 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.19 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.18 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.17 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.16 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.15 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.14 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.13 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.12 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.10 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.9 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.8 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.7 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.6 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.5 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.4 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.3 lib/orchestration/templates/deploy.mk.erb
orchestration-0.4.2 lib/orchestration/templates/deploy.mk.erb