Make blackbox app service wait for postgres

This commit is contained in:
Daniel Schädler 2026-04-11 15:51:57 +02:00
parent 71cedbd33d
commit dc60e672b8
2 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,15 @@ rails e2e spec:
alias: postgres alias: postgres
- name: $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA - name: $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA
alias: app alias: app
entrypoint:
- /bin/bash
- -lc
command:
- |
until getent hosts postgres >/dev/null 2>&1; do sleep 1; done
until bundle exec ruby -rpg -e "PG.connect(ENV.fetch('POSTGRES_URL')).close" >/dev/null 2>&1; do sleep 1; done
bundle exec rails db:migrate
exec bundle exec rails s -p 3000 -b 0.0.0.0
variables: variables:
POSTGRES_DB: turniere_blackbox POSTGRES_DB: turniere_blackbox
POSTGRES_USER: turniere POSTGRES_USER: turniere

View File

@ -9,4 +9,5 @@ COPY . /app
# Duplicate production environment to beta environment # Duplicate production environment to beta environment
COPY config/environments/production.rb config/environments/beta.rb COPY config/environments/production.rb config/environments/beta.rb
ENV RAILS_ENV production ENV RAILS_ENV production
EXPOSE 3000
CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0 CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0