How to change the port of the Mesh sidecar
Starting from Bitbucket Server 8.0, each Bitbucket Server node starts up a Mesh sidecar. This sidecar accesses the repositories that are located under Bitbucket’s shared home or one of the additional data stores, if configured. The Mesh sidecar exposes its services on port localhost:7777 by default. If that port is not available, another (random) free port is used.
The mesh sidecar strictly communicates between Bitbucket and itself only. The communication on port 7777 is local to the server. As requests to this port are being made from the same server, this port does not need to be accessible from outside. Clients will still connect directly to Bitbucket Server for all Git operations.
If you need to keep port 7777 free for another application to use, you can change the default port that the Mesh sidecar binds to.
You can use netstat to identify free ports on your machine.
To change the port Bitbucket sidecar listens on
- Navigate to your home directory.
Open the
shared/bitbucket.properties
file, add theplugin.bitbucket-git.mesh.sidecar.default-port
property (or edit it if a line for theplugin.bitbucket-git.mesh.sidecar.default-port
property already exists), and set the value to the port number the sidecar will run on. For example, to set to the port to7776
you would add:plugin.bitbucket-git.mesh.sidecar.default-port=
7776
Then save the file.
Restart Bitbucket so the change takes effect. See Start and stop Bitbucket.
Important considerations
If you are using a firewall, ensure that it is configured to allow HTTP or HTTPS traffic over the connector port you have chosen. Note that the Mesh sidecar only binds to localhost; it does not need to receive incoming requests from other Bitbucket Server or Mesh nodes.
If you are running Bitbucket on a Linux server and want to bind to privileged ports (those below 1024, for example port 80), you will need to start Bitbucket as root to successfully bind to the port. Or, you can bind Bitbucket to a port over 1024 and then configure iptables to redirect traffic from port 80 to the higher port.