Skip to content

feat: Adopt the flagsmith entrypoint#7901

Merged
khvn26 merged 3 commits into
mainfrom
feat/adopt-flagsmith-entrypoint
Jul 6, 2026
Merged

feat: Adopt the flagsmith entrypoint#7901
khvn26 merged 3 commits into
mainfrom
feat/adopt-flagsmith-entrypoint

Conversation

@khvn26

@khvn26 khvn26 commented Jun 29, 2026

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #7891.

Adopts the flagsmith CLI entrypoint (from flagsmith-common) for container startup, replacing the bespoke sequencing in api/scripts/run-docker.sh.

  • run-docker.sh is reduced to a backwards-compatible shim (exec flagsmith "$@"), so anything invoking the script path or its verbs keeps working.
  • The image ENTRYPOINT is now flagsmith; APPLICATION_LOGGERS (previously defaulted in the shell script) moves to a Dockerfile ENV so logging is unchanged.
  • The startup verbs are driven by settings, set in app/settings/common.py from the databases actually configured.
  • The task processor in SaaS no longer migrates on every task start. Its task definition command becomes start task-processor.
  • The temporary startPeriod raised to 120s in fix(infra): Task processor tasks killed during startup by health check #7887 is lowered to 30s in both the prod and staging task-processor definitions, which comfortably covers the new single-boot startup.

How did you test this code?

End-to-end against a local environment, exercising each verb via the flagsmith entrypoint:

  • flagsmith migrate — waits for the DB, migrates the configured databases, creates the cache table.
  • flagsmith serve — waits for the DB, starts the API; /health/liveness served on :8000.
  • flagsmith start task-processor — the new task-definition command; binds :8000 and starts the worker threads.
  • flagsmith migrate-and-serve — runs migrate, then bootstrap (via FLAGSMITH_STARTUP_COMMANDS), then serves.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 6, 2026 1:32pm
flagsmith-frontend-preview Ignored Ignored Preview Jul 6, 2026 1:32pm
flagsmith-frontend-staging Ignored Ignored Preview Jul 6, 2026 1:32pm

Request Review

@github-actions github-actions Bot added api Issue related to the REST API infrastructure feature New feature or request and removed infrastructure labels Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.63%. Comparing base (8617611) to head (3f8b967).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7901   +/-   ##
=======================================
  Coverage   98.63%   98.63%           
=======================================
  Files        1497     1497           
  Lines       59189    59189           
=======================================
  Hits        58383    58383           
  Misses        806      806           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khvn26 khvn26 marked this pull request as ready for review June 29, 2026 10:44
@khvn26 khvn26 requested review from a team as code owners June 29, 2026 10:44
@khvn26 khvn26 requested review from emyller and germangarces and removed request for a team June 29, 2026 10:44
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7901 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-7901 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7901 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-7901 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7901 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7901 Finished ✅ Results

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  32.4 seconds
commit  e34f516
info  🔄 Run: #17918 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.3 seconds
commit  e34f516
info  🔄 Run: #17918 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

failed  2 failed
passed  1 passed

Details

stats  3 tests across 3 suites
duration  25.5 seconds
commit  e34f516
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17918 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

### Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  37 seconds
commit  5ddf8e8
info  🔄 Run: #18051 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  22.6 seconds
commit  5ddf8e8
info  🔄 Run: #18051 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

failed  2 failed
passed  5 passed

Details

stats  7 tests across 6 suites
duration  44.5 seconds
commit  5ddf8e8
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18051 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

### Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

failed  2 failed
passed  2 passed

Details

stats  4 tests across 4 suites
duration  47.7 seconds
commit  5ddf8e8
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18051 (attempt 2)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

### Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

failed  2 failed
passed  5 passed

Details

stats  7 tests across 6 suites
duration  23.8 seconds
commit  5ddf8e8
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18051 (attempt 2)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

### Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  18.8 seconds
commit  3f8b967
info  🔄 Run: #18052 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  42.8 seconds
commit  3f8b967
info  🔄 Run: #18052 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  45 seconds
commit  3f8b967
info  🔄 Run: #18052 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  53.2 seconds
commit  3f8b967
info  🔄 Run: #18052 (attempt 1)

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

germangarces
germangarces previously approved these changes Jun 29, 2026

@germangarces germangarces left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@khvn26 khvn26 marked this pull request as draft June 29, 2026 11:35
@khvn26 khvn26 marked this pull request as ready for review July 6, 2026 13:00
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0c4a37c7-d78e-49d4-895a-3c11cc8b435a

📥 Commits

Reviewing files that changed from the base of the PR and between 5ddf8e8 and 3f8b967.

📒 Files selected for processing (1)
  • Dockerfile

📝 Walkthrough

Walkthrough

