We lost our server that was hosting Bitbucket on prem. The database is intact. I want to install Bitbucket on new server and connect to old database. What are the right procedures to not lose configuration? I tried to just point new install to the old database but it wants a clean database. For JIRA, I copied the old home directory on top of the new install. Updated the database connection info and boom it worked. Will the same thing work for Bitbucket? Not sure if I can get to old BItbucket home directory anymore so thought I would ask in here.
Hi Bryan,
If you backed using one of the methods in Using Bitbucket zero downtime backup or Using Bitbucket Server DIY Backup you can restore by running the restore script as the home and database info will be saved in the backup:
./bitbucket.diy-restore.sh
Additionally, if you used the Bitbucket Server Backup Client that will capture the home directory as well and you can restore using the below directions:
Restoring Bitbucket Server to use the existing DB
This section applies if you are restoring Bitbucket Server to fix a corrupted installation, but are able to use the existing DB that Bitbucket Server was backed up from. This scenario assumes that Bitbucket Server is to be restored to the same server from which Bitbucket Server was originally backed up.
The Restore Client must be run on the machine that Bitbucket Server should be restored to. To ensure restores do not accidentally delete existing data, the Restore Client will only restore into an empty home directory and an empty database.
The Restore Client will use the JDBC connection configuration contained in the backup you are restoring from.
Follow this process:
- Stop your Bitbucket Server instance.
- Delete the content of the current home directory, so that it is empty.
- Drop the existing tables in your database so it is empty. The database still needs to exist with the same user/password, and it should have the configuration described in the 'Create the Bitbucket Server database' section of the relevant page here:
Run the Restore Client using the following command (replacing '
path/to/bitbucket/home
' and '/path/to/original/backup/file
' with your own values):java -Dbitbucket.home="path/to/bitbucket/home" -jar bitbucket-restore-client.jar /path/to/original/backup/file
If you are restoring Bitbucket Server to fix a corrupted installation, now follow Steps 4 to 6 of the Bitbucket Server upgrade guide. Note that you should use the same version of Bitbucket Server that was used to back up Bitbucket Server.
If you did backup using one of the methods in Using Bitbucket zero downtime backup or Using Bitbucket Server DIY Backup take a look at the articles for more information in regards to the restore.
Cheers,
Branden
Thanks, since I did not follow the procedures for backing up (hangs head in shame) I did not have a restore to perform. But I did have copies of the old server directories. I copied the home directory and the directory in Application Data folder. I then modified the environment variable to point to the old home directory name that I had just copied over. The database and server were the same so nothing to update for that. I started it up and it worked.
I will be using Backup Server Client now on a regular basis. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.