Fix PostgreSQL 13→16 upgrade path in deploy-dev#668
Merged
Conversation
Fixes multiple issues preventing deploy-dev from running over existing PG 13 databases: - Add failed_when: false to service stops (handles missing foreman.target) - Change upgrade container volume from :Z to :z (fixes SELinux permission denied) - Replace creates: guard with proper stream check for dnf module switch-to Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The deploy-dev playbook was missing the systemd_target role, so foreman.target was never created. This meant services couldn't be stopped cleanly before re-deploying, causing handler failures (e.g. pulp-api.socket refusing to start because pulp-api.service was already active). Add the systemd_target role (matching production deploy) and a pre-task to stop foreman.target before re-deploying. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
evgeni
reviewed
Jul 17, 2026
evgeni
reviewed
Jul 17, 2026
evgeni
reviewed
Jul 17, 2026
evgeni
reviewed
Jul 17, 2026
Remove the deploy-dev pre-task that stopped foreman.target before deployment - the roles should handle idempotent re-deploys. Remove the explicit postgresql stop from the upgrade path since postgresql is PartOf=foreman.target and stopping the target cascades to it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert pre_install changes since production always deploys on clean systems. Instead, handle the postgresql module switch as a deploy-dev pre-task for dev re-deploy scenarios. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The SELinux issue was caused by the main postgresql container not being stopped before the upgrade container ran, leading to conflicting MCS categories. With foreman.target properly stopping services first, :Z (private label) is correct. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
addressed comments and also updated the PR description to reflect the current state. |
ehelms
reviewed
Jul 17, 2026
Move the systemd_target role before postgresql in deploy-dev so foreman.target exists when the upgrade task needs to stop it. This eliminates the need for failed_when: false. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ehelms
reviewed
Jul 17, 2026
Move the dnf module switch-to task from the deploy-dev pre-tasks into the foreman_development role where it belongs alongside other dev-specific module setup like nodejs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ehelms
approved these changes
Jul 17, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are you introducing these changes? (Problem description, related links)
Commit ca470b8 ("Switch to PostgreSQL 16 image") introduced issues that cause
forge deploy-devto fail when re-deploying over an existing PostgreSQL 13 database.Three problems were identified:
upgrade.yamlstop task assumesforeman.targetexists, but deploy-dev never created it (thesystemd_targetrole was not included)foreman.target, services likepulp-apiaren't stopped before re-deploy, causing handler conflictspg_dumpstays at version 13 after the containerized PG upgrades to 16, breakingdb:migrateschema dumpsWhat are the changes introduced in this pull request?
failed_when: falseto the "Stop foreman target" task inupgrade.yaml— on first deploy,foreman.targetdoesn't exist yet (it's created bysystemd_targetwhich runs afterpostgresql)systemd_targetrole todeploy-dev.yaml— createsforeman.targetso all backing services can be managed as a group, matching the production deployHow to test this pull request
forge deploy-dev— should complete without errorscat /var/lib/pgsql/data/userdata/PG_VERSIONshows16forge deploy-devagain — idempotent re-run should succeed🤖 Generated with Claude Code