Upgrading BitBucket using HTTPS on Windows from 4.x to 5.x

Just for a change I had to upgrade a Bitbucket 4.x server to 5.9. This is a major upgrade and Atlassian provided clear warning that the configuration file needed to be changed manually as part of this process.

The upgrade went well and I decided to start the service to see what state it would be in prior to the configuration file changes. This wasn’t so good with the service stopping almost immediately.

Checking the Bitbucket web server log I found the following error.


Caused by: java.lang.IllegalStateException: Failed to load property source from location ‘file:/D:/Atlassian/ApplicationData/Bitbucket/shared/bitbucket.properties’


This seemed strange as the service had been running fine but after checked the file permissions sure enough the Bitbucket service account had no access to the file. Simple fix so I started the service again.

This time the service started but was using straight HTTP. That’s fine it showed that the service was all fine and talking to the database so now on to the configuration changes.

The configuration that needed to be replicated was below.


<Connector port=”443″
keystoreFile=”D:\Atlassian\keystore\bitbucket.jks”
maxHttpHeaderSize=”8192″
SSLEnabled=”true”
maxThreads=”150″
minSpareThreads=”25″
maxSpareThreads=”75″
enableLookups=”false”
disableUploadTimeout=”true”
useBodyEncodingForURI=”true”
acceptCount=”100″
scheme=”https”
secure=”true”
clientAuth=”false”
sslProtocol=”TLS” />


Looking at the new bitbucket.properties file the format was a little different and not what was expected based on the upgrade documentation. It seemed on first look to use semi-colons as separators rather than being line separated.


sql-server:1433;databaseName=bitbucket;
#>
#>*******************************************************
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://sqlserver:1433;databaseName=bitbucket;
jdbc.user=bitbucket_usr
jdbc.password=***************


To replicate this the new configuration was set up using semi-colons. When the service was started it wasn’t too good.


Faulting application name: bserv64.exe, version: 1.0.15.0, time stamp: 0x51543b9d
Faulting module name: jvm.dll, version: 25.71.0.1, time stamp: 0x56ac212a
Exception code: 0xc0000005
Fault offset: 0x0000000000214f38
Faulting process id: 0xa70
Faulting application start time: 0x01d3dd132c763723
Faulting application path: C:\Atlassian\Bitbucket\5.9.1\bin\bserv64.exe
Faulting module path: c:\atlassian\bitbucket\4.6.0\jre\bin\server\jvm.dll
Report Id: 552e5d9f-4907-11e8-80db-001dd8b71d05
Faulting package full name:
Faulting package-relative application ID:


Well that didn’t work. After looking again I saw my mistake and removed the semi-colons and used line breaks instead. This didn’t work too well either with the Bitbucket log again recording an error.


Caused by: org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 443 failed to start


After more investigation I found that you need to specify the key-store and key password in this version even if the default password has been used.

Still the service wouldn’t start.

The other configuration items looked pretty clear so I looked at the key-store location parameter. In the old version this was keystoreFile=”D:\Atlassian\keystore\bitbucket.jks”

All of the examples provided were for linux which used the typical /dir/file format. This surely wouldn’t work for Windows but I didn’t find any examples of what to do.

Ultimately I removed the speech marks and converted the back slashes to forward slashes.

So the final working configuration for 5.x is below.


server.port=443
server.ssl.enabled=true
server.ssl.key-store=D:/Atlassian/keystore/bitbucket.jks
server.ssl.key-store-password=changeit
server.ssl.key-password=changeit


The service now started using HTTPS and we were back in service.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s