dokku-cli 0.2.2 → 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/lib/dokku_cli.rb +28 -12
- data/lib/dokku_cli/certs.rb +29 -0
- data/lib/dokku_cli/config.rb +2 -2
- data/lib/dokku_cli/events.rb +24 -0
- data/lib/dokku_cli/keys.rb +12 -0
- data/lib/dokku_cli/nginx.rb +10 -0
- data/lib/dokku_cli/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66b111f35ffd639674af09b02f89b0b37a3d0604
|
4
|
+
data.tar.gz: 158a398dce6993965e22f10f13cf1c4acf456654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3157441fdbb7b1a22a31d83714948ec8375e9da6f7e886c643c1f437f90e70a70a1eddad5a9e6cb34467b95d318c4c8addf0a26ab3678df5a48bd0c4b3ce3a71
|
7
|
+
data.tar.gz: 2e40868e620eb52b66f9f03cfe6717e736eecf63171e4df632b891758c555493188aab2c3d1ed795b44884da67e70a1f7d6b535513da1442062c4c94d6b15cae
|
data/lib/dokku_cli.rb
CHANGED
@@ -5,6 +5,9 @@ require "dokku_cli/config"
|
|
5
5
|
require "dokku_cli/domains"
|
6
6
|
require "dokku_cli/nginx"
|
7
7
|
require "dokku_cli/ps"
|
8
|
+
require "dokku_cli/events"
|
9
|
+
require "dokku_cli/certs"
|
10
|
+
require "dokku_cli/keys"
|
8
11
|
|
9
12
|
module DokkuCli
|
10
13
|
class Cli < Thor
|
@@ -24,7 +27,7 @@ module DokkuCli
|
|
24
27
|
if args.empty?
|
25
28
|
run_command "logs #{app_name}"
|
26
29
|
else
|
27
|
-
command = "ssh dokku@#{domain} logs #{app_name} #{args}"
|
30
|
+
command = "ssh -p #{port} dokku@#{domain} logs #{app_name} #{args}"
|
28
31
|
puts "Running #{command}..."
|
29
32
|
exec(command)
|
30
33
|
end
|
@@ -51,7 +54,7 @@ module DokkuCli
|
|
51
54
|
|
52
55
|
desc "ssh", "Start an SSH session as root user"
|
53
56
|
def ssh
|
54
|
-
command = "ssh root@#{domain}"
|
57
|
+
command = "ssh -p #{port} root@#{domain}"
|
55
58
|
puts "Running #{command}..."
|
56
59
|
exec(command)
|
57
60
|
end
|
@@ -73,7 +76,7 @@ module DokkuCli
|
|
73
76
|
|
74
77
|
def method_missing(method, *args, &block)
|
75
78
|
if method.to_s.split(":").length >= 2
|
76
|
-
self.send(method.to_s.gsub(":", "_"), *args)
|
79
|
+
self.send(method.to_s.gsub(":", "_").gsub("-", "_"), *args)
|
77
80
|
elsif method == :run
|
78
81
|
self.walk(*args)
|
79
82
|
else
|
@@ -84,24 +87,37 @@ module DokkuCli
|
|
84
87
|
private
|
85
88
|
|
86
89
|
def app_name
|
87
|
-
@app_name ||=
|
90
|
+
@app_name ||= git_config["app_name"]
|
88
91
|
end
|
89
92
|
|
90
93
|
def domain
|
91
|
-
@domain ||=
|
94
|
+
@domain ||= git_config["domain"]
|
92
95
|
end
|
93
96
|
|
94
|
-
def
|
97
|
+
def port
|
98
|
+
@port ||= git_config["port"]
|
99
|
+
end
|
100
|
+
|
101
|
+
def git_config
|
95
102
|
remote = "dokku"
|
96
103
|
remote = options[:remote] if options[:remote]
|
97
104
|
|
98
|
-
@
|
99
|
-
|
100
|
-
exit unless File.exist?(
|
105
|
+
@git_config ||= begin
|
106
|
+
config_path = File.join(Dir.pwd, ".git", "config")
|
107
|
+
exit unless File.exist?(config_path)
|
108
|
+
config_file = File.read(config_path)
|
109
|
+
|
110
|
+
# Default dokku config: dokku@host.com:app
|
111
|
+
default_style_regex = /\[remote "dokku"\]\s+url \= dokku@(?<domain>.*):(?<app_name>.*)$/
|
112
|
+
match ||= config_file.match(default_style_regex)
|
113
|
+
|
114
|
+
# SSH dokku config: ssh://dokku@host.com:1337/app
|
115
|
+
ssh_style_regex = /\[remote "dokku"\]\s+url \= ssh:\/\/dokku@(?<domain>.*):(?<port>.*)\/(?<app_name>.*)$/
|
116
|
+
match ||= config_file.match(ssh_style_regex)
|
101
117
|
|
102
|
-
git_config = File.read(git_config)
|
103
|
-
match = git_config.match(/\[remote "#{remote}"\]\s+url \= dokku@(.*):(.*)$/).to_a
|
104
118
|
exit unless match
|
119
|
+
match = Hash[match.names.zip(match.captures)]
|
120
|
+
match["port"] ||= 22
|
105
121
|
|
106
122
|
match
|
107
123
|
end
|
@@ -109,7 +125,7 @@ module DokkuCli
|
|
109
125
|
|
110
126
|
def run_command(command)
|
111
127
|
command = command.gsub(/ --remote=[\S]*/, '')
|
112
|
-
dokku_command = "ssh -t dokku@#{domain} #{command}"
|
128
|
+
dokku_command = "ssh -t -p #{port} dokku@#{domain} #{command}"
|
113
129
|
|
114
130
|
puts "Running #{dokku_command}..."
|
115
131
|
exec(dokku_command)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module DokkuCli
|
2
|
+
class Cli < Thor
|
3
|
+
|
4
|
+
desc "certs:add CRT KEY", "Add an ssl endpoint to an app. Can also import from a tarball on stdin."
|
5
|
+
def certs_add(crt, key)
|
6
|
+
run_command "certs:add #{app_name} #{crt} #{key}"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "certs:generate DOMAIN", "Generate a key and certificate signing request (and self-signed certificate)"
|
10
|
+
def certs_generate(domain)
|
11
|
+
run_command "certs:generate #{app_name} #{domain}"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "certs:info", "Show certificate information for an ssl endpoint."
|
15
|
+
def certs_info
|
16
|
+
run_command "certs:info #{app_name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "certs:remove", "Remove an SSL Endpoint from an app."
|
20
|
+
def certs_remove
|
21
|
+
run_command "certs:remove #{app_name}"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "certs:update CRT KEY", "Update an SSL Endpoint on an app. Can also import from a tarball on stdin"
|
25
|
+
def certs_remove(crt, key)
|
26
|
+
run_command "certs:update #{app_name} #{crt} #{key}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/dokku_cli/config.rb
CHANGED
@@ -34,7 +34,7 @@ module DokkuCli
|
|
34
34
|
end
|
35
35
|
}
|
36
36
|
|
37
|
-
command = "ssh #{user}@#{domain} "
|
37
|
+
command = "ssh -p #{port} #{user}@#{domain} "
|
38
38
|
command += user == "root" ? "dokku " : ""
|
39
39
|
command += "config:set #{app_name} #{args.join(' ')}"
|
40
40
|
|
@@ -46,7 +46,7 @@ module DokkuCli
|
|
46
46
|
def config_unset(*args)
|
47
47
|
run_command "config:unset #{app_name} #{args.join(' ')}"
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
desc "config:set:file path/to/file", "Set one or more environment variables from file"
|
51
51
|
def config_set_file(config_file)
|
52
52
|
config_params = ""
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module DokkuCli
|
2
|
+
class Cli < Thor
|
3
|
+
|
4
|
+
desc "events", "Show the last events (-t follows)"
|
5
|
+
def events
|
6
|
+
run_command "events #{app_name}"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "events:list", "List logged events"
|
10
|
+
def events_list
|
11
|
+
run_command "events:list #{app_name}"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "events:on", "Enable events logger"
|
15
|
+
def events_on
|
16
|
+
run_command "events:on #{app_name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "events:off", "Disable events logger"
|
20
|
+
def events_off
|
21
|
+
run_command "events:off #{app_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module DokkuCli
|
2
|
+
class Cli < Thor
|
3
|
+
|
4
|
+
desc "keys:add PATH DESCRIPTION", "Add the ssh key to your dokku machine."
|
5
|
+
def keys_add(path, description)
|
6
|
+
command = "cat #{path} | ssh -p #{port} root@#{domain} 'sudo sshcommand acl-add dokku #{description}'"
|
7
|
+
|
8
|
+
puts "Adding #{path} to your dokku machine..."
|
9
|
+
exec(command)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/dokku_cli/nginx.rb
CHANGED
@@ -5,5 +5,15 @@ module DokkuCli
|
|
5
5
|
def nginx_build
|
6
6
|
run_command "nginx:build-config #{app_name}"
|
7
7
|
end
|
8
|
+
|
9
|
+
desc "nginx:access-logs", "Show the nginx access logs for an application"
|
10
|
+
def nginx_access_logs
|
11
|
+
run_command "nginx:access-logs #{app_name}"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "nginx:error-logs ", "Show the nginx access logs for an application"
|
15
|
+
def nginx_error_logs
|
16
|
+
run_command "nginx:error-logs #{app_name}"
|
17
|
+
end
|
8
18
|
end
|
9
19
|
end
|
data/lib/dokku_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokku-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Szturo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -54,8 +54,11 @@ files:
|
|
54
54
|
- bin/dokku
|
55
55
|
- dokku-cli.gemspec
|
56
56
|
- lib/dokku_cli.rb
|
57
|
+
- lib/dokku_cli/certs.rb
|
57
58
|
- lib/dokku_cli/config.rb
|
58
59
|
- lib/dokku_cli/domains.rb
|
60
|
+
- lib/dokku_cli/events.rb
|
61
|
+
- lib/dokku_cli/keys.rb
|
59
62
|
- lib/dokku_cli/nginx.rb
|
60
63
|
- lib/dokku_cli/ps.rb
|
61
64
|
- lib/dokku_cli/version.rb
|
@@ -79,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
82
|
version: '0'
|
80
83
|
requirements: []
|
81
84
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.4.
|
85
|
+
rubygems_version: 2.4.5.1
|
83
86
|
signing_key:
|
84
87
|
specification_version: 4
|
85
88
|
summary: Command line tool for Dokku.
|