dockersitter 0.7.0 → 0.8.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 +2 -0
- data/lib/commands/create.rb +46 -26
- data/lib/commands/delete.rb +1 -1
- data/lib/commands/init.rb +31 -16
- data/lib/commands/restore_app.rb +1 -1
- data/lib/commands/start.rb +1 -1
- data/lib/docker_mgr/version.rb +1 -1
- data/lib/templates/admin/installation_scripts/install_node_buildtools.sh +3 -0
- data/lib/templates/admin/installation_scripts/install_ruby.sh +8 -0
- data/lib/templates/admin/installation_scripts/install_ruby_buildtools.sh +2 -0
- data/lib/templates/admin/installation_scripts/scriptrunner.sh +1 -2
- data/lib/util.rb +17 -1
- metadata +5 -3
- data/lib/commands/.generate.rb.swp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2aa31dc030ca5da6c465bf31e3e8658ce57cafa
|
4
|
+
data.tar.gz: d63ce2038c4617bfff1faa73763c95b9e3f0dfe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d828014ebd3a3d5feef01be03a1e20e93df8685970ef8f4397cb6c3f55422ef6d44dee157820137a62909c223056b2ee53bd4e9b1d091fb3957e567e09260d16
|
7
|
+
data.tar.gz: 46927e3ecfc850320a1921a0febf9d1a684f1c61d91c3135ccf4439541d0caa6c2d9d866fb6d3586fee72e3438c89b27e9d90ed3c0a78ae99dd3219978102ecf
|
data/.gitignore
CHANGED
data/lib/commands/create.rb
CHANGED
@@ -49,29 +49,58 @@ class Create < Thor
|
|
49
49
|
empty_directory "#{app_path}/administration/installation"
|
50
50
|
empty_directory "#{app_path}/administration/hooks/backup.d"
|
51
51
|
empty_directory "#{app_path}/administration/hooks/restore.d"
|
52
|
-
|
53
52
|
template "Dockerfile.erb","#{app_path}/Dockerfile" if options[:dockerfile]
|
54
|
-
unless options[:packages].empty?
|
55
|
-
|
56
|
-
FileUtils.ln("#{install_dir}/install_#{package}.sh",
|
57
|
-
"#{app_path}/administration/installation/install_#{package}.sh")
|
58
|
-
end
|
59
|
-
|
60
|
-
FileUtils.ln("#{install_dir}/scriptrunner.sh",
|
61
|
-
"#{app_path}/administration/scriptrunner.sh")
|
62
|
-
|
63
|
-
end
|
64
|
-
append_to_file "#{routine_dir}/backup_routine", "docker_mgr backup_app #{app_name}"
|
53
|
+
add_packages(app_path,options[:packages]) unless options[:packages].empty?
|
54
|
+
append_to_file "#{routine_dir}/backup_routine", "dockersitter backup_app #{app_name}"
|
65
55
|
create_file "#{vhost_dir}/#{@domain}"
|
66
56
|
if options[:cert]
|
67
57
|
FileUtils.cd "#{admin_dir}/ca" do
|
68
|
-
puts "#{admin_dir}/ca/sign.sh"
|
69
58
|
puts `./sign.sh #{@domain}`
|
70
59
|
end
|
71
60
|
chmod "#{proxy_dir}/certs/#{@domain}.key",0600
|
72
61
|
end
|
73
62
|
end
|
74
|
-
|
63
|
+
|
64
|
+
desc "runner RUNNER_NAME", "create a new runner."
|
65
|
+
option :dockerfile,:type => :boolean,
|
66
|
+
:desc => 'create a dockerfile for the app',:aliases => 'd'
|
67
|
+
option :volumes,:type => :array,
|
68
|
+
:desc => 'the volumes your data-container will mount',:aliases => 'v',
|
69
|
+
:default => ["./data:/data"]
|
70
|
+
option :base,
|
71
|
+
:type => :string,
|
72
|
+
:desc => "the image which the runner is based on.",
|
73
|
+
:aliases => 'b',
|
74
|
+
:default => "runner_base:1.0"
|
75
|
+
option :serve_name,
|
76
|
+
:type => :string,
|
77
|
+
:desc => 'the ci-server, the runner belongs to',
|
78
|
+
:aliases => 's',
|
79
|
+
:default => "gitlab.#{config[:host]}/ci"
|
80
|
+
option :token,
|
81
|
+
:type => :string,
|
82
|
+
:desc => 'the token to register this runner',
|
83
|
+
:aliases => 't',
|
84
|
+
:required => true
|
85
|
+
def runner(runner_name,token)
|
86
|
+
@app_name = runner_name
|
87
|
+
@user_email,@user_name = config.values_at(:email,:name)
|
88
|
+
@base = options[:base]
|
89
|
+
runner_path = "#{runner_dir}/#{@app_name}"
|
90
|
+
template "docker-compose.yml.erb","#{runner_path}/docker-compose.yml"
|
91
|
+
empty_directory "#{runner_path}/administration/installation"
|
92
|
+
template "Dockerfile.erb","#{app_path}/Dockerfile" if options[:dockerfile]
|
93
|
+
add_packages(runner_path,options[:packages]) unless options[:packages].empty?
|
94
|
+
FileUtils.cd(runner_path) do
|
95
|
+
command = %Q(register --non-interactive
|
96
|
+
--url "https://#{options['server_name']}"
|
97
|
+
--registration-token "#{options['token']}"
|
98
|
+
--description "multi-runner"
|
99
|
+
--executor "shell")
|
100
|
+
puts `docker-compose run service #{command}`
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
75
104
|
desc "image IMAGE_NAME","creates a new image."
|
76
105
|
def image(image_name)
|
77
106
|
@user_email,@user_name = config.values_at(:email,:name)
|
@@ -79,21 +108,12 @@ class Create < Thor
|
|
79
108
|
image_path = "#{base_images_dir}/#{image_name}/v1.0"
|
80
109
|
empty_directory "#{image_path}/administration/installation"
|
81
110
|
template "Dockerfile.erb","#{image_path}/Dockerfile"
|
82
|
-
unless options[:packages].empty?
|
83
|
-
|
84
|
-
FileUtils.cp("#{install_dir}/install_#{package}.sh",
|
85
|
-
"#{image_path}/administration/installation/install_#{package}.sh")
|
86
|
-
end
|
87
|
-
|
88
|
-
FileUtils.cp("#{install_dir}/scriptrunner.sh",
|
89
|
-
"#{image_path}/administration/scriptrunner.sh")
|
90
|
-
FileUtils.cp("#{admin_dir}/trust.sh",
|
91
|
-
"#{image_path}/administration/trust.sh")
|
92
|
-
empty_directory("#{image_path}/administration/certificates")
|
93
|
-
end
|
111
|
+
add_packages(image_path) unless options[:packages].empty?
|
112
|
+
add_trust(image_path)
|
94
113
|
@image_name = image_name
|
95
114
|
@version = "1.0"
|
96
115
|
template "build.erb", "#{image_path}/build.sh"
|
97
116
|
FileUtils.chmod 0755, "#{image_path}/build.sh"
|
98
117
|
end
|
118
|
+
|
99
119
|
end
|
data/lib/commands/delete.rb
CHANGED
@@ -12,7 +12,7 @@ class Delete < Thor
|
|
12
12
|
choice = ask "do you want to remove #{@app_name}? (y,N)"
|
13
13
|
abort "aborting" unless choice == 'y'
|
14
14
|
FileUtils.cd "#{apps_dir}/#{@app_name}" do
|
15
|
-
puts `
|
15
|
+
puts `docker-compose -f rm`
|
16
16
|
end
|
17
17
|
puts `tar -zcf #{attic_dir}/#{@app_name}.tar -C #{apps_dir} #{@app_name}`
|
18
18
|
FileUtils.rm_rf "#{apps_dir}/#{@app_name}"
|
data/lib/commands/init.rb
CHANGED
@@ -20,36 +20,51 @@ class Init < Thor::Group
|
|
20
20
|
empty_directory "docker/proxy/certs"
|
21
21
|
empty_directory "docker/proxy/vhosts.d"
|
22
22
|
copy_file "gitignore","docker/.gitignore"
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_ca
|
23
26
|
FileUtils.cd 'docker/admin/ca' do
|
24
27
|
puts `openssl req -x509 -newkey rsa:4096 -keyout rootCA.key -out rootCA.crt -days 7800 -sha256`
|
25
28
|
end
|
26
29
|
chmod 'docker/admin/ca/rootCA.key',0600
|
27
30
|
chmod 'docker/admin/ca/sign.sh',0755
|
28
|
-
puts `git init docker`
|
29
31
|
FileUtils.cd 'docker' do
|
30
32
|
generate_ca_installer
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def init_git
|
37
|
+
puts `git init docker`
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_base_image
|
41
|
+
@user_email,@user_name = config.values_at(:email,:name)
|
42
|
+
image_name = 'base'
|
43
|
+
image_path = "#{base_images_dir}/#{image_name}/v1.0"
|
44
|
+
@image_name = image_name
|
45
|
+
@version = "1.0"
|
46
|
+
@base = "ubuntu:14.04"
|
47
|
+
create_image(image_path,'curl','git')
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_base_runner
|
51
|
+
@image_name = 'runner_base'
|
52
|
+
image_path = "#{base_images_dir}/#{@image_name}/v1.0"
|
53
|
+
@version = "1.0"
|
54
|
+
@base = "ayufan/gitlab-ci-multi-runner:latest"
|
55
|
+
create_image(image_path,'java','node','ruby','ruby_buildtools','node_buildtools')
|
56
|
+
end
|
57
|
+
|
58
|
+
no_tasks do
|
59
|
+
def create_image(image_path,*packages)
|
34
60
|
empty_directory "#{image_path}/administration/installation"
|
35
|
-
@base = "ubuntu:14.04"
|
36
61
|
template "Dockerfile.erb","#{image_path}/Dockerfile"
|
37
|
-
|
38
|
-
FileUtils.cp("#{install_dir}/install_#{package}.sh",
|
39
|
-
"#{image_path}/administration/installation/install_#{package}.sh")
|
40
|
-
end
|
41
|
-
|
42
|
-
FileUtils.cp("#{install_dir}/scriptrunner.sh",
|
43
|
-
"#{image_path}/administration/scriptrunner.sh")
|
62
|
+
add_packages(image_path,*packages)
|
44
63
|
FileUtils.cp("#{admin_dir}/trust.sh","#{image_path}/administration/trust.sh")
|
45
64
|
FileUtils.mkdir("#{image_path}/administration/certificates")
|
46
65
|
FileUtils.cp("#{admin_dir}/ca/rootCA.crt","#{image_path}/administration/certificates/rootCA.crt")
|
47
|
-
@image_name = image_name
|
48
|
-
@version = "1.0"
|
49
66
|
template "build.erb", "#{image_path}/build.sh"
|
50
67
|
FileUtils.chmod 0755, "#{image_path}/build.sh"
|
51
68
|
end
|
52
|
-
|
53
|
-
|
54
69
|
end
|
55
70
|
end
|
data/lib/commands/restore_app.rb
CHANGED
data/lib/commands/start.rb
CHANGED
data/lib/docker_mgr/version.rb
CHANGED
data/lib/util.rb
CHANGED
@@ -31,6 +31,10 @@ module DockerMgr
|
|
31
31
|
def base_images_dir
|
32
32
|
"#{root_dir}/base_images"
|
33
33
|
end
|
34
|
+
|
35
|
+
def runner_dir
|
36
|
+
"#{root_dir}/ci_runner"
|
37
|
+
end
|
34
38
|
|
35
39
|
|
36
40
|
def attic_dir
|
@@ -167,7 +171,19 @@ module DockerMgr
|
|
167
171
|
end
|
168
172
|
end
|
169
173
|
|
170
|
-
|
174
|
+
def add_packages(path,*packages)
|
175
|
+
packages.each_with_index do |package,index|
|
176
|
+
FileUtils.cp("#{install_dir}/install_#{package}.sh",
|
177
|
+
"#{path}/administration/installation/#{index}_install_#{package}.sh")
|
178
|
+
end
|
179
|
+
FileUtils.cp("#{install_dir}/scriptrunner.sh",
|
180
|
+
"#{path}/administration/scriptrunner.sh")
|
181
|
+
end
|
182
|
+
def add_trust(path)
|
183
|
+
FileUtils.cp("#{admin_dir}/trust.sh",
|
184
|
+
"#{path}/administration/trust.sh")
|
185
|
+
empty_directory("#{path}/administration/certificates")
|
186
|
+
end
|
171
187
|
|
172
188
|
end
|
173
189
|
end
|
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.8.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-
|
11
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -119,7 +119,6 @@ files:
|
|
119
119
|
- gemspec.yml
|
120
120
|
- install_certificate.tar
|
121
121
|
- lib/command_router.rb
|
122
|
-
- lib/commands/.generate.rb.swp
|
123
122
|
- lib/commands/backup_app.rb
|
124
123
|
- lib/commands/config.rb
|
125
124
|
- lib/commands/create.rb
|
@@ -142,6 +141,9 @@ files:
|
|
142
141
|
- lib/templates/admin/installation_scripts/install_glassfish.sh
|
143
142
|
- lib/templates/admin/installation_scripts/install_java.sh
|
144
143
|
- lib/templates/admin/installation_scripts/install_node.sh
|
144
|
+
- lib/templates/admin/installation_scripts/install_node_buildtools.sh
|
145
|
+
- lib/templates/admin/installation_scripts/install_ruby.sh
|
146
|
+
- lib/templates/admin/installation_scripts/install_ruby_buildtools.sh
|
145
147
|
- lib/templates/admin/installation_scripts/install_rust.sh
|
146
148
|
- lib/templates/admin/installation_scripts/scriptrunner.sh
|
147
149
|
- lib/templates/admin/routines/backup_routine
|
Binary file
|