Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,391
Community Members
 
Community Events
176
Community Groups

Deploy 2 data center nodes of Bitbucket in docker

Hello!

In this article I will show you how you can deploy 2 data center nodes of Bitbucket in your local environments using the docker image provided by Atlassian.

This deployment will not include the load balancer because I need these nodes for app development to check if my app works properly in Data Center environment. That is why I always connect to a certain node.

First, you need to create this docker-compose.yml file:

version: '3'

services:
  bb_node_1:
    depends_on:
      - postgresql
    image: atlassian/bitbucket:latest
    networks:
      - bbnet
    volumes:
      - /Users/alexm/projects/prometheus/bitbucket/shared:/var/atlassian/application-data/bitbucket/shared
    ports:
      - '7990:7990'
      - '8000:5005'
    environment:
      - 'JDBC_URL=jdbc:postgresql://postgresql:5432/bbdb'
      - 'JDBC_USER=bb'
      - 'JDBC_PASSWORD=jellyfish'
      - 'JDBC_DRIVER=org.postgresql.Driver'
      - 'JVM_MINIMUM_MEMORY=2048m'
      - 'JVM_MAXIMUM_MEMORY=4096m'
      - 'JVM_SUPPORT_RECOMMENDED_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'
      - 'HAZELCAST_GROUP_NAME=bb_group'
      - 'HAZELCAST_GROUP_PASSWORD=1234'
      - 'HAZELCAST_NETWORK_MULTICAST=true'

  bb_node_2:
    depends_on:
      - postgresql
    image: atlassian/bitbucket:latest
    networks:
      - bbnet
    volumes:
      - /Users/alexm/projects/prometheus/bitbucket/shared:/var/atlassian/application-data/bitbucket/shared
    ports:
      - '7991:7990'
      - '8001:5005'
    environment:
      - 'JDBC_URL=jdbc:postgresql://postgresql:5432/bbdb'
      - 'JDBC_USER=bb'
      - 'JDBC_PASSWORD=jellyfish'
      - 'JDBC_DRIVER=org.postgresql.Driver'
      - 'JVM_MINIMUM_MEMORY=2048m'
      - 'JVM_MAXIMUM_MEMORY=4096m'
      - 'JVM_SUPPORT_RECOMMENDED_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'
      - 'HAZELCAST_GROUP_NAME=bb_group'
      - 'HAZELCAST_GROUP_PASSWORD=1234'
      - 'HAZELCAST_NETWORK_MULTICAST=true'

  postgresql:
    image: postgres:9.5-alpine
    networks:
      - bbnet
    #volumes:
    #  - postgresqldata:/var/lib/postgresql/data
    ports:
      - '5432:5432'
    environment:
      - 'POSTGRES_USER=bb'
      # CHANGE THE PASSWORD!
      - 'POSTGRES_PASSWORD=jellyfish'
      - 'POSTGRES_DB=bbdb'
      - 'POSTGRES_ENCODING=UNICODE'
      - 'POSTGRES_COLLATE=C'
      - 'POSTGRES_COLLATE_TYPE=C'
    logging:
      # limit logs retained on host to 25MB
      driver: "json-file"
      options:
        max-size: "500k"
        max-file: "50"

volumes:
  postgresqldata:
    external: false

networks:
  bbnet:
    driver: bridge

Change ‘/Users/alexm/projects/prometheus/bitbucket/shared’ to the folder path where all shared data for your nodes should be placed.

Move to the folder where you created the file and run it with this command:

docker-compose up

As a result you will have two Bitbucket nodes up. The first node will be running on port 7090 and the second node will be running on port 7091.

Also you will be able to connect with a debug session to the nodes using ports 8000 for node 1 and 8001 for node 2.

If you have problem with including the second node to the cluster just restart the container with the second node.

1 comment

Thanks for sharing. Couldn't resist and tried this out ;)

2 Observations:

1. Node 2 doesn't start up while Node 1 has the shared home locked

2. Trying to start Node 2 after Node 1 starts up kills Node 1

bb_node_2_1   | 2022-01-20 02:43:02,661 INFO  [main]  c.a.b.i.b.BitbucketServerApplication Started BitbucketServerApplication in 4.13 seconds (JVM running for 5.017)

bb_node_1_1   | /opt/atlassian/bitbucket/bin/_start-webapp.sh: line 126:   187 Killed                  $JAVA_BINARY $JAVA_OPTS $LAUNCHER start --logging.console=true

bb_node_1_1   |

bb_node_1_1   | Stopping bundled Elasticsearch

bb_node_1_1   | Bundled Elasticsearch has stopped

bitbucket-docker-dc_bb_node_1_1 exited with code 0

Any ideas?

NB: I added

- 'ELASTICSEARCH_ENABLED=false' 

to node_2 env to avoid 2 ES bundled instances starting at the same time.

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events