coreos-deploy 0.2.0 → 0.3.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/bin/coreos +30 -2
- data/lib/coreos/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b739662457f02ac1317563581493056e3295865
|
4
|
+
data.tar.gz: bb764556d9e354a97117bc6331ce3d3178e752bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b53a14db773377d7a37bae9cbed7ae821b6f8f303dac57ae24d1af6fe5621a60f4a1a2ded8bd6f33fd6209357b58d01091513f9cd8cba43a2cf1dec02e5523b9
|
7
|
+
data.tar.gz: df6d8bf178191600634648276b3e695494757f19e911474d82c2621b7a467323f73ef28df3134c01aba2afb9dc86aeb501c32941442b97966fafdb5b58961382
|
data/bin/coreos
CHANGED
@@ -10,7 +10,7 @@ def loop_ssh_command(ssh, command)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class CoreOS < Thor
|
13
|
-
desc "deploy HOST", "deploys all services in ./coreos
|
13
|
+
desc "deploy HOST", "deploys all services in ./coreos/$HOST/*.service to HOST"
|
14
14
|
option :services, :type => :array
|
15
15
|
|
16
16
|
def deploy(host)
|
@@ -57,7 +57,7 @@ class CoreOS < Thor
|
|
57
57
|
puts "==> Copying service files to #{host}"
|
58
58
|
system "scp #{base_directory}/*.service #{host}:"
|
59
59
|
|
60
|
-
Net::SSH.start(
|
60
|
+
Net::SSH.start(host, ENV['USER']) do |ssh|
|
61
61
|
if login
|
62
62
|
loop_ssh_command ssh, "docker login #{login}"
|
63
63
|
end
|
@@ -99,6 +99,34 @@ class CoreOS < Thor
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
|
+
|
103
|
+
desc "logs HOSTS", "attaches to journalctl logs for services in HOSTS"
|
104
|
+
def logs(*hosts)
|
105
|
+
abort "./coreos does not exist" unless File.exists? "./coreos"
|
106
|
+
directories = Dir.entries("./coreos").select { |s| s.start_with? *hosts }
|
107
|
+
hosts = directories.map { |d| File.basename d }
|
108
|
+
|
109
|
+
connections = []
|
110
|
+
|
111
|
+
for host in hosts
|
112
|
+
base_directory = "./coreos/#{host}"
|
113
|
+
abort "Directory '#{base_directory}' does not exist" unless File.exists? base_directory
|
114
|
+
|
115
|
+
service_files = Dir.entries(base_directory).select { |s| s.end_with? ".service" }
|
116
|
+
services = service_files.map { |s| File.basename s }
|
117
|
+
|
118
|
+
puts "#{host} ==> #{services}"
|
119
|
+
connections << Net::SSH.start(host, ENV['USER'])
|
120
|
+
connections.last.exec "sudo journalctl -f -u #{services.join " -u "}"
|
121
|
+
end
|
122
|
+
|
123
|
+
condition = Proc.new { |s| s.busy? }
|
124
|
+
|
125
|
+
loop do
|
126
|
+
connections.delete_if { |ssh| !ssh.process(0.1, &condition) }
|
127
|
+
break if connections.empty?
|
128
|
+
end
|
129
|
+
end
|
102
130
|
end
|
103
131
|
|
104
132
|
CoreOS.start(ARGV)
|
data/lib/coreos/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coreos-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Letterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|