(Feat) Skip DB migration, setup and waiting using env variables

Typo

New section in Readme

Refactoring

Feedback

Bump version

Fix documentation
This commit is contained in:
Miguel Martinez
2016-12-08 10:17:15 -08:00
parent 6f63ecad23
commit 45cdb2b0f8
3 changed files with 34 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ RUN gem install therubyracer
ENV RAILS_ENV=development
ENV BITNAMI_APP_NAME=rails
ENV BITNAMI_IMAGE_VERSION=5.0.0.1-r3
ENV BITNAMI_IMAGE_VERSION=5.0.0.1-r4
USER bitnami
WORKDIR /app

View File

@@ -117,6 +117,34 @@ Following are a few examples of launching some commonly used Rails development c
> $ docker-compose restart myapp
> ```
## Running additional services:
Sometimes, your application will require extra pieces, such as background processing tools like Resque
or Sidekiq.
For these cases, it is possible to re-use this container to be run as an additional
service in your docker-compose file by modifying the command
executed.
For example, you could run a Sidekiq container by adding the following to your
`docker-compose.yml` file:
```yaml
services:
...
sidekiq:
image: bitnami/rails:latest
environment:
# This skips the execution of rake db:create and db:migrate
# since it is being executed by the rails service.
- SKIP_DB_SETUP=true
command: bundle exec sidekiq
```
> **Note**
>
> You can skip database wait period and creation/migration by setting the SKIP_DB_WAIT and SKIP_DB_SETUP environment variables.
## Installing Rubygems
To add a Rubygem to your application, update the `Gemfile` in the application directory as you would normally do and restart the `myapp` service container.

View File

@@ -58,7 +58,7 @@ if [ "$1" == "bundle" -a "$2" == "exec" ]; then
log "Gems updated"
fi
wait_for_db
[[ -z $SKIP_DB_WAIT ]] && wait_for_db
if ! fresh_container; then
echo "#########################################################################"
@@ -70,12 +70,14 @@ if [ "$1" == "bundle" -a "$2" == "exec" ]; then
echo " "
echo "#########################################################################"
else
setup_db
[[ -z $SKIP_DB_SETUP ]] && setup_db
log "Initialization finished"
touch $INIT_SEM
fi
migrate_db
[[ -z $SKIP_DB_SETUP ]] && migrate_db
fi
exec /entrypoint.sh "$@"