Migrating BB to a new server

omar caballero April 23, 2021

Hello, I need to migrate Bitbucket (5.15.1) to a different server.

I have tried the 2 options in this doc to no avail: https://confluence.atlassian.com/bitbucketserver0515/migrating-bitbucket-server-to-another-server-961275665.html

  • I have backed/zipped both the Install and Home directories from the existing production server and unzipped them to the new server. I get that message below. I update the variable for JRE_HOME as it indicates (because I have a later version of Java installed on the new server) and it still fails with the same error.
  • I have started from scratch and performed the download/install of the same version of BB on the new server. I still copied the zip files from above into the new server and unzipped them. Still the same error.

 

This is what happens when I launch bb

 

[root@atlassian2 bin]# service atlbitbucket status

Bitbucket is not running (pidfile exists)

[root@atlassian2 bin]# service atlbitbucket start

The JRE_HOME environment variable is not defined correctly

This environment variable is needed to run this program

Edit set-jre-home.sh and define JRE_HOME

 

Startup has been aborted

[root@atlassian2 bin]#

[root@atlassian2 bin]# nano set-jre-home.sh

 

Displaying Java information below shows the same path I put in the set-jre-home.sh script.

[root@atlassian2 bin]# echo $JAVA_HOME

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64

[root@atlassian2 bin]# echo $JRE_HOME

Thank you in advance for any assistance.

 

1 answer

0 votes
Suhas P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 24, 2021

 What is the output of echo $PATH ?

Check if it has set the correct path to the java executable. 

If it doesn't, then set the path with following. 

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64
export PATH=$JAVA_HOME/bin:$PATH
omar caballero April 27, 2021

Hi @Suhas P thanks for the response. It went into Spam so I apologize for the late reply.

I have reverted back to a snapshot prior to setting things up. I have done a

sudo ./atlassian-bitbucket-5.15.1-linux-x64.bin to get it to install successfully as a Service.

the results of your query is below, so it appears correct.

[root@atlassian2 bitbucket]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64
[root@atlassian2 bitbucket]# echo $JRE_HOME

[root@atlassian2 bitbucket]# echo $PATH
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Now I need to get my data incorporated into this instance. I was hoping copying the existing Production Home and Install directories and their subdirectories (and import the mysql database) would get me back to where I need to be. Do you have an opinion/suggestion on this approach?

Thank you again.

omar caballero April 27, 2021

In reviewing the set-jre-home.sh file it contains a totally different path:


[root@atlassian2 bin]# cat set-jre-home.sh
if [ -z "$JRE_HOME" ]; then
if [ -z "$JAVA_HOME" ]; then
# If JRE_HOME and JAVA_HOME are not defined, edit this line to define JRE_HOME
JRE_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre"
elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/jre/bin/java" ]; then
# If JAVA_HOME points to a valid JDK, use its JRE
JRE_HOME="$JAVA_HOME/jre"
elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
# If JAVA_HOME appears to point to a JRE and not a JDK use this anyway
JRE_HOME="$JAVA_HOME"

 

How does that happen?

Suhas P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2021

That explains it, you need to modify the set-jre-home.sh with the correct JRE path. It's referring to the non-existing JAVA version.

Regarding copying prod directories, you can do it as long as it's the same instance (not prod to non-prod). Make sure, your database is reachable from the app server. 

you would never be able to get it working in the first shot, you will have to deal with many issues for sure. So i would recommend migrating the non-prod to the non-prod server first, fix all the issues there, document them, and then plan the production.

omar caballero April 28, 2021

It does indeed however I did not update Java so that's a mystery. I originally installed java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64

Anyways, I will make the change and see how it goes. Thank you for your direction.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
5.15.1
TAGS
AUG Leaders

Atlassian Community Events