Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

사전 준비

1. NFS 설정

NFS 설정 참조

2. Elasticsearch 설정

3. Apache Load Balancer 설정

(root 계정 - Ubuntu 설정)

$ cd /etc/apach2/sites-available
$ sudo a2enmod headers proxy_balancer proxy_http proxy lbmethod_byrequests slotmem_shm    ## 모듈 활성화
$ vi dcbitbucket.twoseed.co.kr.conf    ## 원하는 이름으로 .conf 파일 생성
---------------------------
<VirtualHost *:80>
  ServerName dcbitbucket.twoseed.co.kr
  Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

  <Proxy balancer://bitbucketcluster>
     BalancerMember http://14.36.48.220:6990 route=node1
     BalancerMember http://175.197.124.236:6990 route=node2
  </Proxy>

  ProxyPass / balancer://bitbucketcluster/ lbmethod=byrequests stickysession=ROUTEID
  ProxyPreserveHost On
</VirtualHost>
----------------------------
$ sudo a2ensite dcbitbucket.twoseed.co.kr.conf     ## 사이트 활성화
$ sudo service apache2 reload     ## apach 서버 다시 시작

Bitbucket Data Center 설정

1. Bitbucket node1 설정

  • 새 인스턴스 설치

 Data Center 인스턴스 설치 가이드
$ sudo ./atlassian-bitbucket-7.6.0-x64.bin
Unpacking JRE ...
Starting Installer ...

Bitbucket 7.6.0 installation wizard
Would you like to install or upgrade an instance?
Install a new instance [1, Enter], Upgrade an existing instance [2]
1

Install Bitbucket 7.6.0
What type of instance are you looking to install?
Install a Server instance [1, Enter], Install a Data Center instance [2], Install a Smart Mirroring instance [3]
2

Where should Bitbucket be installed?
Select the folder where you would like Bitbucket 7.6.0 to be installed, 
then click Next.
[/opt/atlassian/bitbucket/7.6.0]
/opt/datacenter/atlassian/bitbucket      ## 원하는 인스톨 디렉토리 경로 설정

Default location for Bitbucket home directory
The location for Bitbucket data.
This will be the default location for repositories, plugins, and other data.
Ensure that this location is not used by another Bitbucket installation.
[/var/atlassian/application-data/bitbucket]
/home/datacenter/atlassian/bitbucket      ## 원하는 홈 디렉토리 경로 설정

Configure which ports Bitbucket will use.
Configure TCP Ports
Bitbucket requires a TCP port that isn't being used by other applications.
The HTTP port is where users access Bitbucket through their browsers.
Bitbucket also requires ports 7992 and 7993 are available to run an embedded
Elasticsearch instance that provides search functionality to Bitbucket.
HTTP Port Number
[7990]
6990      ## 원하는 포트 설정

Run as a service
For a production server we recommend that you run Bitbucket as a
Windows/Linux service because Bitbucket will restart automatically when the computer restarts.
Install Bitbucket as a service?
Yes [y, Enter], No [n]
n    ## 서버 재시작 시 자동으로 시작되기를 원할 경우 Yes로 서비스 등록

Please review your Bitbucket installation settings
Installation Summary
Installation Directory: /opt/datacenter/atlassian/bitbucket
Home Directory: /home/datacenter/atlassian/bitbucket
HTTP Port: 6990
Install as a service: No
Install [i, Enter], Exit [e]
i

Extracting files ...

Installation of Bitbucket is complete
Would you like to launch Bitbucket?
Yes [y, Enter], No [n]
n

This machine now has Bitbucket 7.6.0 Data Center installed
Your installation of Bitbucket 7.6.0 Data Center on this node is ready and
can be accessed from your browser.

For a complete Bitbucket 7.6.0 Data Center installation, you will need to
also install and connect to:
*  Shared database system
*  Shared file system
*  Shared Elasticsearch instance

Read more about installing Bitbucket Data Center.
Bitbucket 7.6.0 can be accessed at http://localhost:6990

