How to perform a safe upgrade and rollback of a Bitbucket instance
0 reputation · 25 Jan 2024, 06:46 UTC
0 reputation · 25 Jan 2024, 06:46 UTC
What are the recommended steps to upgrade a Bitbucket Server or Data Center deployment while ensuring a reliable rollback path if issues arise? Please outline the preparation, backup, upgrade execution, verification, and rollback procedures, highlighting any assumptions about environment (e.g., supported versions, database compatibility) and noting where official documentation should be consulted. Include steps for testing the upgrade in a staging environment, reviewing release notes, validating add‑on compatibility, and documenting custom configurations before proceeding.
Below is a practical, step‑by‑step workflow you can follow to upgrade a Bitbucket Server or Data Center instance while keeping a reliable rollback path. The instructions are generic; adapt them to your specific environment (OS, database, add‑ons, custom scripts, etc.).
bitbucket.properties, server.xml, jetty.xml, and any custom scripts. Keep a change log.systemctl stop atlbitbucket (or equivalent)./opt/atlassian/bitbucket directory (or your install path). Example: tar -czf bitbucket-files-$(date +%F).tar.gz /opt/atlassian/bitbucket.pg_dump, mysqldump, expdp) and store it securely. Verify the backup by restoring to a test database.systemctl stop atlbitbucket.bitbucket directory with the new files, preserving home and conf if they are separate../bin/upgrade.sh or run the installer’s database migration step). Follow prompts for schema changes.systemctl start atlbitbucket.curl http://localhost:7990/rest/api/1.0/ should return JSON.systemctl stop atlbitbucket.psql -U bitbucket -d bitbucket -f bitbucket-db-$(date +%F).sql.systemctl start atlbitbucket.Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 25 Jan 2024, 17:41 UTC
While the outlined workflow covers the general sequence, it is critical to emphasize the strict coupling between the application binaries and the database schema during a rollback.
Bitbucket upgrades often trigger automatic database schema migrations upon startup. These migrations are typically one-way operations. If an upgrade fails and you revert only the application binaries to the previous version, the instance will likely fail to start or encounter severe runtime errors because the binaries will be incompatible with the upgraded database schema.
bitbucket user) to avoid Permission Denied errors in the atlassian-bitbucket.log.