orchestration 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/orchestration/docker_compose/install_generator.rb +5 -1
- data/lib/orchestration/install_generator.rb +2 -1
- data/lib/orchestration/services/database/configuration.rb +5 -0
- data/lib/orchestration/templates/deploy.mk.erb +2 -2
- data/lib/orchestration/templates/orchestration.mk.erb +33 -3
- data/lib/orchestration/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b45aa732e39c5ac61b9805a5872f2d9674fb93ab1019f01dd5b1036b5a3e649
|
4
|
+
data.tar.gz: b0d4c6059142bac5e727586ae55de030dc5f75ed9a4acf128a1f260323bee2e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 705db40fc17fe876fb20b4c0319ec29bb66e89e4202a2e12ea1bea386130636dc52302047e2ce985f972c42e398ab0d09afd13ef0d0be1521d62a58fd2933925
|
7
|
+
data.tar.gz: f28843374e586e7d8fd299e588aa2b95602993faca0207c59a7e9f121658711db8c2c24bec2b58d72fa405b7141e90dd578bbf97b3722e096138ca047c3aeea9
|
data/README.md
CHANGED
@@ -22,6 +22,10 @@ module Orchestration
|
|
22
22
|
create_compose_file(:development)
|
23
23
|
end
|
24
24
|
|
25
|
+
def docker_compose_local_yml
|
26
|
+
create_compose_file(:local)
|
27
|
+
end
|
28
|
+
|
25
29
|
def docker_compose_production_yml
|
26
30
|
create_compose_file(:production)
|
27
31
|
end
|
@@ -80,7 +84,7 @@ module Orchestration
|
|
80
84
|
%i[database mongo rabbitmq]
|
81
85
|
when :production
|
82
86
|
%i[haproxy app database mongo rabbitmq]
|
83
|
-
when nil
|
87
|
+
when :local, nil
|
84
88
|
[]
|
85
89
|
else
|
86
90
|
raise ArgumentError, environment.inspect
|
@@ -56,7 +56,7 @@ module Orchestration
|
|
56
56
|
|
57
57
|
def gitignore
|
58
58
|
path = @env.root.join('.gitignore')
|
59
|
-
globs = %w[.build/ .deploy/ Gemfile Gemfile.lock]
|
59
|
+
globs = %w[.build/ .deploy/ Gemfile Gemfile.lock docker-compose.local.yml]
|
60
60
|
entries = %w[.env deploy.tar] + globs.map do |entry|
|
61
61
|
"#{@env.orchestration_dir_name}/#{entry}"
|
62
62
|
end
|
@@ -86,6 +86,7 @@ module Orchestration
|
|
86
86
|
@docker_compose.docker_compose_yml
|
87
87
|
@docker_compose.docker_compose_test_yml
|
88
88
|
@docker_compose.docker_compose_development_yml
|
89
|
+
@docker_compose.docker_compose_local_yml
|
89
90
|
@docker_compose.docker_compose_production_yml
|
90
91
|
@docker_compose.docker_compose_override_yml
|
91
92
|
end
|
@@ -34,6 +34,11 @@ module Orchestration
|
|
34
34
|
@settings = merged_settings
|
35
35
|
return if @adapter.name == 'sqlite3'
|
36
36
|
return unless %w[test development].include?(@env.environment)
|
37
|
+
|
38
|
+
merge_port
|
39
|
+
end
|
40
|
+
|
41
|
+
def merge_port
|
37
42
|
return if environment.key?('port') || url_config['port']
|
38
43
|
|
39
44
|
@settings.merge!('port' => local_port) if @env.docker_compose_config?
|
@@ -58,10 +58,10 @@ pull:
|
|
58
58
|
@${compose} pull
|
59
59
|
|
60
60
|
.PHONY: logs
|
61
|
-
service := app
|
61
|
+
logs: service := app
|
62
62
|
logs:
|
63
63
|
ifndef manager
|
64
|
-
|
64
|
+
@$(error Missing `manager` parameter: `make logs manager=swarm-manager.example.com`)
|
65
65
|
else
|
66
66
|
ssh ${manager} "docker service logs -f ${project_name}_${service}"
|
67
67
|
endif
|
@@ -29,21 +29,24 @@ compose_base:=env HOST_UID=$(shell id -u) \
|
|
29
29
|
DOCKER_REPOSITORY=${docker_repository} \
|
30
30
|
docker-compose \
|
31
31
|
-p ${docker_repository}_${env} \
|
32
|
-
-f <%= env.orchestration_dir_name %>/docker-compose.yml
|
32
|
+
-f <%= env.orchestration_dir_name %>/docker-compose.yml \
|
33
33
|
|
34
34
|
git_branch:=$(if $(branch),$(branch),$(shell git rev-parse --abbrev-ref HEAD))
|
35
35
|
git_version:=$(shell git rev-parse --short --verify ${git_branch})
|
36
36
|
|
37
37
|
compose:=${compose_base} -f <%= env.orchestration_dir_name %>/docker-compose.${env}.yml -f <%= env.orchestration_dir_name %>/docker-compose.override.yml
|
38
38
|
|
39
|
+
ifneq (,$(wildcard <%= env.orchestration_dir_name %>/docker-compose.local.yml))
|
40
|
+
compose:=${compose} -f <%= env.orchestration_dir_name %>/docker-compose.local.yml
|
41
|
+
endif
|
42
|
+
|
39
43
|
### Container management commands ###
|
40
44
|
|
41
45
|
.PHONY: start
|
42
46
|
start:
|
43
47
|
@echo "Starting containers..."
|
44
48
|
ifeq (${env},$(filter ${env},test development))
|
45
|
-
|
46
|
-
@docker network connect ${docker_repository}_${env}_default $${hostname} 2>/dev/null || :
|
49
|
+
@(docker ps --format "{{.ID}}" | grep -q $(shell hostname) && ${compose} up -d && docker network connect ${docker_repository}_${env}_default $(shell hostname)) || ${compose} up -d
|
47
50
|
else
|
48
51
|
@${compose} up -d --scale app=$${instances:-1}
|
49
52
|
endif
|
@@ -90,6 +93,33 @@ bundle:
|
|
90
93
|
@tar -C <%= env.orchestration_dir_name %>/.deploy -cf ./deploy.tar ./${docker_repository}
|
91
94
|
@echo 'Deployment bundle written to ./deploy.tar'
|
92
95
|
|
96
|
+
.PHONY: deploy
|
97
|
+
deploy:
|
98
|
+
ifndef manager
|
99
|
+
@$(error Missing `manager` parameter: `make deploy manager=swarm-manager.example.com`)
|
100
|
+
else
|
101
|
+
@echo 'Deploying stack via ${manager}...'
|
102
|
+
endif
|
103
|
+
|
104
|
+
ifndef env_file
|
105
|
+
$(MAKE) bundle \
|
106
|
+
&& workdir=$$(mktemp -d) \
|
107
|
+
&& mv deploy.tar $${workdir}/ \
|
108
|
+
&& cd $${workdir} \
|
109
|
+
&& tar xf deploy.tar \
|
110
|
+
&& cd ${docker_repository} \
|
111
|
+
&& tar -cf - . | ssh ${manager} 'cd $$(mktemp -d) && chmod 0700 . && cat - | tar -x && make deploy-stack && rm -r $$(pwd)'
|
112
|
+
else
|
113
|
+
$(MAKE) bundle \
|
114
|
+
&& workdir=$$(mktemp -d) \
|
115
|
+
&& mv deploy.tar $${workdir}/ \
|
116
|
+
&& cd $${workdir} \
|
117
|
+
&& tar xf deploy.tar \
|
118
|
+
&& cd ${docker_repository} \
|
119
|
+
&& cp "${env_file}" ./.env \
|
120
|
+
&& tar -cf - . | ssh ${manager} 'cd $$(mktemp -d) && chmod 0700 . && cat - | tar -x && make deploy-stack && rm -r $$(pwd)'
|
121
|
+
endif
|
122
|
+
|
93
123
|
### Database utility commands ###
|
94
124
|
|
95
125
|
.PHONY: migrate
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|