rumination 0.6.6 → 0.6.7
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/deploy/base.rb +23 -27
- data/lib/rumination/tasks/deploy/bootstrap.rake +9 -1
- 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: e7931a40d3cb98cf96e8e14900ef6aaa5e0f9454
|
4
|
+
data.tar.gz: 245694f7be405f460c75603bb96fcce08b384a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ff7b7d46e237adb183f5fd0d8bfae0550a6e630ce7260e5604186ef3826eb62d7fd9bdc10b4baeec5bb2d725b142f355043385fd50391926cc68f216a73ad7
|
7
|
+
data.tar.gz: 0b349992d6d69a12a4a3ebaa40aae6e037f83c334be454f0239f869ad007a7283658668b8434aa0af5bf318d86283cff5fad4dc4088728e854b25721f889f88c
|
@@ -24,11 +24,31 @@ module Rumination
|
|
24
24
|
.run("rake deploy:finish[#{target}]")
|
25
25
|
end
|
26
26
|
|
27
|
+
def env
|
28
|
+
load target_config_path
|
29
|
+
env = docker_machine_env
|
30
|
+
env["VIRTUAL_HOST"] = config.virtual_host
|
31
|
+
env["COMPOSE_FILE"] = config.compose_file if config.compose_file
|
32
|
+
env
|
33
|
+
end
|
34
|
+
|
35
|
+
def write_env_file
|
36
|
+
File.open(env_file_path) do |io|
|
37
|
+
password_vars.each do |var|
|
38
|
+
io.puts %Q[export #{var}="#{generate_password}"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_password
|
44
|
+
Generate.password
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
27
49
|
def on_fresh_containers
|
28
|
-
puts "Bootstrapping '#{target}'"
|
29
50
|
raise BootstrappedAlready if bootstrapped?
|
30
|
-
|
31
|
-
initialize_database
|
51
|
+
container(:backend).run("rake deploy:bootstap:inside[#{target}]")
|
32
52
|
end
|
33
53
|
|
34
54
|
def load_application_config_if_exists
|
@@ -53,39 +73,15 @@ module Rumination
|
|
53
73
|
config.generate_passwords || Array(config.generate_password)
|
54
74
|
end
|
55
75
|
|
56
|
-
def env
|
57
|
-
load target_config_path
|
58
|
-
env = docker_machine_env
|
59
|
-
env["VIRTUAL_HOST"] = config.virtual_host
|
60
|
-
env["COMPOSE_FILE"] = config.compose_file if config.compose_file
|
61
|
-
env
|
62
|
-
end
|
63
|
-
|
64
76
|
def docker_machine_env
|
65
77
|
dm_env_str = `docker-machine env #{config.docker_machine}`
|
66
78
|
Dotenv::Parser.call(dm_env_str)
|
67
79
|
end
|
68
80
|
|
69
|
-
def write_env_file
|
70
|
-
password_vars.each do |var|
|
71
|
-
container(:backend)
|
72
|
-
.run(%Q[echo "#{var}=#{generate_password}" >> #{env_file_path}])
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def generate_password
|
77
|
-
Generate.password
|
78
|
-
end
|
79
|
-
|
80
81
|
def bootstrapped?
|
81
82
|
container(:backend).has_file?(env_file_path)
|
82
83
|
end
|
83
84
|
|
84
|
-
def initialize_database
|
85
|
-
container(:backend).run("rake db:setup:maybe_load_dump")
|
86
|
-
raise DatabaseInitError unless $? == 0
|
87
|
-
end
|
88
|
-
|
89
85
|
def env_file_path
|
90
86
|
"/opt/app/env"
|
91
87
|
end
|
@@ -7,5 +7,13 @@ namespace :deploy do
|
|
7
7
|
abort "'#{args.target}' has already been bootstrapped"
|
8
8
|
end
|
9
9
|
end
|
10
|
-
end
|
11
10
|
|
11
|
+
namespace :bootstrap do
|
12
|
+
# these are invoked inside the containers
|
13
|
+
task :inside, [:target] => %w[write_env_file db:setup:maybe_load_dump]
|
14
|
+
|
15
|
+
task :write_env_file, [:target] do |t, args|
|
16
|
+
Rumination::Deploy.new(args.target).write_env_file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/rumination/version.rb
CHANGED