Automated setup for Bitbucket Server

This page describes how the Bitbucket Server Setup Wizard can be completed automatically, that is without the need for manual interaction in the browser. See Getting started for an outline of the tasks that the Setup Wizard assists with when setting up Bitbucket Server manually.

You might want to configure this when automating the provisioning of Bitbucket Data Center, for example. Of course, you'll need to configure provisioning tools such as Puppet or Vagrant yourself.

Note that you can also automate the 'install and launch' phase of provisioning Bitbucket Server – see Running the Bitbucket Server installer for information about how to run the installer in console and unattended modes.

1. Get a license for Bitbucket Server

You can get a new Bitbucket Server license by doing one of:

  • Logging in to your My.Atlassian.com account.
  • Contacting Atlassian, if you need a Bitbucket Data Center license.

If you already have a licensed instance of Bitbucket Server, you can find the license in the Bitbucket Server admin area.

2. Set the configuration properties

After installing Bitbucket Server, but before you start Bitbucket Server for the first time, edit the bitbucket.properties file to add the properties in the table below. Use the standard format for Java properties files.

Note that the bitbucket.properties  file is created automatically in the  shared  folder of your  Bitbucket home directory when you perform a database migration. Create the file yourself if it does not yet exist. See Bitbucket Server config properties for information about the properties file.

Add these properties to the bitbucket.properties file:

PropertyDescription
setup.displayName=displayNameThe display name for the Bitbucket Server application.
setup.baseUrl= https://bitbucket.yourcompany.com
The base URL.
setup.license=AAAB...

The Bitbucket Server license.

Use the \ character at the end of each line if you wish to break the license string over multiple lines.

setup.sysadmin.username=usernameCredentials for the system admin account.
setup.sysadmin.password=password
setup.sysadmin.displayName=John Doe

The display name for the system admin account.

An empty property is ignored.

setup.sysadmin.emailAddress=sysadmin@yourcompany.comThe email address for the system admin account.
jdbc.driver=org.postgresql.Driver

JDBC connection parameters.

Use the appropriate values for your own JDBC connection.

jdbc.url=jdbc:postgresql://localhost:5432/bitbucket
jdbc.user=bitbucket
jdbc.password=bitbucket

plugin.mirroring.upstream.url=https://bitbucket.company.com

(Smart Mirroring only) On the mirror, specifies the base URL of the primary Bitbucket Data Center instance that the new mirror will be mirroring from. See Set up a mirror for more information.

You should specify the JDBC properties so that Bitbucket Server can connect to the external database.

If any of the following required properties are not provided in the properties file, when you start Bitbucket Server the Setup Wizard will launch at the appropriate screen so that you can enter values for those properties.

3. Start Bitbucket Server

Start Bitbucket Server as usual. See Starting and stopping Bitbucket Server.

Bitbucket Server reads the bitbucket.properties file and applies the setup properties automatically.

When you now visit Bitbucket Server in the browser, you see the welcome page.

Troubleshooting

The Setup Wizard launches in the browser

The Setup Wizard will run if there are missing configuration properties, such as the license string, in the bitbucket.properties file. Check the properties file and compare with the table in Step 2 above. Alternatively, the set up can be completed using the web UI.

Write access for the config.properties file

Once the automated setup process completes, the relevant properties in the bitbucket.properties file are commented out. This requires that the system user has write permission on the properties file. 

Bitbucket Server fails to start with a 'Could not acquire change log lock.' error

If Bitbucket Server is forced to quit while modifying the config.properties file, you may not be able to restart Bitbucket Server, and  atlassian-bitbucket.log contains the above error.

See this KB article for information about how to resolve this: Bitbucket Server Does Not Start - Could not acquire change log lock

Last modified on Sep 25, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.