Skip to content

Fix/fresh start#121

Open
juanfernandezgullermo wants to merge 1 commit into
evolution-foundation:developfrom
juanfernandezgullermo:fix/fresh_start
Open

Fix/fresh start#121
juanfernandezgullermo wants to merge 1 commit into
evolution-foundation:developfrom
juanfernandezgullermo:fix/fresh_start

Conversation

@juanfernandezgullermo

@juanfernandezgullermo juanfernandezgullermo commented Jun 16, 2026

Copy link
Copy Markdown

Description

Reverts PR #97. That PR replaced db:prepare with db:create && db:migrate as a workaround for non-idempotent migrations (issue #78). This PR restores db:prepare because:

Root cause fixed: auth-service migrations are now idempotent (see companion PR in evo-auth-service-community).
db:prepare is the Rails-recommended command for Docker: it auto-detects whether to create+load schema or just run pending migrations.
db:create && db:migrate replays all migrations from scratch on fresh start — slower and more fragile if any migration isn't perfectly idempotent.

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • CI/CD
  • Refactor
  • Other: Fix for fresh start up

Service(s) Affected

  • Auth Service (evo-auth-service-community)
  • CRM Service (evo-ai-crm-community)
  • Frontend (evo-ai-frontend-community)
  • Processor (evo-ai-processor-community)
  • Core Service (evo-ai-core-service-community)
  • Root / Infrastructure (docker-compose, Makefile, CI/CD, docs)

Checklist

  • I have tested this locally
  • I have updated documentation (if applicable)
  • This does not introduce breaking changes
  • I have followed the Contributing Guidelines

Summary by Sourcery

Build:

  • Update docker-compose auth-service startup command to run db:prepare instead of separate db:create and db:migrate for safer repeated launches.

@sourcery-ai

sourcery-ai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the auth-service docker-compose startup command to use Rails db:prepare for idempotent database setup instead of explicitly running db:create followed by db:migrate.

Sequence diagram for updated auth-service startup database preparation

sequenceDiagram
    participant DockerCompose
    participant AuthServiceContainer
    participant Rails
    participant Postgres

    DockerCompose->>AuthServiceContainer: start container
    AuthServiceContainer->>Rails: bundle install
    AuthServiceContainer->>Rails: rails db:prepare
    Rails->>Postgres: create_database_if_needed
    Rails->>Postgres: run_pending_migrations
    AuthServiceContainer->>Rails: rails s -p 3001 -b 0.0.0.0
Loading

File-Level Changes

Change Details Files
Make the auth-service container database initialization idempotent by replacing explicit create+migrate with Rails db:prepare in the startup command.
  • Updated the Rails startup command to remove separate db:create and db:migrate invocations.
  • Added a single bundle exec rails db:prepare step before starting the Rails server.
  • Kept existing steps for cleaning the old server PID file, running bundle install, and launching the Rails server unchanged.
docker-compose.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider moving the long bash -c command (PID removal, bundle install, db tasks, server start) into an entrypoint script to improve readability and maintainability of the docker-compose configuration.
  • Running bundle install on every container startup can significantly slow boot and introduce variability; consider installing dependencies at image build time and removing bundle install from the runtime command.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider moving the long `bash -c` command (PID removal, bundle install, db tasks, server start) into an entrypoint script to improve readability and maintainability of the docker-compose configuration.
- Running `bundle install` on every container startup can significantly slow boot and introduce variability; consider installing dependencies at image build time and removing `bundle install` from the runtime command.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants