diff --git a/docker-compose.coolify.yaml b/docker-compose.coolify.yaml index ba1cbb752..6b4445dee 100644 --- a/docker-compose.coolify.yaml +++ b/docker-compose.coolify.yaml @@ -46,7 +46,7 @@ services: - command: - sh - '-c' - - 'bundle exec rails db:chatwoot_prepare && bundle exec rails branding:update && if [ -n "$${BRAND_ASSETS_URL}" ]; then deployment/extract_brand_assets.sh "$${BRAND_ASSETS_URL}"; fi' + - 'bundle exec rails branding:update && if [ -n "$${BRAND_ASSETS_URL}" ]; then deployment/extract_brand_assets.sh "$${BRAND_ASSETS_URL}"; fi' healthcheck: test: - CMD-SHELL @@ -61,8 +61,12 @@ services: volumes: - 'storage:/app/storage' depends_on: - - postgres - - redis + rails: + condition: service_healthy + postgres: + condition: service_started + redis: + condition: service_started environment: - NODE_ENV=production - RAILS_ENV=production diff --git a/docker/entrypoints/rails.sh b/docker/entrypoints/rails.sh index 77657f6ee..bd17c7f25 100755 --- a/docker/entrypoints/rails.sh +++ b/docker/entrypoints/rails.sh @@ -30,5 +30,11 @@ do sleep 2; done +# Run pending migrations before starting the server so that workers +# (sidekiq) that depend on the rails healthcheck never see a stale schema. +echo "Running db:chatwoot_prepare..." +bundle exec rake db:chatwoot_prepare +echo "Database preparation complete." + # Execute the main process of the container exec "$@"