freighter 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/freighter/deploy.rb +14 -2
- data/lib/freighter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9739746b3edb3b6a5501f9a06527001ba44bde9a
|
4
|
+
data.tar.gz: 2286c47c829338ab1517f253d91e708015e054ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 346ef0d893e55776c1b350ea8365a7111c1cd04c51de5e4581eb27fd298d60780cba18fd2a2d4ac2af5a80a3a4828cb2642a5ff64f636c1a11a170c4044ccdb7
|
7
|
+
data.tar.gz: 63d2046ad8739b5bf6d3bffb2cfbe24226c5b3dcf80c342ebb6370787da1ca8e72e8c8297b5eb09e54de852a8ceb65df2055c51618615510ecfab98adce2ffdb
|
data/lib/freighter/deploy.rb
CHANGED
@@ -69,10 +69,22 @@ module Freighter
|
|
69
69
|
|
70
70
|
# determine if a the latest version of the image is currently running
|
71
71
|
matching_containers = containers_matching_port_map(Docker::Container.all, image['containers'].map { |c| c['port_mapping'] })
|
72
|
-
|
72
|
+
|
73
|
+
# stop previous container and start up a new container with the latest image
|
74
|
+
stopped_containers = []
|
75
|
+
current_running_containers = []
|
76
|
+
matching_containers.each do |container|
|
77
|
+
if pull_response.id =~ /^#{container.info['Image']}/
|
78
|
+
current_running_containers << container
|
79
|
+
else
|
80
|
+
Docker::Container.get(container.id).stop
|
81
|
+
stopped_containers << container
|
82
|
+
end
|
83
|
+
end
|
84
|
+
if !current_running_containers.empty? and stopped_containers.empty?
|
73
85
|
logger.info msg["Container already running with the latest image: #{pull_response.id}"]
|
74
86
|
else
|
75
|
-
|
87
|
+
logger.info msg["Stopped containers: #{stopped_containers.map(&:info).map(&:to_json)}"]
|
76
88
|
results = update_containers matching_containers, image
|
77
89
|
logger.info msg["Finished:"]
|
78
90
|
logger.info msg[" started: #{results[:started]}"]
|
data/lib/freighter/version.rb
CHANGED