docker-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/README.md +11 -8
- data/docker-rails.gemspec +2 -0
- data/lib/docker/rails/{CLI → cli}/db_check.rb +0 -4
- data/lib/docker/rails/{CLI → cli}/gems_volume.rb +0 -0
- data/lib/docker/rails/{CLI → cli}/main.rb +0 -0
- data/lib/docker/rails/config.rb +2 -2
- data/lib/docker/rails/version.rb +1 -1
- data/spec/docker/rails/config_spec.rb +2 -2
- data/spec/docker/rails/docker-rails.yml +6 -6
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8076e4ce6d1d20d727afadb4c99e5b9e57c18e21
|
4
|
+
data.tar.gz: 235f58b8be4f973954bbad1055df04b7bfb2a523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92189a1adf213f3cbb9def7fc31e95819c251c7b2a2e196add0971ce97bcc1c733d9af9154a8597d28eb03518fda597627df3418421e0b1d242899afe05e28ed
|
7
|
+
data.tar.gz: 5f977d58eebb066ce2a7717000dc60d6836010e55633dcd4b07e74f5ee61b48be34a417479e02186d4656a8df0f34775c7663dfa08630624cea6ae9e2e795aa9
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# docker-rails
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/docker-rails.svg)](https://rubygems.org/gems/docker-rails)
|
3
|
+
[![Build Status](https://travis-ci.org/alienfast/docker-rails.svg)](https://travis-ci.org/alienfast/docker-rails)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/alienfast/docker-rails/badges/gpa.svg)](https://codeclimate.com/github/alienfast/docker-rails)
|
2
5
|
|
3
6
|
A simplified pattern to execute rails applications within Docker (with a CI build emphasis).
|
4
7
|
|
5
8
|
## Features
|
6
9
|
- Provides individual functions for development/test usage, or a full workflow for CI usage (with automated container, volume, and image cleanup).
|
7
|
-
- Automated cached global gems data volume
|
10
|
+
- Automated cached global gems data volume based on ruby version
|
8
11
|
- DRY declarative `docker-rails.yml` allowing multiple environments to be defined with an inherited `docker-compose` configuration
|
9
12
|
- Interpolates `docker-compose.yml` making CI builds much easier
|
10
13
|
- DB check CLI function provided for docker-compose `command` to check if db is ready
|
11
14
|
|
12
|
-
|
13
15
|
## Usage
|
14
16
|
|
15
17
|
```bash
|
@@ -75,7 +77,7 @@ ENV DEBIAN_FRONTEND newt
|
|
75
77
|
### 2. Add a docker-rails.yml
|
76
78
|
|
77
79
|
Environment variables will be interpolated, so feel free to use them.
|
78
|
-
Below shows an example with all of the environments `development | test | parallel_tests | staging
|
80
|
+
Below shows an example with all of the environments `development | test | parallel_tests | staging` to show reuse of the primary `docker-compose' configuration.
|
79
81
|
|
80
82
|
```yaml
|
81
83
|
verbose: true
|
@@ -88,7 +90,7 @@ elasticsearch: &elasticsearch
|
|
88
90
|
- "9200"
|
89
91
|
|
90
92
|
development:
|
91
|
-
|
93
|
+
compose:
|
92
94
|
<<: *elasticsearch
|
93
95
|
web:
|
94
96
|
links:
|
@@ -123,7 +125,7 @@ development:
|
|
123
125
|
|
124
126
|
test:
|
125
127
|
before_command: rm -Rf target
|
126
|
-
|
128
|
+
compose:
|
127
129
|
<<: *elasticsearch
|
128
130
|
web:
|
129
131
|
links:
|
@@ -151,7 +153,7 @@ test:
|
|
151
153
|
|
152
154
|
parallel_tests:
|
153
155
|
before_command: rm -Rf target
|
154
|
-
|
156
|
+
compose:
|
155
157
|
<<: *elasticsearch
|
156
158
|
web:
|
157
159
|
links:
|
@@ -179,7 +181,7 @@ parallel_tests:
|
|
179
181
|
"
|
180
182
|
|
181
183
|
staging:
|
182
|
-
|
184
|
+
compose:
|
183
185
|
web:
|
184
186
|
environment:
|
185
187
|
- RAILS_ENV=staging
|
@@ -206,7 +208,8 @@ staging:
|
|
206
208
|
&& foreman start
|
207
209
|
"
|
208
210
|
|
209
|
-
docker-compose
|
211
|
+
# base docker-compose configuration for all environments
|
212
|
+
compose:
|
210
213
|
web:
|
211
214
|
build: .
|
212
215
|
working_dir: /project/spec/dummy
|
data/docker-rails.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_development_dependency 'bundler', '~> 1.6'
|
22
22
|
s.add_development_dependency 'rake'
|
23
23
|
s.add_development_dependency 'rspec'
|
24
|
+
|
25
|
+
# only needed at runtime for db_check mysql
|
24
26
|
s.add_development_dependency 'mysql2', '~> 0.3.18' # http://stackoverflow.com/a/32466950/2363935
|
25
27
|
s.add_development_dependency 'activerecord'
|
26
28
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Docker
|
2
2
|
module Rails
|
3
3
|
module CLI
|
4
|
-
require 'thor'
|
5
4
|
class DbCheck < Thor
|
6
5
|
|
7
6
|
default_task :help
|
@@ -14,9 +13,6 @@ module Docker
|
|
14
13
|
option :password, desc: 'Password-less login if unspecified'
|
15
14
|
|
16
15
|
def mysql
|
17
|
-
|
18
|
-
App.instance
|
19
|
-
|
20
16
|
# ping db to see if it is ready before continuing
|
21
17
|
require 'rubygems'
|
22
18
|
require 'active_record'
|
File without changes
|
File without changes
|
data/lib/docker/rails/config.rb
CHANGED
@@ -14,7 +14,7 @@ module Docker
|
|
14
14
|
|
15
15
|
def load!(environment, *filenames)
|
16
16
|
if environment.nil?
|
17
|
-
puts 'Environment unspecified, generating docker-compose.yml based on root
|
17
|
+
puts 'Environment unspecified, generating docker-compose.yml based on root :compose yaml key.'
|
18
18
|
environment = 'docker-compose'
|
19
19
|
end
|
20
20
|
|
@@ -27,7 +27,7 @@ module Docker
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def write_docker_compose_file(output_filename = 'docker-compose.yml')
|
30
|
-
write_yaml_file(output_filename, self[:'
|
30
|
+
write_yaml_file(output_filename, self[:'compose'])
|
31
31
|
end
|
32
32
|
|
33
33
|
def to_yaml(config = @configuration)
|
data/lib/docker/rails/version.rb
CHANGED
@@ -44,11 +44,11 @@ describe Docker::Rails::Config do
|
|
44
44
|
it 'should read default file' do
|
45
45
|
assert_common_top_level_settings
|
46
46
|
|
47
|
-
web = config[:'
|
47
|
+
web = config[:'compose'][:web]
|
48
48
|
expect(web[:links]).to match_array %w(elasticsearch db)
|
49
49
|
expect(web[:ports]).to match_array ['3000']
|
50
50
|
|
51
|
-
elasticsearch = config[:'
|
51
|
+
elasticsearch = config[:'compose'][:elasticsearch]
|
52
52
|
expect(elasticsearch[:ports]).to match_array ['9200']
|
53
53
|
|
54
54
|
# ensure no unnecessary environments make it into the resolved configuration
|
@@ -8,7 +8,7 @@ elasticsearch: &elasticsearch
|
|
8
8
|
- "9200"
|
9
9
|
|
10
10
|
development:
|
11
|
-
|
11
|
+
compose:
|
12
12
|
<<: *elasticsearch
|
13
13
|
web:
|
14
14
|
links:
|
@@ -43,7 +43,7 @@ development:
|
|
43
43
|
|
44
44
|
test:
|
45
45
|
before_command: rm -Rf target
|
46
|
-
|
46
|
+
compose:
|
47
47
|
<<: *elasticsearch
|
48
48
|
web:
|
49
49
|
links:
|
@@ -71,7 +71,7 @@ test:
|
|
71
71
|
|
72
72
|
parallel_tests:
|
73
73
|
before_command: rm -Rf target
|
74
|
-
|
74
|
+
compose:
|
75
75
|
<<: *elasticsearch
|
76
76
|
web:
|
77
77
|
links:
|
@@ -99,7 +99,7 @@ parallel_tests:
|
|
99
99
|
"
|
100
100
|
|
101
101
|
staging:
|
102
|
-
|
102
|
+
compose:
|
103
103
|
web:
|
104
104
|
environment:
|
105
105
|
- RAILS_ENV=staging
|
@@ -126,7 +126,7 @@ staging:
|
|
126
126
|
&& foreman start
|
127
127
|
"
|
128
128
|
|
129
|
-
|
129
|
+
compose:
|
130
130
|
web:
|
131
131
|
build: .
|
132
132
|
working_dir: /project/spec/dummy
|
@@ -143,7 +143,7 @@ docker-compose:
|
|
143
143
|
# Mount the gems data volume container for cached bundler gem files
|
144
144
|
- #{GEMS_VOLUME_NAME}
|
145
145
|
|
146
|
-
# https://docs.docker.com/v1.6/
|
146
|
+
# https://docs.docker.com/v1.6/compose/cli/#environment-variables
|
147
147
|
environment:
|
148
148
|
# Tell bundler where to get the files
|
149
149
|
- GEM_HOME=#{GEMS_VOLUME_PATH}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- ".rspec"
|
135
135
|
- ".ruby-gemset"
|
136
136
|
- ".ruby-version"
|
137
|
+
- ".travis.yml"
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE.txt
|
139
140
|
- README.md
|
@@ -141,10 +142,10 @@ files:
|
|
141
142
|
- bin/docker-rails
|
142
143
|
- docker-rails.gemspec
|
143
144
|
- lib/docker/rails.rb
|
144
|
-
- lib/docker/rails/CLI/db_check.rb
|
145
|
-
- lib/docker/rails/CLI/gems_volume.rb
|
146
|
-
- lib/docker/rails/CLI/main.rb
|
147
145
|
- lib/docker/rails/app.rb
|
146
|
+
- lib/docker/rails/cli/db_check.rb
|
147
|
+
- lib/docker/rails/cli/gems_volume.rb
|
148
|
+
- lib/docker/rails/cli/main.rb
|
148
149
|
- lib/docker/rails/compose_config.rb
|
149
150
|
- lib/docker/rails/config.rb
|
150
151
|
- lib/docker/rails/version.rb
|