dockersitter 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commands/create.rb +6 -6
- data/lib/commands/init.rb +7 -1
- data/lib/docker_mgr/version.rb +1 -1
- data/lib/templates/add_ca.sh.erb +31 -0
- data/lib/templates/admin/ca/sign.sh +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ba0a14022751c138b33fda40bea3f716aa4e045
|
4
|
+
data.tar.gz: 9f78b5ae483c9435530013652f052d0a4707ce6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5ade506282a7c307c477d6df4db279ecb437b68a2893b62a7bc6f1de97e499bf9f8b6d39c9585041abc6ab44fce3454a9e59abe9e16bff2b08ea5eb337e9f09
|
7
|
+
data.tar.gz: 9d04163d4c640f23a8195271586e2110b9f115c99c910a637d54c956ffaac4258b6968e38b82c7bd28758005325d7ae5fff25043d0ca99054b864861ee3f8840
|
data/lib/commands/create.rb
CHANGED
@@ -48,12 +48,10 @@ class Create < Thor
|
|
48
48
|
:type => :string
|
49
49
|
|
50
50
|
def app(app_name)
|
51
|
-
subdomain = options
|
52
|
-
puts config[:host]
|
51
|
+
subdomain = options.fetch(subdomain,app_name.gsub(/\s/,"-").downcase)
|
53
52
|
@domain = "#{subdomain}.#{config[:host]}"
|
54
53
|
@app_name = app_name
|
55
|
-
@user_email = config
|
56
|
-
@user_name = config[:name]
|
54
|
+
@user_email,@user_name = config.values_at(:email,:name)
|
57
55
|
app_path = "#{apps_dir}/#{@app_name}"
|
58
56
|
template "docker-compose.yml.erb","#{app_path}/docker-compose.yml"
|
59
57
|
empty_directory "#{app_path}/administration/installation"
|
@@ -74,8 +72,10 @@ class Create < Thor
|
|
74
72
|
append_to_file "#{routine_dir}/backup_routine", "docker_mgr backup_app #{app_name}"
|
75
73
|
create_file "#{vhost_dir}/#{app_name}"
|
76
74
|
if options[:cert]
|
77
|
-
|
78
|
-
|
75
|
+
FileUtils.cd "#{admin_dir}/ca" do
|
76
|
+
puts "#{admin_dir}/ca/sign.sh"
|
77
|
+
puts `./sign.sh #{@domain}`
|
78
|
+
end
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
data/lib/commands/init.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "thor/group"
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
class Init < Thor::Group
|
4
5
|
include Thor::Actions
|
@@ -14,8 +15,13 @@ class Init < Thor::Group
|
|
14
15
|
empty_directory "docker/base_images"
|
15
16
|
directory "admin","docker/admin"
|
16
17
|
empty_directory "docker/ci_runner"
|
17
|
-
empty_directory "docker/proxy/
|
18
|
+
empty_directory "docker/proxy/certs"
|
18
19
|
empty_directory "docker/proxy/vhosts.d"
|
20
|
+
create_file "docker/.gitignore","**/*.key"
|
21
|
+
FileUtils.cd 'docker/admin/ca' do
|
22
|
+
puts `openssl req -x509 -newkey rsa:4096 -keyout rootCA.key -out rootCA.crt -days 7800 -sha256`
|
23
|
+
end
|
24
|
+
chmod 'docker/admin/ca/sign.sh',755
|
19
25
|
puts `git init docker`
|
20
26
|
end
|
21
27
|
|
data/lib/docker_mgr/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
cert="$(dirname $0)/rootCA.pem"
|
4
|
+
|
5
|
+
function mac {
|
6
|
+
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $cert
|
7
|
+
}
|
8
|
+
|
9
|
+
function linux {
|
10
|
+
distribution=$(find /etc/*-release -type f | xargs cat | grep 'ID' | head -n1 | awk -F'=' '{gsub(/"/,"",$2); print tolower($2)}')
|
11
|
+
echo $distribution
|
12
|
+
case $distribution in
|
13
|
+
debian|ubuntu|linuxmint*|elementary*)
|
14
|
+
sudo mkdir -p /usr/local/share/ca-certificates
|
15
|
+
sudo cp $cert /usr/local/share/ca-certificates/richterrettich.crt
|
16
|
+
sudo update-ca-certificates;;
|
17
|
+
fedora|centos)
|
18
|
+
sudo cp $cert /etc/pki/ca-trust/source/anchors
|
19
|
+
sudo update-ca-trust;;
|
20
|
+
esac
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
case $OSTYPE in
|
25
|
+
darwin*) mac
|
26
|
+
;;
|
27
|
+
linux-gnu*) linux
|
28
|
+
;;
|
29
|
+
esac
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
openssl genrsa -out ${1}.key 4096
|
4
|
+
openssl req -new -subj "/CN=$1" -nodes -sha256 -key ${1}.key -out ${1}.csr
|
5
|
+
openssl x509 -req -in ${1}.csr -sha256 -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out ${1}.crt -days 7800
|
6
|
+
mv ${1}.* ../../proxy/certs/
|
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.4.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -130,6 +130,8 @@ files:
|
|
130
130
|
- lib/docker_mgr.rb
|
131
131
|
- lib/docker_mgr/version.rb
|
132
132
|
- lib/templates/Dockerfile.erb
|
133
|
+
- lib/templates/add_ca.sh.erb
|
134
|
+
- lib/templates/admin/ca/sign.sh
|
133
135
|
- lib/templates/admin/examples/postgres_backup
|
134
136
|
- lib/templates/admin/examples/postgres_restore
|
135
137
|
- lib/templates/admin/installation_scripts/install_derby.sh
|