rumination 0.14.4 → 0.14.5
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/rumination/tasks/deploy.rake +96 -87
- data/lib/rumination/version.rb +1 -1
- 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: e05fe76281093c313880f5232f643049992b626f
|
4
|
+
data.tar.gz: ac8eea178154085b15e0dc3c3b1ad0f9519969c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a85bcf4967a30e07556d261c07a88dfec8b4e0c8e0319a7cb60ace722107721083ef3688869e659b2f324e85e2b5d3ed96ed1a7e56cdc83707edd2afe3c8631
|
7
|
+
data.tar.gz: 44fb963f028c4225e79e8adf298f70bee75dc424244e1f9a6465f226b6c34e215b2bd03353a5dabadc0294d0dbbf9b4ae0a81a8f37dac8d86f3124445946113e
|
@@ -1,111 +1,120 @@
|
|
1
1
|
require "rumination/deploy"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
task :
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
bootstrap
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
task :env_file do
|
29
|
-
env_file_path = "/opt/app/env"
|
30
|
-
temp_file_path = "tmp/#{Rumination::Deploy.target}.env"
|
31
|
-
mkdir_p File.dirname(temp_file_path)
|
32
|
-
Rumination::Deploy.write_env_file(temp_file_path)
|
33
|
-
container = Rumination::Deploy.app_container_full_name
|
34
|
-
sh "docker cp #{temp_file_path} #{container}:#{env_file_path}"
|
3
|
+
module DeployTasks
|
4
|
+
extend Rake::DSL
|
5
|
+
|
6
|
+
task :deploy => "deploy:default"
|
7
|
+
|
8
|
+
namespace :deploy do
|
9
|
+
task :default => %w[
|
10
|
+
start
|
11
|
+
finish
|
12
|
+
]
|
13
|
+
|
14
|
+
task :bootstrap => %w[
|
15
|
+
start
|
16
|
+
bootstrap:check_flag
|
17
|
+
bootstrap:env_file
|
18
|
+
bootstrap:copy_files
|
19
|
+
bootstrap:db
|
20
|
+
on:bootstrapped
|
21
|
+
finish
|
22
|
+
bootstrap:flag_success
|
23
|
+
]
|
24
|
+
|
25
|
+
namespace :on do
|
26
|
+
task :deployed
|
27
|
+
task :bootstrapped
|
35
28
|
end
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
30
|
+
namespace :bootstrap do
|
31
|
+
task :env_file do
|
32
|
+
env_file_path = "/opt/app/env"
|
33
|
+
temp_file_path = "tmp/#{Rumination::Deploy.target}.env"
|
34
|
+
mkdir_p File.dirname(temp_file_path)
|
35
|
+
Rumination::Deploy.write_env_file(temp_file_path)
|
36
|
+
container = Rumination::Deploy.app_container_full_name
|
37
|
+
sh "docker cp #{temp_file_path} #{container}:#{env_file_path}"
|
41
38
|
end
|
42
|
-
end
|
43
39
|
|
44
|
-
|
40
|
+
task :copy_files do
|
41
|
+
container = Rumination::Deploy.app_container_full_name
|
42
|
+
Rumination::Deploy.files_to_copy_on_bootstrap.each do |source, target|
|
43
|
+
sh "docker cp #{source} #{container}:#{target}"
|
44
|
+
end
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
task :db
|
48
|
+
|
49
|
+
task :flag_success do
|
50
|
+
container = Rumination::Deploy.app_container_name
|
51
|
+
flag_path = Rumination::Deploy.bootstrapped_flag_path
|
52
|
+
sh "docker-compose run --rm #{container} touch #{flag_path}"
|
53
|
+
end
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
task :check_flag do
|
56
|
+
container = Rumination::Deploy.app_container_name
|
57
|
+
flag_path = Rumination::Deploy.bootstrapped_flag_path
|
58
|
+
sh "docker-compose run --rm #{container} test -f #{flag_path}" do |ok, err|
|
59
|
+
if ok
|
60
|
+
message = "The target '#{Rumination::Deploy.target}' was bootstrap already"
|
61
|
+
raise Rumination::Deploy::BootstrappedAlready, message
|
62
|
+
end
|
59
63
|
end
|
60
64
|
end
|
61
|
-
end
|
62
65
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
+
task :undo => %w[confirm_undo setup_docker_env] do
|
67
|
+
sh "docker-compose down --remove-orphans -v"
|
68
|
+
end
|
66
69
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
70
|
+
task :confirm_undo do
|
71
|
+
require "highline/import"
|
72
|
+
question = "Do you really want to undo the bootstrap (database will be dropped)?"
|
73
|
+
abort("Bootstrap undo canceled, you didn't mean it") unless agree(question)
|
74
|
+
end
|
71
75
|
end
|
72
|
-
end
|
73
76
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
77
|
+
task :start => %w[
|
78
|
+
setup_docker_env
|
79
|
+
switch_containers
|
80
|
+
]
|
78
81
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
82
|
+
task :finish => %w[
|
83
|
+
copy_files
|
84
|
+
on:deployed
|
85
|
+
]
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
task :switch_containers => %w[
|
88
|
+
build_containers
|
89
|
+
shut_down_services
|
90
|
+
start_services
|
91
|
+
]
|
89
92
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
+
task :build_containers do
|
94
|
+
sh "docker-compose build"
|
95
|
+
end
|
93
96
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
+
task :shut_down_services do
|
98
|
+
sh "docker-compose down --remove-orphans"
|
99
|
+
end
|
97
100
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
task :start_services do
|
102
|
+
if Rumination::Deploy.development_target?
|
103
|
+
sh "docker-compose run --rm #{container} bundle install"
|
104
|
+
end
|
105
|
+
sh "docker-compose up -d"
|
101
106
|
end
|
102
|
-
sh "docker-compose up -d"
|
103
|
-
end
|
104
107
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
108
|
+
task :copy_files do
|
109
|
+
container = Rumination::Deploy.app_container_full_name
|
110
|
+
Rumination::Deploy.files_to_copy_on_deploy.each do |source, target|
|
111
|
+
sh "docker cp #{source} #{container}:#{target}"
|
112
|
+
end
|
109
113
|
end
|
110
114
|
end
|
115
|
+
|
116
|
+
def container
|
117
|
+
Rumination::Deploy.app_container_name
|
118
|
+
end
|
119
|
+
|
111
120
|
end
|
data/lib/rumination/version.rb
CHANGED