ruby_yacht 0.4.2 → 0.4.3
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/.rubocop.yml +0 -6
- data/Gemfile.lock +1 -1
- data/doc/TODO.md +1 -0
- data/lib/ruby_yacht/images/database/Dockerfile.erb +7 -3
- data/lib/ruby_yacht/images/database/startup.bash.erb +3 -0
- data/lib/ruby_yacht/plugins/mysql.rb +1 -0
- data/lib/ruby_yacht/runner/build_images.rb +4 -3
- data/ruby_yacht.gemspec +1 -1
- data/spec/fixtures/database-dockerfile +4 -3
- data/spec/fixtures/database-dockerfile-mysql +3 -2
- data/spec/fixtures/database-dockerfile-rails +3 -2
- data/spec/fixtures/database-dockerfile-with-seed-hooks +4 -3
- data/spec/fixtures/database-startup-mysql +3 -0
- data/spec/plugins/mysql_spec.rb +11 -1
- data/spec/plugins/rails_spec.rb +1 -1
- data/spec/runner/build_images_spec.rb +2 -2
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f958d7dd279688e4f761cfabde4f10696fea04f1
|
4
|
+
data.tar.gz: 921dfd094b9fdea99292b7daf03abb92c3f47415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dd1410db4ef7cda53b1d5029102176c49e259896cde6cc68f882d65a03f02404382a667aa6551eedc829540fa89be75c59845d50e401e680fdf703df31cbe2a
|
7
|
+
data.tar.gz: 529f3f2489158df1ec5e535955286fb4fbad23f310e67cb2ea86ed3fd783a98f442f490e8221eba69004e5f9d8123d6698d81a83d90c4be7914703289f8f4ebd
|
data/.rubocop.yml
CHANGED
@@ -224,12 +224,6 @@ Metrics/ClassLength:
|
|
224
224
|
Enabled: true
|
225
225
|
Max: 250
|
226
226
|
|
227
|
-
Metrics/CyclomaticComplexity:
|
228
|
-
Description: >-
|
229
|
-
A complexity metric that is strongly correlated to the number
|
230
|
-
of test cases needed to validate a method.
|
231
|
-
Enabled: true
|
232
|
-
|
233
227
|
Metrics/LineLength:
|
234
228
|
Description: 'Limit lines to 80 characters.'
|
235
229
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
data/Gemfile.lock
CHANGED
data/doc/TODO.md
CHANGED
@@ -10,7 +10,8 @@ ENV DATABASE_TYPE <%= @database.server_type %>
|
|
10
10
|
<% end %>
|
11
11
|
|
12
12
|
COPY checkout.bash /var/docker/checkout.bash
|
13
|
-
|
13
|
+
COPY startup.bash /var/docker/startup.bash
|
14
|
+
<%= copy_hooks [:install_libraries, :create_databases, :startup] %>
|
14
15
|
<% with_each_app_type do %>
|
15
16
|
<%= copy_hooks [:load_database_seeds] %>
|
16
17
|
<% end %>
|
@@ -21,6 +22,7 @@ RUN chmod u+x /var/docker/*
|
|
21
22
|
|
22
23
|
<%= include_event :create_databases %>
|
23
24
|
|
25
|
+
<% original_server_type = @server_type %>
|
24
26
|
<% apps = @project.apps.select { |app| app.database_name == @database.name } %>
|
25
27
|
<% apps.each do |app| %>
|
26
28
|
<% @server_type = RubyYacht.configuration.find_server_type(app.server_type) %>
|
@@ -30,8 +32,10 @@ WORKDIR /var/code/<%= app.name %>
|
|
30
32
|
<%= include_event :load_database_seeds %>
|
31
33
|
<% end %>
|
32
34
|
|
33
|
-
|
35
|
+
<% @server_type = original_server_type %>
|
36
|
+
|
34
37
|
RUN rm -r /var/code
|
38
|
+
WORKDIR /
|
35
39
|
|
36
40
|
ENV DATABASE_USERNAME ''
|
37
41
|
ENV DATABASE_PASSWORD ''
|
@@ -39,4 +43,4 @@ ENV DATABASE_NAME ''
|
|
39
43
|
|
40
44
|
EXPOSE 3306
|
41
45
|
|
42
|
-
CMD
|
46
|
+
CMD /var/docker/startup.bash
|
@@ -18,6 +18,7 @@ module RubyYacht::Plugins
|
|
18
18
|
add_hooks(server_type: :mysql, folder: File.join(File.dirname(__FILE__), 'mysql', 'scripts')) do
|
19
19
|
during(:install_libraries) { command 'apt-get install -y mysql-server' }
|
20
20
|
during(:create_databases) { run_script 'setup.bash' }
|
21
|
+
during(:startup) { command 'mysqld_safe --bind-address=0.0.0.0' }
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -31,8 +31,8 @@ module RubyYacht::Runner
|
|
31
31
|
build_image 'app-dependencies', "#{@project.system_prefix}-#{@server_type.name}-app-dependencies"
|
32
32
|
end
|
33
33
|
|
34
|
+
@app_server_type = RubyYacht.configuration.find_server_type(project.apps.first.server_type)
|
34
35
|
project.databases.select(&:local?).each do |database|
|
35
|
-
@app_server_type = @server_type
|
36
36
|
@database = database
|
37
37
|
@server_type = RubyYacht.configuration.find_server_type(@database.server_type)
|
38
38
|
build_image 'database', @database.container_name(@project)
|
@@ -107,8 +107,8 @@ module RubyYacht::Runner
|
|
107
107
|
|
108
108
|
# This method establishes settings for building an image.
|
109
109
|
#
|
110
|
-
# This will set the `@templates`, `@hook_events`, and `@server_types`
|
111
|
-
# variables.
|
110
|
+
# This will set the `@templates`, `@hook_events`, and `@server_types`
|
111
|
+
# instance variables.
|
112
112
|
#
|
113
113
|
# ### Parameters
|
114
114
|
#
|
@@ -118,6 +118,7 @@ module RubyYacht::Runner
|
|
118
118
|
@templates =
|
119
119
|
case folder_name
|
120
120
|
when 'app' then ['Dockerfile', 'before_startup.bash', 'startup.bash']
|
121
|
+
when 'database' then ['Dockerfile', 'startup.bash']
|
121
122
|
else ['Dockerfile']
|
122
123
|
end
|
123
124
|
|
data/ruby_yacht.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'ruby_yacht'
|
3
|
-
spec.version = '0.4.
|
3
|
+
spec.version = '0.4.3'
|
4
4
|
spec.date = '2016-04-27'
|
5
5
|
spec.description = "A DSL for building docker containers for a family of Rails apps"
|
6
6
|
spec.summary = "A DSL for building docker containers for a family of Rails apps"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM apollo-
|
1
|
+
FROM apollo-generic-app-dependencies
|
2
2
|
|
3
3
|
ENV DATABASE_USERNAME apollo
|
4
4
|
ENV DATABASE_PASSWORD test
|
@@ -6,14 +6,15 @@ ENV DATABASE_NAME apollo
|
|
6
6
|
ENV DATABASE_TYPE sqlite
|
7
7
|
|
8
8
|
COPY checkout.bash /var/docker/checkout.bash
|
9
|
+
COPY startup.bash /var/docker/startup.bash
|
9
10
|
|
10
11
|
RUN chmod u+x /var/docker/*
|
11
12
|
|
12
13
|
RUN /var/docker/checkout.bash github.com mars brownleej/mars
|
13
14
|
WORKDIR /var/code/mars
|
14
15
|
|
15
|
-
RUN rm -r /var/docker
|
16
16
|
RUN rm -r /var/code
|
17
|
+
WORKDIR /
|
17
18
|
|
18
19
|
ENV DATABASE_USERNAME ''
|
19
20
|
ENV DATABASE_PASSWORD ''
|
@@ -21,4 +22,4 @@ ENV DATABASE_NAME ''
|
|
21
22
|
|
22
23
|
EXPOSE 3306
|
23
24
|
|
24
|
-
CMD
|
25
|
+
CMD /var/docker/startup.bash
|
@@ -7,6 +7,7 @@ ENV DATABASE_TYPE mysql
|
|
7
7
|
ENV DEBIAN_FRONTEND noninteractive
|
8
8
|
|
9
9
|
COPY checkout.bash /var/docker/checkout.bash
|
10
|
+
COPY startup.bash /var/docker/startup.bash
|
10
11
|
COPY setup.bash /var/docker/setup.bash
|
11
12
|
|
12
13
|
RUN chmod u+x /var/docker/*
|
@@ -18,8 +19,8 @@ RUN /var/docker/setup.bash
|
|
18
19
|
RUN /var/docker/checkout.bash github.com mars brownleej/mars
|
19
20
|
WORKDIR /var/code/mars
|
20
21
|
|
21
|
-
RUN rm -r /var/docker
|
22
22
|
RUN rm -r /var/code
|
23
|
+
WORKDIR /
|
23
24
|
|
24
25
|
ENV DATABASE_USERNAME ''
|
25
26
|
ENV DATABASE_PASSWORD ''
|
@@ -27,4 +28,4 @@ ENV DATABASE_NAME ''
|
|
27
28
|
|
28
29
|
EXPOSE 3306
|
29
30
|
|
30
|
-
CMD
|
31
|
+
CMD /var/docker/startup.bash
|
@@ -6,6 +6,7 @@ ENV DATABASE_NAME apollo
|
|
6
6
|
ENV DATABASE_TYPE sqlite
|
7
7
|
|
8
8
|
COPY checkout.bash /var/docker/checkout.bash
|
9
|
+
COPY startup.bash /var/docker/startup.bash
|
9
10
|
COPY load_seeds.rb /var/docker/load_seeds.rb
|
10
11
|
|
11
12
|
RUN chmod u+x /var/docker/*
|
@@ -18,8 +19,8 @@ RUN /var/docker/checkout.bash github.com saturn brownleej/saturn
|
|
18
19
|
WORKDIR /var/code/saturn
|
19
20
|
RUN /var/docker/load_seeds.rb
|
20
21
|
|
21
|
-
RUN rm -r /var/docker
|
22
22
|
RUN rm -r /var/code
|
23
|
+
WORKDIR /
|
23
24
|
|
24
25
|
ENV DATABASE_USERNAME ''
|
25
26
|
ENV DATABASE_PASSWORD ''
|
@@ -27,4 +28,4 @@ ENV DATABASE_NAME ''
|
|
27
28
|
|
28
29
|
EXPOSE 3306
|
29
30
|
|
30
|
-
CMD
|
31
|
+
CMD /var/docker/startup.bash
|
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM apollo-
|
1
|
+
FROM apollo-generic-app-dependencies
|
2
2
|
|
3
3
|
ENV DATABASE_USERNAME apollo
|
4
4
|
ENV DATABASE_PASSWORD test
|
@@ -6,6 +6,7 @@ ENV DATABASE_NAME apollo
|
|
6
6
|
ENV DATABASE_TYPE sqlite
|
7
7
|
|
8
8
|
COPY checkout.bash /var/docker/checkout.bash
|
9
|
+
COPY startup.bash /var/docker/startup.bash
|
9
10
|
COPY hook1.rb /var/docker/hook1.rb
|
10
11
|
|
11
12
|
RUN chmod u+x /var/docker/*
|
@@ -14,8 +15,8 @@ RUN /var/docker/checkout.bash github.com mars brownleej/mars
|
|
14
15
|
WORKDIR /var/code/mars
|
15
16
|
RUN /var/docker/hook1.rb
|
16
17
|
|
17
|
-
RUN rm -r /var/docker
|
18
18
|
RUN rm -r /var/code
|
19
|
+
WORKDIR /
|
19
20
|
|
20
21
|
ENV DATABASE_USERNAME ''
|
21
22
|
ENV DATABASE_PASSWORD ''
|
@@ -23,4 +24,4 @@ ENV DATABASE_NAME ''
|
|
23
24
|
|
24
25
|
EXPOSE 3306
|
25
26
|
|
26
|
-
CMD
|
27
|
+
CMD /var/docker/startup.bash
|
data/spec/plugins/mysql_spec.rb
CHANGED
@@ -48,10 +48,11 @@ describe RubyYacht::Plugins::MySQL do
|
|
48
48
|
it "copies the scripts to the docker folder" do
|
49
49
|
docker.expect("build -t apollo-database tmp") do
|
50
50
|
files = Dir[File.join("tmp", "*")].sort
|
51
|
-
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/setup.bash']
|
51
|
+
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/setup.bash', 'tmp/startup.bash', 'tmp/startup.bash.erb']
|
52
52
|
end
|
53
53
|
subject.run
|
54
54
|
end
|
55
|
+
|
55
56
|
it "builds the dockerfile for a MySQL database" do
|
56
57
|
docker.expect("build -t apollo-database tmp") do
|
57
58
|
dockerfile = File.read(File.join('tmp', 'Dockerfile'))
|
@@ -60,5 +61,14 @@ describe RubyYacht::Plugins::MySQL do
|
|
60
61
|
end
|
61
62
|
subject.run
|
62
63
|
end
|
64
|
+
|
65
|
+
it "builds the startup script for a MySQL database" do
|
66
|
+
docker.expect("build -t apollo-database tmp") do
|
67
|
+
startup_file = File.read(File.join('tmp', 'startup.bash'))
|
68
|
+
expected = File.read(File.join('spec', 'fixtures', 'database-startup-mysql'))
|
69
|
+
expect(startup_file).to eq expected
|
70
|
+
end
|
71
|
+
subject.run
|
72
|
+
end
|
63
73
|
end
|
64
74
|
end
|
data/spec/plugins/rails_spec.rb
CHANGED
@@ -246,7 +246,7 @@ describe RubyYacht::Plugins::Rails do
|
|
246
246
|
it "generates the dockerfiles for the database server" do
|
247
247
|
docker.expect "build -t apollo-database tmp" do
|
248
248
|
files = Dir[File.join("tmp", "*")].sort
|
249
|
-
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/install_gems.rb', 'tmp/load_seeds.rb']
|
249
|
+
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/install_gems.rb', 'tmp/load_seeds.rb', 'tmp/startup.bash', 'tmp/startup.bash.erb']
|
250
250
|
dockerfile = File.read(File.join('tmp', 'Dockerfile'))
|
251
251
|
expected = File.read(File.join('spec', 'fixtures', 'database-dockerfile-rails'))
|
252
252
|
expect(dockerfile).to eq expected
|
@@ -109,7 +109,7 @@ describe RubyYacht::Runner::BuildImages do
|
|
109
109
|
it "builds the database" do
|
110
110
|
docker.expect("build -t apollo-mysql tmp") do
|
111
111
|
files = Dir[File.join("tmp", "*")].sort
|
112
|
-
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash']
|
112
|
+
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/startup.bash', 'tmp/startup.bash.erb']
|
113
113
|
dockerfile = File.read(File.join('tmp', 'Dockerfile'))
|
114
114
|
expected = File.read(File.join('spec', 'fixtures', 'database-dockerfile'))
|
115
115
|
expect(dockerfile).to eq expected
|
@@ -136,7 +136,7 @@ describe RubyYacht::Runner::BuildImages do
|
|
136
136
|
it "copies the files for the hooks to the database" do
|
137
137
|
docker.expect("build -t apollo-mysql tmp") do
|
138
138
|
files = Dir[File.join("tmp", "*")].sort
|
139
|
-
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/hook1.rb']
|
139
|
+
expect(files).to eq ['tmp/Dockerfile', 'tmp/Dockerfile.erb', 'tmp/checkout.bash', 'tmp/hook1.rb', 'tmp/startup.bash', 'tmp/startup.bash.erb']
|
140
140
|
end
|
141
141
|
subject.run
|
142
142
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_yacht
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Brownlee
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/ruby_yacht/images/app/startup.bash.erb
|
89
89
|
- lib/ruby_yacht/images/database/Dockerfile.erb
|
90
90
|
- lib/ruby_yacht/images/database/checkout.bash
|
91
|
+
- lib/ruby_yacht/images/database/startup.bash.erb
|
91
92
|
- lib/ruby_yacht/images/web/Dockerfile.erb
|
92
93
|
- lib/ruby_yacht/images/web/add_app.rb
|
93
94
|
- lib/ruby_yacht/images/web/add_project.rb
|
@@ -132,6 +133,7 @@ files:
|
|
132
133
|
- spec/fixtures/database-dockerfile-mysql
|
133
134
|
- spec/fixtures/database-dockerfile-rails
|
134
135
|
- spec/fixtures/database-dockerfile-with-seed-hooks
|
136
|
+
- spec/fixtures/database-startup-mysql
|
135
137
|
- spec/fixtures/deploy-dockerfile
|
136
138
|
- spec/fixtures/hooks/hook1.rb
|
137
139
|
- spec/fixtures/hooks/hook2.rb
|
@@ -210,6 +212,7 @@ test_files:
|
|
210
212
|
- spec/fixtures/database-dockerfile-mysql
|
211
213
|
- spec/fixtures/database-dockerfile-rails
|
212
214
|
- spec/fixtures/database-dockerfile-with-seed-hooks
|
215
|
+
- spec/fixtures/database-startup-mysql
|
213
216
|
- spec/fixtures/deploy-dockerfile
|
214
217
|
- spec/fixtures/hooks/hook1.rb
|
215
218
|
- spec/fixtures/hooks/hook2.rb
|