You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: add self-hosted upgrade and rollback guide - #8890
Adds Helm specific upgrade and rollback steps to the existing Upgrades and Rollbacks page, and removes the standalone upgrading page.
What changed
New section "Upgrading and Rolling Back with Helm" in upgrades-and-rollbacks.md: before you upgrade, the Helm upgrade command, how migrations run, verifying the upgrade, rolling back, and troubleshooting.
A diagram showing the application and database at each stage of an upgrade and rollback.
How I tested
Local kind cluster, default values, chart 0.80.0 (Flagsmith 2.222.0) upgraded to chart 0.85.0 (Flagsmith 2.286.0), then rolled back. I ran the rollback test twice, the second time from a fresh install with a database backup taken first.
Results
helm rollback on its own leaves the older application running against the newer schema. The API log shows the ProgrammingError quoted in the page, and the dashboard shows a misleading permissions message.
rollbackmigrationsafter is not recognised on 2.286.0. The command available there is rollbackmigrationsappliedafter, which takes the time in ISO format.
rollbackmigrationsappliedafter stopped partway both times, at experimentation.0014_drop_ingestion_infrastructure_and_delivery_log, with FieldDoesNotExist: WarehouseDeliveryLog has no field named 'connection'. Migration counts were 526 before the upgrade, 617 after it, and 598 after the failed rollback. After helm rollback the older application still ran and flags could be created. The page tells readers to restore their backup if the command fails partway.
Not tested
Custom values, an external or managed database, the jobs.migrateDb Job, the analytics migration, other version pairs, and downtime during a rolling upgrade.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Walkthrough
The change adds a self-hosted Helm upgrade and rollback guide. It describes database backup, upgrade settings, migration checks, and deployment verification. It explains that chart rollback does not reverse database migrations and provides a tested database restore procedure. The guide also lists troubleshooting steps, chart 0.85.0 analytics-storage options, and configurations and scenarios that were not tested.
This guide adds a self-hosted upgrade and rollback procedure. A few documented steps could trip up operators: the backup is staged inside the database pod, the analytics migration is only partly described, the scratch-database cleanup relies on a written warning rather than chained commands, and the task processor may not be restarted after a restore. Review these gaps before merging; the guide marks the affected scenarios as untested.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 1a193799-d8b1-48e2-a47c-2f59b5acb723
Commits
Reviewing files that changed from the base of the PR and between 225825f and d49da3d.
Files selected for processing: 1
docs/docs/deployment-self-hosting/upgrading.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 12
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 21fcfeb9-050b-457d-a11f-3b57776d70c2
Commits
Reviewing files that changed from the base of the PR and between 5051ac2 and a96256c.
Files ignored due to path filters: 1
docs/docs/diagrams/upgrade-rollback-restore.svg is excluded by !**/*.svg
Files selected for processing: 1
docs/docs/deployment-self-hosting/upgrading.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Thanks @germangarces. I'm working through CodeRabbit's comments now. Most are fair and I'll fix them, and I'll retest the changed backup and restore commands before pushing. I'll answer two with my reasons instead of applying them as suggested. I'll ping you once it's updated.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Restore database-level settings and privileges.
If the original database restricts CONNECT or has database-specific settings, recreating it with createdb loses those attributes. This pg_restore command does not restore them without --create. The replacement can therefore have different access controls or settings after rollback. Preserve and restore those attributes as part of the procedure. (postgresql.org)
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 012f95ae-1f23-4f74-ba7f-1e12659ceefb
Commits
Reviewing files that changed from the base of the PR and between a96256c and d24ee25.
Files selected for processing: 1
docs/docs/deployment-self-hosting/upgrading.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
All reported issues were addressed across 2 files
Reply to a comment to ask cubic a question or push back. It learns from your replies. Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 5c8be259-559f-4fc6-9f68-2e9c64edefde
Commits
Reviewing files that changed from the base of the PR and between d24ee25 and ed22924.
Files selected for processing: 1
docs/docs/deployment-self-hosting/upgrading.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@germangarces Thanks for your patience. I’ve pushed a final update that addresses CodeRabbit’s and cubic’s comments, and I’ve replied on each thread. Where I didn’t apply a suggestion as written, I explained why in the thread. The commands were retested on a fresh kind install, and the later changes are wording only. Setups I couldn’t test, such as the task processor, autoscaling and external databases, are marked as not tested on the page. The full test report is linked in the description. Please take another look when you have time.
@germangarces All review comments are now addressed and the threads are resolved, so it’s ready for another look whenever you have time. If there are other gaps in the self-hosting docs that need filling, I’d be glad to help with them. Thank you for your guidance on this.
Hi @germangarces, thank you for the detailed review. I've pushed an update that covers all of your comments. The Helm steps now live in upgrades-and-rollbacks.md and upgrading.md is gone, the testing notes have moved to the PR description, the backup step is one line with the PostgreSQL link, the chart 0.85.0 section is removed, and the SVG metadata is stripped.
I retested the rollback on a kind cluster, chart 0.80.0 (Flagsmith 2.222.0) to 0.85.0 (2.286.0), and found two things I wanted you to see.
First, the command name. On 2.286.0, rollbackmigrationsafter returns "Unknown command", and Django suggests rollbackmigrationsappliedafter. That is the only rollback command listed by manage.py help. My section uses it, with the time in ISO format. I left the existing lines on the page alone, so they still use the other name. Could you tell me which one is right for which versions?
Second, the command stopped partway. With a UTC time just before the upgrade, it unapplied 19 migrations and then failed at experimentation.0014_drop_ingestion_infrastructure_and_delivery_log with "FieldDoesNotExist: WarehouseDeliveryLog has no field named 'connection'". I got the same result twice, the second time from a fresh install with a backup taken first. The older version still ran afterwards and I could create flags, but the database was only partly rolled back. So I added a line to the page saying to restore the backup if the command fails.
Is this a known limitation for this version pair, or would you like me to open an issue? I only tested this one pair with default values, and I can share the full output.
Ready for another look whenever you have time. Thanks again.
First, the command name. On 2.286.0, rollbackmigrationsafter returns "Unknown command", and Django suggests rollbackmigrationsappliedafter. That is the only rollback command listed by manage.py help. My section uses it, with the time in ISO format. I left the existing lines on the page alone, so they still use the other name. Could you tell me which one is right for which versions?
Yeah, sorry. The command is rollbackmigrationsappliedafter.
Second, the command stopped partway. With a UTC time just before the upgrade, it unapplied 19 migrations and then failed at experimentation.0014_drop_ingestion_infrastructure_and_delivery_log with "FieldDoesNotExist: WarehouseDeliveryLog has no field named 'connection'". I got the same result twice, the second time from a fresh install with a backup taken first. The older version still ran afterwards and I could create flags, but the database was only partly rolled back. So I added a line to the page saying to restore the backup if the command fails.
Is this a known limitation for this version pair, or would you like me to open an issue? I only tested this one pair with default values, and I can share the full output.
Actually, it is a known limitation. The issue is fixed in #8750 (release 2.287.0)
Good catch. I forgot about it; We'd appreciate it if you can add it!
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Contributes to #7429
Changes
Adds Helm specific upgrade and rollback steps to the existing Upgrades and Rollbacks page, and removes the standalone upgrading page.
What changed
How I tested
Local kind cluster, default values, chart 0.80.0 (Flagsmith 2.222.0) upgraded to chart 0.85.0 (Flagsmith 2.286.0), then rolled back. I ran the rollback test twice, the second time from a fresh install with a database backup taken first.
Results
Not tested
Custom values, an external or managed database, the jobs.migrateDb Job, the analytics migration, other version pairs, and downtime during a rolling upgrade.