phase 1.0.0.rc2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phase/cli/ssh.rb +7 -1
- data/lib/phase/kit/deploy/build.rb +1 -1
- data/lib/phase/kit/deploy/deployment.rb +19 -6
- data/lib/phase/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5ff6bc6d3419a4db17beedd39f87f202ba5bf81
|
4
|
+
data.tar.gz: f6a4b30d2ce4b88efcffba57df2ba3e55bf344d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35bce38c4b5a50a287b49adaff057b08991e5f8de223f9fd4b11b44be66dff0ce728fccaab3aeafea16f6b83d682708a4ba12584fc6c05551a102aca9c444421
|
7
|
+
data.tar.gz: 5f5bf3a268ede5bae6b1c6511e232adcdea5b00b8f14c2287540d4fa8a2aa3a1a347e2bdda792275b675caa3d3612365e691523063b5cf6abb4e76ac2fa9ded8
|
data/lib/phase/cli/ssh.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Phase
|
2
2
|
module CLI
|
3
3
|
class SSH < Command
|
4
|
+
|
5
|
+
DEFAULT_CONNECTION_STRING = "ssh -A".freeze
|
6
|
+
|
4
7
|
command :ssh do |c|
|
5
8
|
c.syntax = "phase ssh [-i instance_id] [-n instance_name] [-r instance_role] [-u user] [-c conn_str] [username@instance_name|instance_id] [command...]"
|
6
9
|
|
@@ -12,7 +15,7 @@ module Phase
|
|
12
15
|
|
13
16
|
c.description = "Connects to the the specified instance via SSH."
|
14
17
|
c.action do |args, options|
|
15
|
-
options.default role: ::Phase.config.bastion_role, conn:
|
18
|
+
options.default role: ::Phase.config.bastion_role, conn: DEFAULT_CONNECTION_STRING
|
16
19
|
new(args, options).run
|
17
20
|
end
|
18
21
|
end
|
@@ -24,6 +27,9 @@ module Phase
|
|
24
27
|
ssh_command = args.last if args.count > 1
|
25
28
|
|
26
29
|
if ssh_command
|
30
|
+
# Force pseudo-tty allocation for remote console/tail tasks
|
31
|
+
options.conn = "ssh -At" if options.conn == DEFAULT_CONNECTION_STRING
|
32
|
+
|
27
33
|
log "running on instance #{ instance.resource.id }: `#{ ssh_command }'"
|
28
34
|
exec "#{ options.conn } #{ username }@#{ instance.resource.dns_name } #{ ssh_command }"
|
29
35
|
else
|
@@ -24,25 +24,38 @@ module Phase
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def deploy_image(hosts, options = {})
|
27
|
-
image_name
|
28
|
-
server_count
|
29
|
-
run_flags
|
27
|
+
image_name = docker_image_name
|
28
|
+
server_count = 2 # FIXME: make this a config var
|
29
|
+
run_flags = docker_run_flags
|
30
|
+
delay_seconds = 35 # FIXME: make this a config var
|
30
31
|
|
31
32
|
::SSHKit::Coordinator.new(hosts).each(options) do
|
32
33
|
execute(:docker, :pull, image_name)
|
33
34
|
|
34
35
|
# TODO: fail if pending migrations
|
35
|
-
execute(:docker, :run, run_flags, "--rm -it", image_name,
|
36
|
-
"bundle exec rails runner '::ActiveRecord::Migrator.needs_migration? ? exit(1) : exit(0)'")
|
36
|
+
# execute(:docker, :run, run_flags, "--rm -it", image_name,
|
37
|
+
# "bundle exec rails runner '::ActiveRecord::Migrator.needs_migration? ? exit(1) : exit(0)'")
|
37
38
|
|
38
39
|
server_count.times do |i|
|
40
|
+
progress_bar = ::ProgressBar.new("Deploying ##{i}", delay_seconds)
|
41
|
+
|
39
42
|
server_name = "server-#{i}"
|
40
43
|
port_number = 3000 + i # FIXME: make this a config var
|
41
44
|
|
42
45
|
execute(:docker, :stop, server_name, raise_on_non_zero_exit: false)
|
43
46
|
execute(:docker, :rm, server_name, raise_on_non_zero_exit: false)
|
44
47
|
|
45
|
-
execute(:docker, :run, run_flags, "-p #{port_number}:3000 -d", image_name)
|
48
|
+
execute(:docker, :run, run_flags, "-p #{port_number}:3000 --name #{server_name} -d", image_name)
|
49
|
+
|
50
|
+
# TODO: test for server responding correctly
|
51
|
+
unless i == server_count - 1
|
52
|
+
delay_seconds.times do
|
53
|
+
sleep 1
|
54
|
+
progress_bar.inc
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
progress_bar.finish
|
46
59
|
end
|
47
60
|
end
|
48
61
|
end
|
data/lib/phase/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piers Mainwaring
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|
@@ -256,9 +256,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '2.0'
|
257
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
258
|
requirements:
|
259
|
-
- - "
|
259
|
+
- - ">="
|
260
260
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
261
|
+
version: '0'
|
262
262
|
requirements: []
|
263
263
|
rubyforge_project:
|
264
264
|
rubygems_version: 2.2.3
|