ukku 0.1.3 → 0.2.1
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/ukku +9 -1
- data/lib/ukku.rb +3 -0
- data/lib/ukku/configure_command.rb +7 -6
- data/lib/ukku/ps_add_command.rb +36 -0
- data/lib/ukku/ps_command.rb +31 -0
- data/lib/ukku/ps_remove_command.rb +36 -0
- data/lib/ukku/set_var_command.rb +5 -1
- data/lib/ukku/vars_command.rb +1 -1
- data/lib/ukku/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fb9c1ffa5635540ca22a07a596acd32aba2da94
|
|
4
|
+
data.tar.gz: d72c921c54053e4c6068e5bcc39a8d0ec0ee2526
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb7c6348d92265ad55c05058a201c578c403044172653f2ce575b226d207be2f89b739f52d76eb5f5e26128c7548b3955f0b987cb8874b2b966a0dff62712f42
|
|
7
|
+
data.tar.gz: 0d604e16e402b753a23768605100e76f2867cb898045a026ba3d26fec927686c7d53a43e010f2c930bf1654bbae2f5a21a6a574167d9c76693fdb2090c091658
|
data/bin/ukku
CHANGED
|
@@ -10,11 +10,15 @@ doc = <<DOCOPT
|
|
|
10
10
|
Ukku.
|
|
11
11
|
|
|
12
12
|
Usage:
|
|
13
|
-
ukku configure [-u USER] [-i IDENTITY_FILE] HOST [NAME]
|
|
13
|
+
ukku configure [-u USER] [-i IDENTITY_FILE] [--no-pg] HOST [NAME]
|
|
14
14
|
ukku [--app=NAME] run COMMAND...
|
|
15
15
|
ukku [--app=NAME] keys:upload PUBLIC_KEY_FILE
|
|
16
16
|
ukku [--app=NAME] vars
|
|
17
17
|
ukku [--app=NAME] vars:set VAR_NAME VAR_VALUE
|
|
18
|
+
ukku [--app=NAME] ps
|
|
19
|
+
ukku [--app=NAME] ps:add TYPE
|
|
20
|
+
ukku [--app=NAME] ps:remove TYPE
|
|
21
|
+
ukku [--app=NAME] ps:restart [TYPE]
|
|
18
22
|
|
|
19
23
|
Arguments:
|
|
20
24
|
HOST Domain or IP of your server.
|
|
@@ -39,9 +43,13 @@ begin
|
|
|
39
43
|
UploadKeyCommand.new.execute(args) if args['keys:upload']
|
|
40
44
|
VarsCommand.new.execute(args) if args['vars']
|
|
41
45
|
SetVarCommand.new.execute(args) if args['vars:set']
|
|
46
|
+
PsCommand.new.execute(args) if args['ps']
|
|
47
|
+
PsAddCommand.new.execute(args) if args['ps:add']
|
|
48
|
+
PsRemoveCommand.new.execute(args) if args['ps:remove']
|
|
42
49
|
rescue Docopt::Exit => e
|
|
43
50
|
puts doc.strip
|
|
44
51
|
rescue Exception => e
|
|
45
52
|
puts " ! #{e.message}"
|
|
53
|
+
puts e.backtrace
|
|
46
54
|
exit 1
|
|
47
55
|
end
|
data/lib/ukku.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class ConfigureCommand
|
|
2
|
-
|
|
3
2
|
def execute(args)
|
|
4
3
|
host = args['HOST']
|
|
5
4
|
name = args['NAME'] || "production"
|
|
6
5
|
user = args['--user'] || "root"
|
|
6
|
+
no_pg = args['--no-pg']
|
|
7
7
|
identity_file = args['-i']
|
|
8
8
|
|
|
9
9
|
entry = { "host" => host, "user" => user } # the entry to add to UKKU_FILE
|
|
@@ -21,7 +21,7 @@ class ConfigureCommand
|
|
|
21
21
|
if server_ready
|
|
22
22
|
puts "The server is already configured ... skipping"
|
|
23
23
|
else
|
|
24
|
-
configure_server(conn)
|
|
24
|
+
configure_server(conn, no_pg)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
repo = fetch_repo
|
|
@@ -31,7 +31,7 @@ class ConfigureCommand
|
|
|
31
31
|
|
|
32
32
|
append_ukku_file_to_gitignore
|
|
33
33
|
|
|
34
|
-
print_ssh_config if identity_file
|
|
34
|
+
print_ssh_config(host, identity_file) if identity_file
|
|
35
35
|
|
|
36
36
|
puts
|
|
37
37
|
puts "Your server is configured! Deploy your application using 'git push #{name} master'"
|
|
@@ -58,10 +58,11 @@ class ConfigureCommand
|
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def configure_server(conn)
|
|
61
|
+
def configure_server(conn, no_pg)
|
|
62
62
|
wget1_command = "wget https://raw.githubusercontent.com/germanescobar/ukku/master/server/bootstrap.sh"
|
|
63
63
|
chmod_command = "chmod 755 bootstrap.sh"
|
|
64
|
-
run_command = "./bootstrap.sh"
|
|
64
|
+
run_command = "sudo ./bootstrap.sh"
|
|
65
|
+
run_command += " -p" unless no_pg
|
|
65
66
|
conn.execute "#{wget1_command} && #{chmod_command} && #{run_command}"
|
|
66
67
|
end
|
|
67
68
|
|
|
@@ -101,7 +102,7 @@ class ConfigureCommand
|
|
|
101
102
|
end
|
|
102
103
|
end
|
|
103
104
|
|
|
104
|
-
def print_ssh_config
|
|
105
|
+
def print_ssh_config(host, identity_file)
|
|
105
106
|
puts "*********************************************************************"
|
|
106
107
|
puts "ATTENTION: Add the following to '~/.ssh/config' before deploying"
|
|
107
108
|
puts "(create the file if necessary; erase any other entry with same host):"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class PsAddCommand
|
|
2
|
+
def execute(args)
|
|
3
|
+
type = args['TYPE']
|
|
4
|
+
|
|
5
|
+
if !File.exist?(UKKU_FILE)
|
|
6
|
+
raise "No application configured. Run 'ukku configure HOST' first."
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
data = YAML.load_file(UKKU_FILE)
|
|
10
|
+
name, server = data.first
|
|
11
|
+
if name.nil?
|
|
12
|
+
raise "No application configured. Run 'ukku configure <host>' first."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if data.length > 1
|
|
16
|
+
if args['--app'].empty?
|
|
17
|
+
raise "No app specified, use the --app NAME option"
|
|
18
|
+
else
|
|
19
|
+
name = args[--app]
|
|
20
|
+
sever = data[name]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
host = server['host']
|
|
25
|
+
user = server['user']
|
|
26
|
+
identity_file = server['identity_file']
|
|
27
|
+
|
|
28
|
+
puts "Adding process type '#{type}' on #{host} ..."
|
|
29
|
+
conn = Connection.new(host, user, identity_file)
|
|
30
|
+
conn.execute("sudo touch /etc/ukku/ps-types/#{type}")
|
|
31
|
+
begin
|
|
32
|
+
conn.execute("launchapp")
|
|
33
|
+
rescue Subprocess::NonZeroExit => e
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
class PsCommand
|
|
2
|
+
def execute(args)
|
|
3
|
+
type = args['TYPE']
|
|
4
|
+
|
|
5
|
+
if !File.exist?(UKKU_FILE)
|
|
6
|
+
raise "No application configured. Run 'ukku configure HOST' first."
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
data = YAML.load_file(UKKU_FILE)
|
|
10
|
+
name, server = data.first
|
|
11
|
+
if name.nil?
|
|
12
|
+
raise "No application configured. Run 'ukku configure <host>' first."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if data.length > 1
|
|
16
|
+
if args['--app'].empty?
|
|
17
|
+
raise "No app specified, use the --app NAME option"
|
|
18
|
+
else
|
|
19
|
+
name = args[--app]
|
|
20
|
+
sever = data[name]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
host = server['host']
|
|
25
|
+
user = server['user']
|
|
26
|
+
identity_file = server['identity_file']
|
|
27
|
+
|
|
28
|
+
conn = Connection.new(host, user, identity_file)
|
|
29
|
+
conn.execute("ls /etc/ukku/ps-types")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class PsRemoveCommand
|
|
2
|
+
def execute(args)
|
|
3
|
+
type = args['TYPE']
|
|
4
|
+
|
|
5
|
+
if !File.exist?(UKKU_FILE)
|
|
6
|
+
raise "No application configured. Run 'ukku configure HOST' first."
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
data = YAML.load_file(UKKU_FILE)
|
|
10
|
+
name, server = data.first
|
|
11
|
+
if name.nil?
|
|
12
|
+
raise "No application configured. Run 'ukku configure <host>' first."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if data.length > 1
|
|
16
|
+
if args['--app'].empty?
|
|
17
|
+
raise "No app specified, use the --app NAME option"
|
|
18
|
+
else
|
|
19
|
+
name = args[--app]
|
|
20
|
+
sever = data[name]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
host = server['host']
|
|
25
|
+
user = server['user']
|
|
26
|
+
identity_file = server['identity_file']
|
|
27
|
+
|
|
28
|
+
puts "Removing process type '#{type}' on #{host} ..."
|
|
29
|
+
conn = Connection.new(host, user, identity_file)
|
|
30
|
+
conn.execute("sudo rm /etc/ukku/ps-types/#{type} && docker kill app-#{type} && docker rm app-#{type}")
|
|
31
|
+
begin
|
|
32
|
+
conn.execute("launchapp")
|
|
33
|
+
rescue Subprocess::NonZeroExit => e
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/ukku/set_var_command.rb
CHANGED
|
@@ -23,6 +23,10 @@ class SetVarCommand
|
|
|
23
23
|
identity_file = server['identity_file']
|
|
24
24
|
|
|
25
25
|
conn = Connection.new(host, user, identity_file)
|
|
26
|
-
conn.execute("mkdir -p /etc/vars && echo '#{var_value}' > /etc/vars/#{var_name}
|
|
26
|
+
conn.execute("sudo mkdir -p /etc/ukku/vars && echo '#{var_value}' > /etc/ukku/vars/#{var_name}")
|
|
27
|
+
begin
|
|
28
|
+
conn.execute("launchapp")
|
|
29
|
+
rescue Subprocess::NonZeroExit => e
|
|
30
|
+
end
|
|
27
31
|
end
|
|
28
32
|
end
|
data/lib/ukku/vars_command.rb
CHANGED
|
@@ -20,6 +20,6 @@ class VarsCommand
|
|
|
20
20
|
identity_file = server['identity_file']
|
|
21
21
|
|
|
22
22
|
conn = Connection.new(host, user, identity_file)
|
|
23
|
-
conn.execute("mkdir -p /etc/vars && FILES=/etc/vars/*; for f in $FILES; do echo \"${f##*/}=$(<$f)\"; done")
|
|
23
|
+
conn.execute("sudo mkdir -p /etc/ukku/vars && FILES=/etc/ukku/vars/*; for f in $FILES; do echo \"${f##*/}=$(<$f)\"; done")
|
|
24
24
|
end
|
|
25
25
|
end
|
data/lib/ukku/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ukku
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Germán Escobar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -125,6 +125,9 @@ files:
|
|
|
125
125
|
- lib/ukku.rb
|
|
126
126
|
- lib/ukku/configure_command.rb
|
|
127
127
|
- lib/ukku/connection.rb
|
|
128
|
+
- lib/ukku/ps_add_command.rb
|
|
129
|
+
- lib/ukku/ps_command.rb
|
|
130
|
+
- lib/ukku/ps_remove_command.rb
|
|
128
131
|
- lib/ukku/run_command.rb
|
|
129
132
|
- lib/ukku/set_var_command.rb
|
|
130
133
|
- lib/ukku/upload_key_command.rb
|