dockersitter 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/.gitignore +1 -0
- data/bin/dockersitter +0 -1
- data/lib/commands/create.rb +19 -2
- data/lib/commands/init.rb +2 -0
- data/lib/docker_mgr/version.rb +1 -1
- data/lib/templates/docker-compose.yml.erb +1 -1
- data/lib/util.rb +34 -3
- data/test.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecd7654d00eb850033444a96ff9741164b1981b5
|
4
|
+
data.tar.gz: a7c0da589330e67c89179fa79330d85b3323cc66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dd3526fb7ed823669cfafa3bc767728d6da621ad407f2f58ceead9740651330070ee86a4742f4c8573a53cef143ad5ff584d2fdf8ed7338246c8b7bb6e11bb
|
7
|
+
data.tar.gz: 741f14abc3f287116e67acb17256b86ef0fe33813f894007b8390c00f04d82e44215a2d8c0d661324fa2997b6a25ec7e41bde04eb6cd528d02e6af9ff9a954b7
|
data/.gitignore
CHANGED
data/bin/dockersitter
CHANGED
data/lib/commands/create.rb
CHANGED
@@ -40,15 +40,26 @@ class Create < Thor
|
|
40
40
|
:desc => 'the volumes your data-container will mount',
|
41
41
|
:aliases => 'v',
|
42
42
|
:default => ["/var"]
|
43
|
+
option :cert,
|
44
|
+
:desc => "creates a ssl certificate for this app",
|
45
|
+
:aliases => 'c'
|
46
|
+
option :subdomain,
|
47
|
+
:desc => "the subdomain for this app",
|
48
|
+
:type => :string
|
49
|
+
|
43
50
|
def app(app_name)
|
51
|
+
subdomain = options[:subdomain] ? options[:subdomain] : app_name.gsub(/\s/,"-").downcase
|
52
|
+
puts config[:host]
|
53
|
+
@domain = "#{subdomain}.#{config[:host]}"
|
44
54
|
@app_name = app_name
|
45
|
-
@user_email =
|
46
|
-
@user_name =
|
55
|
+
@user_email = config[:email]
|
56
|
+
@user_name = config[:name]
|
47
57
|
app_path = "#{apps_dir}/#{@app_name}"
|
48
58
|
template "docker-compose.yml.erb","#{app_path}/docker-compose.yml"
|
49
59
|
empty_directory "#{app_path}/administration/installation"
|
50
60
|
empty_directory "#{app_path}/administration/hooks/backup.d"
|
51
61
|
empty_directory "#{app_path}/administration/hooks/restore.d"
|
62
|
+
|
52
63
|
template "Dockerfile.erb","#{app_path}/Dockerfile" if options[:dockerfile]
|
53
64
|
unless options[:packages].empty?
|
54
65
|
options[:packages].each do |package|
|
@@ -58,8 +69,14 @@ class Create < Thor
|
|
58
69
|
|
59
70
|
FileUtils.ln("#{install_dir}/scriptrunner.sh",
|
60
71
|
"#{app_path}/administration/scriptrunner.sh")
|
72
|
+
|
61
73
|
end
|
62
74
|
append_to_file "#{routine_dir}/backup_routine", "docker_mgr backup_app #{app_name}"
|
75
|
+
create_file "#{vhost_dir}/#{app_name}"
|
76
|
+
if options[:cert]
|
77
|
+
app_cert = "#{cert_dir}/#{@domain}"
|
78
|
+
puts `openssl req -x509 -newkey rsa:4096 -subj '/CN=#{config[:host]}' -nodes -keyout #{app_cert}.key -out #{app_cert}.crt`
|
79
|
+
end
|
63
80
|
end
|
64
81
|
|
65
82
|
desc "image IMAGE_NAME","creates a new image."
|
data/lib/commands/init.rb
CHANGED
@@ -14,6 +14,8 @@ class Init < Thor::Group
|
|
14
14
|
empty_directory "docker/base_images"
|
15
15
|
directory "admin","docker/admin"
|
16
16
|
empty_directory "docker/ci_runner"
|
17
|
+
empty_directory "docker/proxy/ca_certs"
|
18
|
+
empty_directory "docker/proxy/vhosts.d"
|
17
19
|
puts `git init docker`
|
18
20
|
end
|
19
21
|
|
data/lib/docker_mgr/version.rb
CHANGED
data/lib/util.rb
CHANGED
@@ -18,6 +18,7 @@ module DockerMgr
|
|
18
18
|
end
|
19
19
|
|
20
20
|
|
21
|
+
|
21
22
|
def backup_dir
|
22
23
|
"#{root_dir}/backup"
|
23
24
|
end
|
@@ -47,6 +48,37 @@ module DockerMgr
|
|
47
48
|
"#{admin_dir}/installation_scripts"
|
48
49
|
end
|
49
50
|
|
51
|
+
def proxy_dir
|
52
|
+
"#{root_dir}/proxy"
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
def cert_dir
|
58
|
+
"#{proxy_dir}/ca_certs"
|
59
|
+
end
|
60
|
+
|
61
|
+
def vhost_dir
|
62
|
+
"#{proxy_dir}/vhost.d"
|
63
|
+
end
|
64
|
+
|
65
|
+
def config
|
66
|
+
if File.exist? "#{admin_dir}/config.yml"
|
67
|
+
YAML.load_file "#{admin_dir}/config.yml"
|
68
|
+
else
|
69
|
+
result = Hash.new
|
70
|
+
result[:email] = extract_email
|
71
|
+
result[:name] = extract_name
|
72
|
+
host = "#{result[:name].gsub(/\s/,'-').downcase}.de"
|
73
|
+
puts "pleas enter your host-name (#{host})"
|
74
|
+
choice = STDIN.gets.chomp
|
75
|
+
result[:host] = choice.empty? ? host : choice
|
76
|
+
File.write "#{admin_dir}/config.yml", result.to_yaml
|
77
|
+
result
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
50
82
|
def extract_date(entry)
|
51
83
|
/_\d+\./.match(entry).to_s.chop[1..-1].to_i
|
52
84
|
end
|
@@ -98,12 +130,11 @@ module DockerMgr
|
|
98
130
|
|
99
131
|
|
100
132
|
def extract_git_variable(name)
|
101
|
-
|
102
|
-
result =
|
133
|
+
git_config = `git config --list`
|
134
|
+
result = git_config.lines.grep(/#{Regexp.quote(name)}/).map{|e| e.split('=')[1].chomp }.first
|
103
135
|
unless result
|
104
136
|
puts "please enter your #{name.split('.')[1]}"
|
105
137
|
result = STDIN.gets.chomp
|
106
|
-
`git config --global #{name} #{result}`
|
107
138
|
end
|
108
139
|
result
|
109
140
|
end
|
data/test.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
|
6
|
+
if File.exist? "config.yml"
|
7
|
+
config = YAML.load_file("config.yml")
|
8
|
+
puts config.inspect
|
9
|
+
else
|
10
|
+
config = Hash.new
|
11
|
+
puts "pleas enter your email"
|
12
|
+
config[:email] = STDIN.gets.chomp
|
13
|
+
puts "please enter your name"
|
14
|
+
config[:name] = STDIN.gets.chomp
|
15
|
+
puts "pleas enter your host-name (leave blank if you don't have one)"
|
16
|
+
config[:host] = STDIN.gets.chomp
|
17
|
+
File.write "config.yml",config.to_yaml
|
18
|
+
end
|
19
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockersitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rene Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/util.rb
|
152
152
|
- spec/docker_mgr_spec.rb
|
153
153
|
- spec/spec_helper.rb
|
154
|
+
- test.rb
|
154
155
|
homepage: https://rubygems.org/gems/docker-mgr
|
155
156
|
licenses:
|
156
157
|
- GPL
|