diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-09-19 04:36:39 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-09-19 05:01:16 +0300 |
commit | 84df8eed33f34359056575275fddff9a88b3b3fe (patch) | |
tree | 93739a617c4eebcc4ac16f05f78cc7ce8b4336b8 /script | |
parent | 7c450b4446c4d060b15cc9c6e50739ef60550ecb (diff) |
Add redis to docker development setup
With #8392 the `single_process_mode` was removed, which means that
development now also requires a redis.
Diffstat (limited to 'script')
-rwxr-xr-x | script/diaspora-dev | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/script/diaspora-dev b/script/diaspora-dev index 067f8c978..cfc543e9f 100755 --- a/script/diaspora-dev +++ b/script/diaspora-dev @@ -208,6 +208,11 @@ dia_is_db_running() { dia_docker_compose ps --services --filter status=running | grep -qx $DIASPORA_DOCKER_DB } +dia_is_redis_running() { + # Check if redis container is running + dia_docker_compose ps --services --filter status=running | grep -qx redis +} + dia_get_db() { # Get currently configured or assumed db type grep -q '^ <<: \*mysql' "$DIASPORA_CONFIG_DB" 2>/dev/null && echo mysql || echo postgresql @@ -324,13 +329,14 @@ dia_exec() { # Use a running container dia_docker_compose exec $detach diaspora /exec-entrypoint.sh "$@" else - if ! dia_is_db_running; then not_running=1; fi + # stop db/redis if it was not running before + if ! dia_is_db_running; then stopdb="dia_docker_compose stop $DIASPORA_DOCKER_DB"; fi + if ! dia_is_redis_running; then stopredis="dia_docker_compose stop redis"; fi # Start a new container echo "No running instance found, starting new one for command execution ..." dia_docker_compose run --rm $detach --service-ports diaspora "$@" - if [ ! -z $not_running ]; then - dia_docker_compose stop $DIASPORA_DOCKER_DB - fi + $stopdb + $stopredis fi } @@ -449,24 +455,28 @@ dia_setup() { dia_setup_rails() { # Prepare rails, install dependencies, migrate database, ... - # stop db if it was not running before echo "Setting up environment for tests ..." + # stop db/redis if it was not running before if ! dia_is_db_running; then stopdb="dia_docker_compose stop $DIASPORA_DOCKER_DB"; fi + if ! dia_is_redis_running; then stopredis="dia_docker_compose stop redis"; fi dia_docker_compose run --rm diaspora bin/setup $stopdb + $stopredis } dia_setup_tests() { # Prepare all possible tests - # stop db if it was not running before echo "Setting up environment for tests ..." + # stop db/redis if it was not running before if ! dia_is_db_running; then stopdb="dia_docker_compose stop $DIASPORA_DOCKER_DB"; fi + if ! dia_is_redis_running; then stopredis="dia_docker_compose stop redis"; fi dia_docker_compose run \ --rm \ -e RAILS_ENV=test \ diaspora \ bin/rake db:create db:migrate tests:generate_fixtures assets:generate_error_pages $stopdb + $stopredis } dia_start() { |