capdocker 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/capdocker.gemspec +1 -1
- data/lib/docker.rb +1 -1
- data/lib/docker_deploy.rb +12 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98e4e8b91344e39dc91442baec8a15006ebc1a32
|
4
|
+
data.tar.gz: d391b696507471821b76237bc1284de4100772c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ec332e8048f845e5132b7a2e5b204fe4d160f005a6087657fdaaf9df8143c93eb11bfbf2cdbbb990a5c4e9e268ebc6f9ed1154b4678c749eae297f1e0de81f
|
7
|
+
data.tar.gz: 70e4a941820317bc8887756f91c1c1c15f4d511375689c43a112213efbc55124652cc4e56e49712288f8b8b4ad8f6922cf89ba3e721bfd223576747f2a944fee
|
data/capdocker.gemspec
CHANGED
data/lib/docker.rb
CHANGED
@@ -4,7 +4,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
4
4
|
|
5
5
|
desc "build an updated box, restart container"
|
6
6
|
task :build do
|
7
|
-
run "docker build -t oneblackbear/#{application}
|
7
|
+
run "docker build -t oneblackbear/#{application} containers/#{application}/"
|
8
8
|
run "docker ps | grep #{app_port} | awk '{print $1}' | xargs -n 1 docker kill"
|
9
9
|
run "docker run -p #{app_port}:80 -v /home/docker/data/#{application}/mysql:/data/mysql:rw -d -t oneblackbear/#{application}:latest"
|
10
10
|
puts "*** Application now deloyed to port #{app_port} ***"
|
data/lib/docker_deploy.rb
CHANGED
@@ -19,49 +19,41 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
19
19
|
after "deploy:update_code", "deploy:mount_shares"
|
20
20
|
after "deploy:update_code", "docker:build"
|
21
21
|
|
22
|
-
#### Performs the initial setup for tasks ####
|
23
|
-
task :config_setup do
|
24
|
-
rpath = release_path rescue "./#{application}"
|
25
|
-
set :release_path, rpath
|
26
|
-
end
|
27
|
-
|
28
22
|
|
29
23
|
namespace :deploy do
|
30
24
|
|
31
25
|
desc "Deploys the project to docker server."
|
32
26
|
task :default do
|
33
|
-
config_setup
|
34
27
|
update_code
|
35
28
|
create_symlink
|
36
29
|
restart
|
37
30
|
end
|
38
31
|
|
39
32
|
task :prepare do
|
40
|
-
run "cd
|
41
|
-
run "mkdir -p
|
42
|
-
run "mkdir -m0777 -p
|
33
|
+
run "cd ./containers/#{application} && rm -Rf ./*" rescue
|
34
|
+
run "mkdir -p containers/#{application}/platform"
|
35
|
+
run "mkdir -m0777 -p mounts/#{application}/mysql"
|
43
36
|
end
|
44
37
|
|
45
38
|
task :configure_platform do
|
46
39
|
host_content = from_template("templates/nginx_host.erb")
|
47
|
-
put host_content, "
|
40
|
+
put host_content, "containers/#{application}/platform/nginx_host.conf"
|
48
41
|
|
49
42
|
container_content = from_template("templates/nginx_container.erb")
|
50
|
-
put container_content, "
|
43
|
+
put container_content, "containers/#{application}/platform/nginx_container.conf"
|
51
44
|
|
52
45
|
docker_content = from_template("templates/Dockerfile.erb")
|
53
|
-
put docker_content, "
|
46
|
+
put docker_content, "containers/#{application}/Dockerfile"
|
54
47
|
end
|
55
48
|
|
56
49
|
task :update_code do
|
57
50
|
puts "Pushing code for current git commit ..."
|
58
|
-
set :basedir, capture("pwd").gsub(/\n|\r/, "")
|
59
51
|
set :tag, %x[git rev-parse --short HEAD].strip() + ".tar.gz"
|
60
52
|
run_locally "git archive HEAD | gzip > #{tag}"
|
61
|
-
top.upload "#{tag}", "
|
53
|
+
top.upload "#{tag}", "containers/#{application}", :via => :scp, :mkdir => true
|
62
54
|
run_locally "rm #{tag}"
|
63
|
-
run "cd
|
64
|
-
run "rm
|
55
|
+
run "cd containers/#{application} && tar -xzvf #{tag}"
|
56
|
+
run "rm containers/#{application}/#{tag}"
|
65
57
|
end
|
66
58
|
|
67
59
|
task :update_builds do
|
@@ -72,8 +64,9 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
72
64
|
|
73
65
|
end
|
74
66
|
|
75
|
-
task :create_symlink do
|
76
|
-
|
67
|
+
task :create_symlink do
|
68
|
+
set :basedir, capture("pwd").gsub(/\n|\r/, "")
|
69
|
+
run "ln -f -s #{basedir}/containers/#{application}/platform/nginx_host.conf ./conf/nginx/#{application}.conf"
|
77
70
|
end
|
78
71
|
|
79
72
|
task :restart do
|