mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
Add Docker documentation to the installation docs; update and create the ”Scripts To Rule Them All” scripts for easy use of the Docker Composer environment.
Fixes #2425.
This commit is contained in:
parent
b57a62b72d
commit
d145640ead
8 changed files with 172 additions and 16 deletions
11
script/bootstrap
Executable file
11
script/bootstrap
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# script/bootstrap: Resolve all dependencies that the application requires to
|
||||
# run.
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
echo "==> Building Docker image…"
|
||||
$docker_compose build
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
appdir=$(cd $(dirname "$0")/.. && pwd)
|
||||
[ -f /etc/app-env ] || exec "$appdir/script/docker-environment" $0 $@
|
||||
|
||||
export RAILS_ENV='development'
|
||||
bin/rails console
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
# Find our app dir
|
||||
appdir=$(cd $(dirname "$0")/.. && pwd)
|
||||
|
||||
|
@ -11,4 +13,4 @@ export VOLUME="$appdir"
|
|||
image=${DOCKER_IMAGE:=web}
|
||||
|
||||
port_publish=""; [ "${BIND_DOCKER_SERVICE_PORTS:-}" = 1 ] && port_publish="--service-ports"
|
||||
exec docker-compose run $port_publish --rm $image $cmd
|
||||
exec $docker_compose run $port_publish --rm $image $cmd
|
||||
|
|
18
script/setup
Executable file
18
script/setup
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# script/setup: Set up application for the first time after cloning, or set it
|
||||
# back to the initial first unused state.
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
script/bootstrap
|
||||
|
||||
script/poll-for-db
|
||||
|
||||
echo "==> Setting up DB…"
|
||||
# reset database to a fresh state.
|
||||
bin/rake db:create db:reset
|
||||
|
||||
echo "==> App is now ready to go!"
|
47
script/test
Executable file
47
script/test
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# script/test: Run test suite for application. Optionally pass in a path to an
|
||||
# individual test file to run a single test.
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
function cleanup() {
|
||||
$docker_compose down
|
||||
}
|
||||
|
||||
function die() {
|
||||
echo $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
script/poll-for-db
|
||||
|
||||
if [ "$RAILS_ENV" = "test" ] || [ "$RACK_ENV" = "test" ]; then
|
||||
# if executed and the environment is already set to `test`, then we want a
|
||||
# clean from scratch application. This almost always means a ci environment,
|
||||
# since we set the environment to `test` directly in `script/cibuild`.
|
||||
script/setup
|
||||
else
|
||||
# if the environment isn't set to `test`, set it to `test` and update the
|
||||
# application to ensure all dependencies are met as well as any other things
|
||||
# that need to be up to date, like db migrations. The environment not having
|
||||
# already been set to `test` almost always means this is being called on its
|
||||
# own from a `development` environment.
|
||||
export RAILS_ENV="test" RACK_ENV="test"
|
||||
|
||||
script/update
|
||||
fi
|
||||
|
||||
echo "==> Running tests…"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
# pass arguments to test call. This is useful for calling a single test.
|
||||
$docker_compose run web bin/rake test "$1"
|
||||
else
|
||||
$docker_compose run web bin/rake test
|
||||
fi
|
||||
|
13
script/update
Executable file
13
script/update
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# script/update: Update application to run for its current checkout.
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
script/bootstrap
|
||||
|
||||
echo "==> Updating db…"
|
||||
# run all database migrations to ensure everything is up to date.
|
||||
$docker_compose run web bin/rake db:migrate
|
Loading…
Add table
Add a link
Reference in a new issue