This change adds Flagsmith migration orchestration settings in Django, switches container startup to invoke flagsmith directly, bumps flagsmith-common, and updates production and staging task-processor ECS definitions to use start task-processor with a shorter health check start period.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Dockerfile
  participant run-docker.sh
  participant flagsmith
  Dockerfile->>flagsmith: ENTRYPOINT flagsmith
  run-docker.sh->>flagsmith: exec flagsmith "$@"
Loading

Related issues: None specified in the provided context.

Related PRs: None specified in the provided context.

Suggested labels: infrastructure, dependencies, settings

Suggested reviewers: None specified in the provided context.


Comment @coderabbitai help to get the list of available commands.

khvn26 added 2 commits July 6, 2026 14:04
Replace the bespoke startup sequencing in run-docker.sh with the composite
verbs provided by the flagsmith-common `flagsmith` entrypoint:

- run-docker.sh becomes a thin `exec flagsmith "$@"` shim, kept for callers
  that reference the script path or its verbs directly.
- The image ENTRYPOINT is now `flagsmith`; the APPLICATION_LOGGERS default the
  shell script used to set moves to a Dockerfile ENV.
- Startup verbs are driven by new settings built from the configured databases
  (FLAGSMITH_MIGRATE_DATABASES, FLAGSMITH_WAIT_FOR_MIGRATIONS_DATABASES,
  FLAGSMITH_STARTUP_COMMANDS).
- The task processor task definition starts via `start task-processor` and no
  longer migrates on every task; migrations run once per deploy via the
  migration task. startPeriod drops from 120s to 30s for the faster boot.

flagsmith-common is temporarily sourced from its branch until the verbs are
released; revert to the PyPI release before merge (see pyproject TODO).

beep boop
Populate FLAGSMITH_MIGRATE_DATABASES and FLAGSMITH_WAIT_FOR_MIGRATIONS_DATABASES
as each database alias is configured, instead of reconstructing them from a
_configured_databases snapshot after the fact.

Bump flagsmith-common to the 3.11.0 release, which ships the composite startup
verbs, and drop the temporary git source. Remove the now-redundant prose
comments from run-docker.sh and the settings.

beep boop
@khvn26 khvn26 force-pushed the feat/adopt-flagsmith-entrypoint branch from 6669808 to 5ddf8e8 Compare July 6, 2026 13:08

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 31a303dc-1e5b-466f-8795-24835cf1cb65

📥 Commits

Reviewing files that changed from the base of the PR and between c153c3f and 6669808.

⛔ Files ignored due to path filters (1)
  • api/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Dockerfile
  • api/app/settings/common.py
  • api/pyproject.toml
  • api/scripts/run-docker.sh
  • infrastructure/aws/production/ecs-task-definition-task-processor.json
  • infrastructure/aws/staging/ecs-task-definition-task-processor.json

Comment thread Dockerfile
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request infrastructure labels Jul 6, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
api/app/settings/common.py (1)

193-201: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Seed default in the fallback database-config path The if/elif already avoids a double append, but when neither DATABASE_URL nor the legacy DJANGO_DB_NAME vars are set, both Flagsmith lists stay empty. That leaves default out of flagsmith start, so the primary database is neither waited on nor migrated.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d1625745-de7f-4a3d-9920-858d7c6d8724

📥 Commits

Reviewing files that changed from the base of the PR and between 6669808 and 5ddf8e8.

⛔ Files ignored due to path filters (1)
  • api/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Dockerfile
  • api/app/settings/common.py
  • api/pyproject.toml
  • api/scripts/run-docker.sh
  • infrastructure/aws/production/ecs-task-definition-task-processor.json
  • infrastructure/aws/staging/ecs-task-definition-task-processor.json

Comment thread api/app/settings/common.py
…h entrypoint

The flagsmith-common `serve` verb runs a bare `flagsmith start api`, whose
gunicorn defaults are GUNICORN_WORKERS=1 and GUNICORN_THREADS=1. The
run-docker.sh serve() it replaces defaulted to 3 workers and 2 threads, so
image consumers that do not set these (self-hosted deployments and the E2E
suite) drop from six concurrent request handlers to one.

Restore the previous defaults as image ENV, alongside APPLICATION_LOGGERS.
SaaS is unaffected — its task definitions set both explicitly.

beep boop
@github-actions github-actions Bot added infrastructure feature New feature or request and removed feature New feature or request infrastructure labels Jul 6, 2026
Comment thread Dockerfile

@germangarces germangarces left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@khvn26 khvn26 merged commit da194ca into main Jul 6, 2026
33 checks passed
@khvn26 khvn26 deleted the feat/adopt-flagsmith-entrypoint branch July 6, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proxy run-docker.sh to flagsmith entrypoint

3 participants