docker-rails 0.10.0 → 1.0.0
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/README.md +297 -137
- data/lib/docker/rails/app.rb +2 -2
- data/lib/docker/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e25183a59f695d855dcfdc3d1b5caa4b6418d5
|
4
|
+
data.tar.gz: 9e3059dd5e309a69d48e45d8ea86858e8052ed85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 069b90234e74e45219f8160a316adfd112ce700cf42ccc745186b8d786f1f2334d810544d14b74c4b539762b19ea91f347763100a994602c30f1144268191bc1
|
7
|
+
data.tar.gz: fb2274af2b37723c53f79fb259810700fd5c66897eab81f4e5d762a0464ff19fba03da26a0f3825f1bc4e3a8b457bc8aee6569aa515aec8fd397fc20b9cbb41f
|
data/README.md
CHANGED
@@ -3,7 +3,11 @@
|
|
3
3
|
[](https://travis-ci.org/alienfast/docker-rails)
|
4
4
|
[](https://codeclimate.com/github/alienfast/docker-rails)
|
5
5
|
|
6
|
-
A simplified pattern to execute rails applications within Docker (with a CI build emphasis).
|
6
|
+
A simplified pattern to execute rails applications within Docker (with a CI build emphasis).
|
7
|
+
|
8
|
+
Uses **version: '2'** of `docker-compose` syntax
|
9
|
+
|
10
|
+
Note: The only item that is rails-specific is the `db_check`, otherwise this can be useful for other CI situations as well. Perhaps we should have chosen a different name?
|
7
11
|
|
8
12
|
## Features
|
9
13
|
- DRY declarative `docker-rails.yml` allowing multiple environments to be defined with an inherited docker `compose` configuration
|
@@ -81,6 +85,7 @@ Commands:
|
|
81
85
|
docker-rails ps <target> # List containers for the target compose configuration e.g. docker-rails ps --build=222 development
|
82
86
|
docker-rails ps_all # List all remaining containers regardless of state e.g. docker-rails ps_all
|
83
87
|
docker-rails rm_dangling # Remove danging images e.g. docker-rails rm_dangling
|
88
|
+
docker-rails rm_exited # Remove exited containers e.g. docker-rails rm_exited
|
84
89
|
docker-rails rm_volumes <target> # Stop all running containers and remove corresponding volumes for the given build/target e.g. docker-rails rm_volumes --build=222 development
|
85
90
|
docker-rails stop <target> # Stop all running containers for the given build/target e.g. docker-rails stop --build=222 development
|
86
91
|
docker-rails up <target> # Up the docker-compose configuration for the given build/target. Use -d for detached mode. e.g. docker-rails up -d --build=222 test
|
@@ -108,19 +113,148 @@ Or install it yourself as:
|
|
108
113
|
|
109
114
|
### 1. Add a Dockerfile
|
110
115
|
|
116
|
+
This is a _real world example_ (**not a minimal example**) of a rails engine called `acme` with a `dummy` application used for testing. Other notable items:
|
117
|
+
- installs node
|
118
|
+
- uses [`dockito/vault`](https://github.com/dockito/vault) via `ONVAULT` to execute `npm` with private key access without exposing the npm key to the layer
|
119
|
+
- runs `npm build` to transpile the `dummy` application UI
|
120
|
+
- allows for use of a private npm registry
|
121
|
+
|
111
122
|
```bash
|
112
|
-
|
123
|
+
FROM convox/ruby
|
124
|
+
|
125
|
+
# mysql client, nodejs, clean up APT when done.
|
126
|
+
# - libelf1 for flow-bin
|
127
|
+
# - libfontconfig for phantomjs
|
128
|
+
RUN apt-get update -qq && apt-get install -qy \
|
129
|
+
vim \
|
130
|
+
wget \
|
131
|
+
libelf1 \
|
132
|
+
libfontconfig \
|
133
|
+
libmysqlclient-dev \
|
134
|
+
mysql-client \
|
135
|
+
git \
|
136
|
+
curl \
|
137
|
+
&& curl -L https://raw.githubusercontent.com/dockito/vault/master/ONVAULT > /usr/local/bin/ONVAULT \
|
138
|
+
&& chmod +x /usr/local/bin/ONVAULT \
|
139
|
+
&& rm -rf /var/lib/apt/lists/* \
|
140
|
+
&& apt-get -y autoclean
|
141
|
+
|
142
|
+
# Install nodejs - see dockerfile - https://github.com/nodejs/docker-node/blob/master/6.2/Dockerfile
|
143
|
+
# gpg keys listed at https://github.com/nodejs/node
|
144
|
+
RUN set -ex \
|
145
|
+
&& for key in \
|
146
|
+
9554F04D7259F04124DE6B476D5A82AC7E37093B \
|
147
|
+
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
148
|
+
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
|
149
|
+
FD3A5288F042B6850C66B31F09FE44734EB7990E \
|
150
|
+
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
151
|
+
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
152
|
+
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
|
153
|
+
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
154
|
+
; do \
|
155
|
+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
156
|
+
done
|
157
|
+
|
158
|
+
ENV NPM_CONFIG_LOGLEVEL error
|
159
|
+
ENV NODE_VERSION 6.8.1
|
160
|
+
|
161
|
+
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
162
|
+
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
163
|
+
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
164
|
+
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
165
|
+
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
166
|
+
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
|
167
|
+
|
168
|
+
# Set an environment variable to store where the app is installed to inside of the Docker image.
|
169
|
+
ENV INSTALL_PATH /app
|
170
|
+
RUN mkdir -p $INSTALL_PATH
|
171
|
+
WORKDIR $INSTALL_PATH
|
172
|
+
|
173
|
+
# Ensure gems are cached they are less likely to change than node modules
|
174
|
+
COPY acme.gemspec acme.gemspec
|
175
|
+
COPY Gemfile Gemfile
|
176
|
+
COPY Gemfile_shared.rb Gemfile_shared.rb
|
177
|
+
COPY spec/dummy/Gemfile spec/dummy/Gemfile
|
178
|
+
# This is only here to trigger re-bundle when lock changes, we actually only use the ImageGemfile.lock so that we are
|
179
|
+
# always doing a fresh bundle anytime the source lock changes.
|
180
|
+
COPY Gemfile.lock Gemfile.lock
|
181
|
+
|
182
|
+
# Bundle acme and the dummy app
|
183
|
+
RUN \
|
184
|
+
bundle install --jobs 12 --retry 3 --without development \
|
185
|
+
&& mv Gemfile.lock ImageGemfile.lock \
|
186
|
+
&& cd spec/dummy \
|
187
|
+
&& bundle install --jobs 12 --retry 3 --without development \
|
188
|
+
&& mv Gemfile.lock ImageGemfile.lock
|
189
|
+
|
190
|
+
# Ensure node_modules are cached next, they are less likely to change than source code
|
191
|
+
WORKDIR $INSTALL_PATH
|
192
|
+
COPY package.json package.json
|
193
|
+
COPY spec/dummy/package.json spec/dummy/package.json
|
194
|
+
|
195
|
+
# https://docs.npmjs.com/private-modules/docker-and-private-modules
|
196
|
+
ARG NPM_TOKEN
|
197
|
+
|
198
|
+
# npm install with:
|
199
|
+
# - private keys accessible
|
200
|
+
# - skip optional dependencies like fsevents
|
201
|
+
# - production (**turned off because we need eslint etc devDependencies)
|
202
|
+
# - link dummy's node_modules to acme for a faster install
|
203
|
+
# - add the authorized host key for github (avoids "Host key verification failed")
|
204
|
+
RUN \
|
205
|
+
#echo "Using NPM_TOKEN: ${NPM_TOKEN}" \
|
206
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc \
|
207
|
+
&& ONVAULT npm install --no-optional \
|
208
|
+
&& rm .npmrc \
|
209
|
+
&& cd spec/dummy \
|
210
|
+
&& ln -s $INSTALL_PATH/node_modules node_modules
|
211
|
+
|
212
|
+
# add all the test hosts to localhost to skip xip.io
|
213
|
+
RUN echo "127.0.0.1 localhost dummy.com.127.0.0.1.xip.io" >> /etc/hosts
|
214
|
+
|
215
|
+
#--------------
|
216
|
+
# NOTE: we evidently must include the VOLUME command **after** the npm install so that we can read the installed modules
|
217
|
+
#--------------
|
218
|
+
# Bypass the union file system for better performance (this is important for read/write of spec/test files)
|
219
|
+
# https://docs.docker.com/engine/reference/builder/#volume
|
220
|
+
# https://docs.docker.com/userguide/dockervolumes/
|
221
|
+
VOLUME $INSTALL_PATH
|
222
|
+
|
223
|
+
# Copy the project files into the container (again, better performance).
|
224
|
+
# Use `extract` in the docker-rails.yml to obtain files such as test results.
|
225
|
+
# NOTE: make sure all unwanted files are listed in the .dockerignore! i.e. lock files in the case of an engine!
|
226
|
+
COPY . .
|
227
|
+
|
228
|
+
#
|
229
|
+
# - Overwrite the source lock files with the image lock files (so we ensure a fresher bundle _and_ that we have the bundled gems in the lock file)
|
230
|
+
# - Run npm build on dummy
|
231
|
+
RUN \
|
232
|
+
mv ImageGemfile.lock Gemfile.lock \
|
233
|
+
&& cd spec/dummy \
|
234
|
+
&& mv ImageGemfile.lock Gemfile.lock \
|
235
|
+
&& npm run build
|
113
236
|
```
|
114
237
|
|
115
238
|
### 2. Add a docker-rails.yml
|
116
239
|
|
117
240
|
Environment variables will be interpolated, so feel free to use them.
|
118
|
-
The _rails engine_ example below shows an example with all of the environments `ssh_test |
|
241
|
+
The _rails engine_ example below shows an example with all of the environments `ssh_test | test | parallel_tests | sysbench*` to show reuse of the primary `compose` configuration.
|
119
242
|
|
120
243
|
```yaml
|
121
244
|
verbose: true
|
245
|
+
before_command: >
|
246
|
+
bash -c "
|
247
|
+
rm -Rf target
|
248
|
+
&& rm -Rf spec/dummy/log
|
249
|
+
&& mkdir -p target
|
250
|
+
"
|
122
251
|
exit_code: web
|
123
|
-
|
252
|
+
|
253
|
+
# ---
|
254
|
+
# Run a dockito vault container during the build to allow it to access secrets (e.g. github clone)
|
255
|
+
dockito:
|
256
|
+
vault:
|
257
|
+
enabled: true
|
124
258
|
|
125
259
|
# ---
|
126
260
|
# Declare a reusable extract set
|
@@ -130,167 +264,197 @@ extractions: &extractions
|
|
130
264
|
- '/app/target'
|
131
265
|
- '/app/vcr'
|
132
266
|
- '/app/spec/dummy/log:spec/dummy'
|
133
|
-
- '/app/tmp/parallel_runtime_cucumber.log:./tmp'
|
134
|
-
- '/app/tmp/parallel_runtime_rspec.log:./tmp'
|
135
267
|
|
136
|
-
|
137
|
-
# ---
|
138
|
-
# Declare a reusable elasticsearch container, staging/production connects to existing running instance.
|
268
|
+
# local environments need elasticsearch, staging/production connects to existing running instance.
|
139
269
|
elasticsearch: &elasticsearch
|
140
270
|
elasticsearch:
|
141
271
|
image: library/elasticsearch:1.7
|
142
272
|
ports:
|
143
273
|
- "9200"
|
144
|
-
|
145
|
-
# ---
|
146
|
-
# Base docker-compose configuration for all environments. Anything under the `compose` element must be standard docker-compose syntax.
|
147
|
-
compose:
|
148
|
-
web:
|
149
|
-
build: .
|
150
|
-
working_dir: /app/spec/dummy
|
151
|
-
ports:
|
152
|
-
- "3000"
|
153
|
-
links:
|
154
|
-
- db
|
155
|
-
volumes:
|
156
|
-
# make keys and known_hosts available
|
157
|
-
- ~/.ssh:/root/.ssh
|
158
|
-
|
159
|
-
db:
|
160
|
-
# https://github.com/docker-library/docs/tree/master/mysql
|
161
|
-
image: library/mysql:5.7.6
|
162
|
-
ports:
|
163
|
-
- "3306"
|
164
|
-
|
165
|
-
# https://github.com/docker-library/docs/tree/master/mysql#environment-variables
|
166
|
-
environment:
|
167
|
-
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
168
274
|
|
169
|
-
|
170
|
-
|
171
|
-
ssh_test:
|
275
|
+
test:
|
276
|
+
<<: *extractions
|
172
277
|
compose:
|
173
|
-
|
174
|
-
|
278
|
+
services:
|
279
|
+
<<: *elasticsearch
|
280
|
+
web:
|
281
|
+
links:
|
282
|
+
- elasticsearch # standard yaml doesn't merge arrays so we have to add this explicitly
|
283
|
+
environment:
|
284
|
+
- RAILS_ENV=test
|
285
|
+
- CI=true
|
286
|
+
command: >
|
287
|
+
bash -c "
|
288
|
+
cd ../.. \
|
289
|
+
&& gem list aws-sdk \
|
290
|
+
&& bundle exec rake -T \
|
291
|
+
&& npm run validate \
|
292
|
+
&& cd spec/dummy \
|
293
|
+
&& echo 'Check and wait for database connection' \
|
294
|
+
&& bundle exec docker-rails db_check mysql \
|
295
|
+
&& echo 'DB rebuild' \
|
296
|
+
&& bundle exec rake db:rebuild_test \
|
297
|
+
&& echo 'Tests' \
|
298
|
+
&& cd ../.. \
|
299
|
+
&& bundle exec rake spec SPEC=spec/app/models/plan_spec.rb cucumber FEATURE=features/public_pages.feature
|
300
|
+
"
|
175
301
|
|
176
|
-
|
302
|
+
parallel_tests:
|
303
|
+
<<: *extractions
|
177
304
|
compose:
|
178
|
-
|
305
|
+
services:
|
306
|
+
<<: *elasticsearch
|
307
|
+
web:
|
308
|
+
links:
|
309
|
+
- elasticsearch # standard yaml doesn't merge arrays so we have to add this explicitly
|
310
|
+
environment:
|
311
|
+
- RAILS_ENV=test
|
312
|
+
- CI=true
|
313
|
+
command: >
|
314
|
+
bash -c "
|
315
|
+
cd ../.. \
|
316
|
+
&& npm run validate \
|
317
|
+
&& cd spec/dummy \
|
318
|
+
&& echo 'Check and wait for database connection' \
|
319
|
+
&& bundle exec docker-rails db_check mysql \
|
320
|
+
&& echo 'DB rebuild' \
|
321
|
+
&& bundle exec rake db:rebuild_test[true] \
|
322
|
+
&& echo 'Tests' \
|
323
|
+
&& cd ../.. \
|
324
|
+
&& bundle exec rake parallel:spec parallel:features
|
325
|
+
"
|
326
|
+
|
327
|
+
compose:
|
328
|
+
version: '2'
|
329
|
+
services:
|
179
330
|
web:
|
331
|
+
build:
|
332
|
+
context: .
|
333
|
+
args:
|
334
|
+
- NPM_TOKEN
|
335
|
+
working_dir: /app/spec/dummy
|
336
|
+
ports:
|
337
|
+
- "3000"
|
338
|
+
- "4000"
|
180
339
|
links:
|
181
|
-
-
|
340
|
+
- db
|
341
|
+
# volumes:
|
342
|
+
# # make keys and known_hosts available
|
343
|
+
# - ~/.ssh:/root/.ssh
|
344
|
+
db:
|
345
|
+
# https://github.com/docker-library/docs/tree/master/mysql
|
346
|
+
image: library/mysql:5.7
|
347
|
+
ports:
|
348
|
+
- "3306"
|
349
|
+
volumes:
|
350
|
+
- ./db/mysql:/etc/mysql/conf.d
|
351
|
+
# https://github.com/docker-library/docs/tree/master/mysql#environment-variables
|
182
352
|
environment:
|
183
|
-
-
|
184
|
-
command: >
|
185
|
-
bash -c "
|
186
|
-
|
187
|
-
echo 'Bundling gems'
|
188
|
-
&& bundle install --jobs 4 --retry 3
|
189
|
-
|
190
|
-
&& echo 'Generating Spring binstubs'
|
191
|
-
&& bundle exec spring binstub --all
|
192
|
-
|
193
|
-
&& echo 'Clearing logs and tmp dirs'
|
194
|
-
&& bundle exec rake log:clear tmp:clear
|
353
|
+
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
195
354
|
|
196
|
-
&& echo 'Check and wait for database connection'
|
197
|
-
&& bundle exec docker-rails db_check mysql
|
198
355
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
&& gem install foreman
|
207
|
-
&& foreman start
|
208
|
-
"
|
356
|
+
# --------------------------
|
357
|
+
# test cases below here
|
358
|
+
ssh_test:
|
359
|
+
compose:
|
360
|
+
services:
|
361
|
+
web:
|
362
|
+
command: bash -c "ssh -T git@github.com"
|
209
363
|
|
210
|
-
|
211
|
-
<<: *extractions
|
364
|
+
sysbench_all:
|
212
365
|
compose:
|
213
|
-
|
214
|
-
|
215
|
-
links:
|
216
|
-
- elasticsearch # standard yaml doesn't merge arrays so we have to add this explicitly
|
217
|
-
environment:
|
218
|
-
- RAILS_ENV=test
|
219
|
-
command: >
|
220
|
-
bash -c "
|
221
|
-
echo 'Bundling gems'
|
222
|
-
&& bundle install --jobs 4 --retry 3
|
366
|
+
services:
|
367
|
+
<<: *elasticsearch
|
223
368
|
|
224
|
-
|
225
|
-
|
369
|
+
web:
|
370
|
+
command: >
|
371
|
+
bash -c "
|
226
372
|
|
227
|
-
|
228
|
-
|
373
|
+
echo 'Benchmarking CPU'
|
374
|
+
&& sysbench --test=cpu --cpu-max-prime=20000 run
|
229
375
|
|
230
|
-
|
231
|
-
|
376
|
+
&& echo 'Creating file for IO benchmark'
|
377
|
+
&& sysbench --test=fileio --file-total-size=2G prepare
|
232
378
|
|
233
|
-
|
234
|
-
|
235
|
-
&& xvfb-run -a bundle exec rake spec cucumber
|
236
|
-
"
|
379
|
+
&& echo 'Benchmarking IO'
|
380
|
+
&& sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
|
237
381
|
|
238
|
-
|
239
|
-
|
240
|
-
compose:
|
241
|
-
<<: *elasticsearch
|
242
|
-
web:
|
243
|
-
links:
|
244
|
-
- elasticsearch # standard yaml doesn't merge arrays so we have to add this explicitly
|
245
|
-
environment:
|
246
|
-
- RAILS_ENV=test
|
247
|
-
command: >
|
248
|
-
bash -c "
|
382
|
+
&& echo 'Cleaning up file for IO benchmark'
|
383
|
+
&& sysbench --test=fileio --file-total-size=2G cleanup
|
249
384
|
|
250
|
-
|
251
|
-
|
385
|
+
&& echo 'Bundling gems'
|
386
|
+
&& bundle install --jobs 4 --retry 3
|
252
387
|
|
253
|
-
|
254
|
-
|
388
|
+
&& echo 'Check and wait for database connection'
|
389
|
+
&& bundle exec docker-rails db_check mysql
|
255
390
|
|
256
|
-
|
257
|
-
|
391
|
+
&& echo 'Create test database'
|
392
|
+
&& mysql -h db -u root -e 'create database test'
|
258
393
|
|
259
|
-
|
260
|
-
|
394
|
+
&& echo 'Preparing MySQL benchmark'
|
395
|
+
&& sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-host=db prepare
|
261
396
|
|
262
|
-
|
263
|
-
|
264
|
-
&& xvfb-run -a bundle exec rake parallel:spec parallel:features
|
265
|
-
"
|
397
|
+
&& echo 'Benchmarking MySQL'
|
398
|
+
&& sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-host=db --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
|
266
399
|
|
267
|
-
|
400
|
+
&& echo 'Cleaning up MySQL benchmark'
|
401
|
+
&& sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-host=db cleanup
|
402
|
+
"
|
403
|
+
|
404
|
+
sysbench_db:
|
268
405
|
compose:
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
406
|
+
services:
|
407
|
+
<<: *elasticsearch
|
408
|
+
web:
|
409
|
+
command: >
|
410
|
+
bash -c "
|
274
411
|
|
275
|
-
|
276
|
-
|
412
|
+
echo 'Bundling gems'
|
413
|
+
&& bundle install --jobs 4 --retry 3
|
277
414
|
|
278
|
-
|
279
|
-
|
415
|
+
&& echo 'Check and wait for database connection'
|
416
|
+
&& bundle exec docker-rails db_check mysql
|
280
417
|
|
281
|
-
|
282
|
-
|
418
|
+
&& echo 'Create test database'
|
419
|
+
&& mysql -h db -u root -e 'create database test'
|
283
420
|
|
284
|
-
|
285
|
-
|
421
|
+
&& echo 'Preparing MySQL benchmark'
|
422
|
+
&& sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-host=db prepare
|
286
423
|
|
287
|
-
|
288
|
-
|
424
|
+
&& echo 'Benchmarking MySQL'
|
425
|
+
&& sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-host=db --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
|
289
426
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
427
|
+
&& echo 'Cleaning up MySQL benchmark'
|
428
|
+
&& sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-host=db cleanup
|
429
|
+
"
|
430
|
+
|
431
|
+
sysbench_io:
|
432
|
+
compose:
|
433
|
+
services:
|
434
|
+
<<: *elasticsearch
|
435
|
+
web:
|
436
|
+
command: >
|
437
|
+
bash -c "
|
438
|
+
echo 'Creating file for IO benchmark'
|
439
|
+
&& sysbench --test=fileio --file-total-size=2G prepare
|
440
|
+
|
441
|
+
&& echo 'Benchmarking IO'
|
442
|
+
&& sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
|
443
|
+
|
444
|
+
&& echo 'Cleaning up file for IO benchmark'
|
445
|
+
&& sysbench --test=fileio --file-total-size=2G cleanup
|
446
|
+
"
|
447
|
+
|
448
|
+
sysbench_cpu:
|
449
|
+
compose:
|
450
|
+
services:
|
451
|
+
<<: *elasticsearch
|
452
|
+
web:
|
453
|
+
command: >
|
454
|
+
bash -c "
|
455
|
+
echo 'Benchmarking CPU'
|
456
|
+
&& sysbench --test=cpu --cpu-max-prime=20000 run
|
457
|
+
"
|
294
458
|
```
|
295
459
|
|
296
460
|
## CI setup
|
@@ -339,14 +503,10 @@ source ~/.bash_profile
|
|
339
503
|
docker-rails cleanup --build=$bamboo_buildNumber parallel_tests
|
340
504
|
```
|
341
505
|
|
342
|
-
## Work in progress - contributions welcome
|
343
|
-
Open to pull requests. Open to refactoring. It can be expanded to suit many different configurations.
|
344
|
-
|
345
|
-
TODO:
|
346
|
-
- **DB versatility** - expand to different db status detection as-needed e.g. postgres. CLI is now modularized to allow for this.
|
347
|
-
|
348
506
|
## Contributing
|
349
507
|
|
508
|
+
Yes please.
|
509
|
+
|
350
510
|
1. Fork it ( https://github.com/[my-github-username]/docker-rails/fork )
|
351
511
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
352
512
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
@@ -354,4 +514,4 @@ TODO:
|
|
354
514
|
5. Create a new Pull Request
|
355
515
|
|
356
516
|
## License and Attributions
|
357
|
-
MIT license
|
517
|
+
MIT license
|
data/lib/docker/rails/app.rb
CHANGED
@@ -83,7 +83,7 @@ module Docker
|
|
83
83
|
|
84
84
|
# check the exit_code
|
85
85
|
if @config['exit_code'].nil?
|
86
|
-
first_defined_service = @compose_config.keys[0]
|
86
|
+
first_defined_service = @compose_config.services.keys[0]
|
87
87
|
puts "exit_code not set in configuration, using exit code from first defined service: #{first_defined_service}"
|
88
88
|
@config['exit_code'] = first_defined_service
|
89
89
|
end
|
@@ -107,7 +107,7 @@ module Docker
|
|
107
107
|
# - '/project/tmp/parallel_runtime_cucumber.log:./tmp'
|
108
108
|
# - '/project/tmp/parallel_runtime_rspec.log:./tmp'
|
109
109
|
|
110
|
-
@compose_config.each_key do |service_name|
|
110
|
+
@compose_config.services.each_key do |service_name|
|
111
111
|
service_config = @config[service_name]
|
112
112
|
extractions = service_config[:extract] unless service_config.nil?
|
113
113
|
next if extractions.nil?
|
data/lib/docker/rails/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|