Upgrading Bamboo on Linux and moving from an unsupported Database Version to a supported one
目的
This article sketches the upgrade process from Bamboo Server 6.4.1 to version 6.9.1. As support for the PostgreSQL versions 9.2 and 9.3 is deprecated in Bamboo version 6.9.1 (also see Supported Platforms for Bamboo, this upgrade process involves a database migration from PostgreSQL 9.2 to 9.6.
Find this KB as a generic Bamboo upgrade + database migration documentation: Moving your Bamboo Data to a different Database.
Environment used in this document
Current Versions (Bamboo and PostgreSQL) | Desired version (Bamboo and PostgreSQL) |
---|---|
|
|
For this example we'll be upgrading to Bamboo 6.9.1 and Bamboo's PostgreSQL database to version 9.6, though the same procedure can be applied to all recent versions of Bamboo and all PostgreSQL versions 9.4 and higher. Besides we upgrade from Bamboo 6.4.1 and that could be be any Bamboo version 6.6.x and lower (so providing a need for database change). The original Bamboo database could also be PostgreSQL 9.3 instead of 9.2.
Upgrade Prerequisites
- Double check if your environment meets all requirements for Bamboo 6.9.1 according to Supported Platforms for Bamboo.
Checklist prior to Bamboo upgrade:
Java |
|
---|---|
データベース |
|
Bamboo |
|
What else to do before your Upgrade?
- Make sure Bamboo is running successfully
- Backup of the current Bamboo 6.4.1 environment
- Make sure the JAVA_HOME variable is pointing to a valid JDK 1.8 installation
バックアップ | Create backups for the following data:
|
---|---|
JAVA_HOME | Run the below commands in terminal:
The output should be something similar to this:
The output should be something similar to this:
|
Run the Upgrade
Before starting the upgrade, please make sure to complete the previous steps ("Upgrade Prerequisites" and "What else to do before your Upgrade?").
For this example, the Bamboo 6.4.1 paths are set as such:
<Bamboo home directory>
→ /home/bamboo/bamboo-home
<Old Bamboo installation directory> → /home/bamboo/bamboo-install-6.4.1
<New Bamboo installation directory> → /home/bamboo/bamboo-2-install-6.4.1
Step 1 - Export the Bamboo 6.4.1 Data from the linked Database PostgreSQL 9.2
Create a Bamboo export from PostgreSQL 9.2. This feature is reachable via Bamboo UI.
For this, navigate to Overview >> Export as Bamboo administrator in Bamboo 6.4.1, select the items you want to move in your new Bamboo instance (e.g. build logs and/or artifacts or just your configurations) and press the "Export" button.
Your export will be created and copied to the defined Export directory path, as the name that you specified for your export, with extension zip (in XML format).
Find a KB for it here: Exporting Data for Backup
Step 2 - Stop Bamboo 6.4.1 ( as Service or Process)
- Bamboo running as a Linux service:
Use the appropriate command taking in consideration how the service was configured.
Systemd Service Configuration
bamboo@bamboo-VM:/$ systemctl stop bamboo
SysV Init Script
bamboo@bamboo-VM:/$ /etc/init.d/bamboo stop
- Bamboo running as a Linux process, triggered from console:
Run the <Bamboo installation directory>/bin/stop-bamboo.sh script.
bamboo@bamboo-VM:/$ cd ~/install/bin/
bamboo@bamboo-VM:~/install/bin$ ./stop-bamboo.sh
You can use the PS (Process Status) command to double check if the Bamboo process is not running anymore, i.e as such:
bamboo@bamboo-VM:~/install/bin$ ps aux | grep java
bamboo 28538 0.0 0.0 21536 1068 pts/0 S+ 18:08 0:00 grep --color=auto java
Bamboo process should not be listed at the command output.
If so, you need to terminate it using its PID (Process ID, would be the second entry thus 28538 in the console output from above)
kill -9 <PID>
Repeat the above till you find no more active Bamboo process.
Step 3A - Prepare Database Migration → Download Bamboo 6.4.1 (if not yet available)
You can use wget
to download Bamboo binaries:
bamboo@bamboo-VM:~$ wget https://www.atlassian.com/software/bamboo/downloads/binary/atlassian-bamboo-6.4.1.tar.gz
After the download finishes, you should see something similar as below using ls (stands for "list" and it is POSIX standard):
bamboo@bamboo-VM:~$ ls
atlassian-bamboo-6.4.1.tar.gz atlassian-bamboo-6.9.1.tar.gz bamboo-home-6.4.1 bamboo-install-6.4.1
In this step we grab all necessary files for installing a new Bamboo 6.4.1.
Step 3B - Prepare Database Migration → Extract all Bamboo 6.4.1 Files in a new Installation Folder
Create a new ~/
folder and extract the content of the downloaded .tar.gz into it:bamboo-2-install-6.4.1
bamboo@bamboo-VM:~$ mkdir bamboo-2-install-6.4.1
bamboo@bamboo-VM:~$ tar -xf atlassian-bamboo-6.4.1.tar.gz --strip 1 -C ~/bamboo-2-install-6.4.1
Expected result:
bamboo@bamboo-VM:~$ cd bamboo-2-install-6.4.1
bamboo@bamboo-VM:~/bamboo-2-install-6.4.1$ ls
atlassian-bamboo BUILDING.txt lib NOTICE README.txt tomcat-docs work
bamboo.sh conf licenses README.html scripts tools
bin CONTRIBUTING.md logs README.md temp webapps
In this step we organized our new Bamboo 6.4.1 data so to be immediately used.
Step 3C - Prepare Database Migration → Copy the Configurations from your recent Bamboo 6.4.1
All personalisation made to the following files must be copied to the same files in new new installation folder:
/bamboo-install-6.4.1/bin/setenv.sh
Typical personalization made to this file are as follows. Java arguments, e.g.:
#
# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that.
#
JVM_SUPPORT_RECOMMENDED_ARGS:="-Dbamboo.ec2.agent.endpoint=http://localhost:8085-XX:UseG1GC"
#
Java heap size, e.g.:
#
# The following 2 settings control the minimum and maximum given to the Bamboo Java virtual machine. In larger Bamboo instances, the maximum amount will need to be increased.
#
JVM_MINIMUM_MEMORY="2048m"
JVM_MAXIMUM_MEMORY="2048m"
#
There can be more, depending on you configuration of Bamboo 6.4.1.
/bamboo-install-6.4.1/bin/server.xml
This file contains the configuration for the ports on which Bamboo will listen, other than SSL, reverse Proxy configuration, etc. that should also be used for your new Bamboo 6.4.1.
/bamboo-install-6.4.1/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties
This file links the existing Bamboo 6.4.1 home directory (bamboo-home) to your new Bamboo 6.4.1.
bamboo@bamboo-VM:~/bamboo-install-6.4.1/atlassian-bamboo/WEB-INF/classes$ cat bamboo-init.properties
## You can specify your bamboo.home property here or in your system environment variables.
bamboo.home=/home/bamboo/bamboo-home
It's safe to just copy the file over from the previous version - see below.
bamboo@bamboo-VM:~$ ls
atlassian-bamboo-6.9.1.tar.gz bamboo-home bamboo-install-6.4.1 bamboo-2-install-6.4.1
bamboo@bamboo-VM:~$ cp bamboo-install-6.4.1/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties bamboo-2-install-6.4.1/atlassian-bamboo/WEB-INF/classes
Alternatively, edit bamboo-init.properties directly in bamboo-2-install-6.4.1, so to match content-wise with the your original Bamboo 6.4.1.
Finally, our new Bamboo 6.4.1 is configured and thus we are ready to launch upgrade for database migration.
Step 4 - Install and setup PostgreSQL 9.6
Install the new version of PostgreSQL that shall be used as the database for your upgraded Bamboo 6.9.1.
You may do this in various ways, e.g. from its sources and then via ./configure, make , make install, via per-built binaries, etc. The exact way and process depends on the above, but also on what Linux (Ubuntu, RHE, etc.) and version you use.
Please grab the relevant documentation for this or ask your DB Administrator to do it for you.
Goal: PostgreSQL 9.6 shall be up and running, but without data.
Step 5A - Perform Database Migration → Start your new Bamboo 6.4.1
Start your new Bamboo 6.4.1 as a Linux process by executing the /bamboo-2-install-6.4.1/bin/start-bamboo.sh
bamboo@bamboo-VM:~/install$ ./bin/start-bamboo.sh
To run Bamboo in the foreground, start the server with start-bamboo.sh -fg
Server startup logs are located in /home/bamboo/install/bin/logs/catalina.out
Bamboo Server Edition
Version : 6.4.1
If you encounter issues starting or stopping Bamboo Server, please see the Troubleshooting guide at https://confluence.atlassian.com/display/BAMBOO/Installing+and+upgrading+Bamboo
Using CATALINA_BASE: /home/bamboo/install
Using CATALINA_HOME: /home/bamboo/install
Using CATALINA_TMPDIR: /home/bamboo/install/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/bamboo/install/bin/bootstrap.jar:/home/bamboo/install/bin/tomcat-juli.jar
Tomcat started.
You may wish to start Bamboo as a Linux service. Then do the following:
You can start it using the appropriate command taking in consideration how the service was configured.
Systemd Service Configuration
bamboo@bamboo-VM:/$ systemctl start bamboo
SysV Init Script
bamboo@bamboo-VM:/$ /etc/init.d/bamboo start
Either way, your new Bamboo 6.4.1 should be launched as service now.
In this step, the Bamboo upgrade is started. It will be completed via Bamboo's UI.
Step 5B - Perform Database Migration → Database Configuration and import via Bamboo's Setup Wizard
After bootstrap and initial upgrade activities, Bamboo is reachable via its UI.
Wait a little bit and then access Bamboo via http://<Your Bamboo URL or IP>:8085 in one of our supported WEB browsers, find the Setup Wizard starting.
If Bamboo did not start, please review the prerequisites and make sure you followed all the steps correctly. If the problem persists, you can also create a support ticket. To help us address the issue, attach the the content of <Bamboo installation directory>/logs/ folder to the ticket.
As a part of the Setup Wizard, you need to select a database. Configure it so that it points to the new PostgreSQL 9.6. By this, you connect your new Bamboo 6.4.1 to PostgreSQL 9.6.
In a next step you will be asked if you want to Import existing data. Please do so and in this step specify the path to the file that you exported in Step 1. After confirming this operation, your PostgreSQL 9.2 data will be imported to PostgreSQL 9.6.
Step 6 - Run Database re-indexing
This is especially needed for your build results and needs always to be done after a Bamboo Import activity.
For this navigate to Overview >> Indexing in your Bamboo UI and press button "Perform a full reindex". See Reindexing data as a reference for it.
Step 7 - Perform Bamboo Upgrade from new 6.4.1 to 6.9.1
In order to finish Bamboo upgrade please follow the instruction of one of the following KBs:
An alternative and equally working approach to the above is:
- Perform all steps from above till and including 5A
- Skip Step 5B in the sense of only linking Bamboo 6.4.1 to PostgreSQL 9.6, but without importing data.
- Consequently skip Step 6
- Once your new Bamboo 6.4.1 is up and running, trigger Bamboo Import via Overview >> Import as Bamboo administrator.
- After a succeeding import, run re-indexing as illustrated in above's Step 6
- Then run Step 7 so to have run Bamboo 6.9.1 in the end connected to PostgreSQL 9.6
Post-upgrade tasks
After you finish Bamboo upgrade:
- Make sure everything is working as expected
- Verify that all data is available as it was for your original Bamboo 6.4.1 and PostgreSQL 9.2
- Double check if your remote agents are back online
- Double check if the application links with other tools are working
Remove the no more needed / used files and folders:
bamboo@bamboo-VM:~$ ls atlassian-bamboo-6.9.1.tar.gz atlassian-bamboo-6.4.1.tar.gz bamboo-home bamboo-install-6.4.1 bamboo-2-install-6.4.1 bamboo-install-6.9.1 bamboo@bamboo-VM:~$ rm -rf ./bamboo-install-6.4.1 bamboo@bamboo-VM:~$ rm -rf ./bamboo-2-install-6.4.1 bamboo@bamboo-VM:~$ rm ./atlassian-bamboo-6.9.1.tar.gz bamboo@bamboo-VM:~$ rm ./atlassian-bamboo-6.9.1.tar.gz bamboo@bamboo-VM:~$ ls bamboo-home bamboo-install-6.9.1
Recovery Plan
If something goes wrong during the upgrade, please do the following:
- Stop the application (Step 2), though now for Bamboo 6.9.1
- Restore the backups created during the "What else to do before your Upgrade?" tasks
- Restore Bamboo's original database PostgreSQL 9.2
If you could nogt rollback the upgrade, please create a support ticket. To help us address the issue, attach the the content of the <Bamboo installation directory>/logs folder to the ticket.