Finishing installation ...

  • Bitbucket Setup Wizard 실행

    • Bitbucket 서비스 계정 변경

      $ cd /opt/datacenter/atlassian/
      $ sudo chown -R twoseed:twoseed bitbucket
      $ cd /home/datacenter/atlassian/
      $ sudo chown -R twoseed:twoseed bitbucket
    • Bitbucket 인스턴스 시작

      $ cd /opt/datacenter/atlassian/bitbucket/bin/
      $ ./start-bitbucket.sh

      The Bitbucket webapp has been started. 메시지 출력 후 http://<server ip>:6990 접속

    • Language 및 Database 선택

      “Test” 버튼 클릭하여 Database 연결 상태 확인 후 “Next” 클릭

    • Application Title, Base URL, License key 입력

    • Bitbucket Internal Admin 계정 생성

      Internal Admin 계정이므로 정보 입력 후 “Go to Bitbucket” 버튼 클릭

  • 공유폴더 설정

    • Bitbucket 인스턴스 종료

      $ cd /opt/datacenter/atlassian/bitbucket/bin/
      $ ./stop-bitbucket.sh
    • Home 디렉토리의 shared 폴더를 NFS 로 복사

      $ cd /home/datacenter/atlassian/bitbucket/
      $ mv shared /home/share/atlassian/bitbucket/
      $ ln -sf /home/share/atlassian/bitbucket/shared shared

  • Node 설정

    • Node 이름 설정

      $ cd /opt/datacenter/atlassian/bitbucket/bin/
      $ vi _start-webapp.sh
      ---------------------------
      ...
      JVM_SUPPORT_RECOMMENDED_ARGS="-Dcluster.node.name=node1"
      ...
      ---------------------------
    • bitbucket.properties 파일에 Node 관련 설정 추가

      $ cd /home/share/atlassian/bitbucket/shared
      $ vi bitbucket.properties
      --------------------------
      # Use multicast to discover cluster nodes (recommended).
      hazelcast.network.multicast=false
      
      # If your network does not support multicast, you may uncomment the following lines and substitute
      # the IP addresses of some or all of your cluster nodes. (Not all of the cluster nodes have to be
      # listed here but at least one of them has to be active when a new node joins.)
      hazelcast.network.tcpip=true
      hazelcast.network.tcpip.members=14.36.48.220:5703,175.197.124.236:5701
      
      # The following should uniquely identify your cluster on the LAN.
      hazelcast.group.name=Twoseed-cluster
      hazelcast.group.password=Twoseed-cluster
      --------------------------
 위 설정은 네트워크가 멀티캐스트를 지원하지 않는 경우 설정법 입니다. 멀티캐스트를 사용하는 경우:
# Use multicast to discover cluster nodes (recommended).
hazelcast.network.multicast=true

# If your network does not support multicast, you may uncomment the following lines and substitute
# the IP addresses of some or all of your cluster nodes. (Not all of the cluster nodes have to be
# listed here but at least one of them has to be active when a new node joins.)
#hazelcast.network.tcpip=true
#hazelcast.network.tcpip.members=<node 1 server ip>:5701,<node 2 server ip>:5701,<node 3 server ip>:5701

# The following should uniquely identify your cluster on the LAN.
hazelcast.group.name=your-bitbucket-cluster
hazelcast.group.password=your-bitbucket-cluster

  • Remote Elasticsearch 설정

    $ cd /home/share/atlassian/bitbucket/shared
    $ vi bitbucket.properties
    --------------------------
    plugin.search.elasticsearch.baseurl=http://14.36.48.220:6991/   ## Elasticsearch URL
    plugin.search.elasticsearch.username=twoseed   ## buckler.yml에 지정한 username
    plugin.search.elasticsearch.password=admin   ## buckler.yml에 지정한 password
    --------------------------

  • Install, Home directory 백업 및 node2에 복사

    $ cd /opt/datacenter/atlassian
    $ tar cvfz bitbucket_install.tgz bitbucket/
    $ cd /home/datacenter/atlassian
    $ tar cvfz bitbucket_home.tgz bitbucket/

  • Bitbucket 인스턴스 시작

    $ cd /opt/datacenter/atlassian/bitbucket/bin/
    $ ./start-bitbucket.sh --no-search   ## 번들 Elasticsearch가 실행되지 않도록 옵션 추가

2. Bitbucket node2 설정

  • node1의 백업 파일 동일 위치에 압축 풀기

    $ cd /opt/datacenter/atlassian
    $ tar xvfz bitbucket_install.tgz
    $ cd /home/datacenter/atlassian
    $ tar xvfz bitbucket_home.tgz

  • Node 이름 설정

    $ cd /opt/datacenter/atlassian/bitbucket/bin/
    $ vi _start-webapp.sh
    ---------------------------
    ...
    JVM_SUPPORT_RECOMMENDED_ARGS="-Dcluster.node.name=node2"
    ...
    ---------------------------

  • Bitbucket 인스턴스 시작

    $ cd /opt/datacenter/atlassian/bitbucket/bin/
    $ ./start-bitbucket.sh --no-search   ## 번들 Elasticsearch가 실행되지 않도록 옵션 추가

Bitbucket Data Center 접속 확인

  • Apache 서버에 적용한 URL 접속

  • Administrator > System > Clustering 에서 각 node 상태 확인 가능

  • No labels