티스토리 뷰

728x90
반응형

개요

Atlassian(아틀라시안) 도구는 소프트웨어 개발 및 개발자간 협업을 지원하는 다양한 컴포넌트를 제공한다. 대표적인 개발, 빌드 및 배포 지원 도구로 Bitbucket / Bamboo / Jira / SourceTree 등이 있다.


Bitbucket

Bitbucket은 소스 형상관리 도구로 익히 알고 있는 git을 기반으로 하고 있다. 크게 3가지 형태의 버전을 제공한다.

a.Bitbucket Cloud

Bitbucket Cloud는 Github와 같이 Atlassian에서 직접 웹 환경에서 제공해 주는 버전이다. (https://bitbucket.org/dashboard/overview)

Public 환경에서 접근이 가능할 경우 유용하게 사용할 수 있다. Bitbucket Private Repository는 무제한으로 생성할 수 있지만, 공유할 수 있는 사용자는 5인으로 제한된다. (유료버전을 사용할 경우 사용자 제한 없이 이용할 수 있다.) 또한 Bitbucket 자체에서 CI/CD 파이프라인을 구성할 수 있다는 장점이 있어 별도의 CI/CD 컴포넌트를 구성할 필요가 없다. (Jenkins / Bamboo 등)

b. Bitbucket Server

Private 환경에서 Bitbucket을 사용해야 하는 경우 사용한다. 단일 서버 환경에만 구축이 가능하며, 별도의 파이프라인 환경은 제공하지 않는다.

c. Bitbucket Data Center

Private 환경에서 Bitbucket을 사용해야 하는 경우 사용한다. 다중 서버 환경을 구성할 수 있으며, Bitbucket 서버의 가용성을 높일 수 있다. 별도의 파이프라인 환경은 제공하지 않는다.

Bamboo

Bamboo는 복잡한 빌드/배포 환경의 자동화를 위해 CI/CD 파이프라인을 지원한다. 대표적인 오픈소스 소프트웨어인 Jenkins와 같은 역할을 한다고 볼 수 있다. 특히 Atlassian 계열의 도구들과 유연한 통합을 지원하여 Bitbucket/Jira 등을 사용할 경우 손쉬운 통합을 지원한다.

본 가이드에서는 Bitbucket - Bamboot - Nexus - EKS 간의 배포 프로세스에 대해 알아보도록 하자. Native Kubernetes에 대한 GitLab - Jenkins - Nexus - K8S 배포 프로세스를 확인하고자 할 경우 아래를 참고한다.

[④ 개발, 데이터베이스/ⓒ CI CD] - Kubernetes Jenkins - 자동 배포환경 구성 (1/2)

[④ 개발, 데이터베이스/ⓒ CI CD] - Kubernetes Jenkins - 자동 배포환경 구성 (2/2)


본론

먼저 Bitbucket과 Bamboo를 구축해 보도록하자. Bitbucket과 Bamboo를 설치하기 전 사전에 구성되어야 할 CLI 컴포넌트는 Git, Maven, Docker 등이 있으며, 사전에 구축한 후 아래를 진행한다.

Atlassian 공식 사이트에 접속하면 다음과 같은 화면을 확인할 수 있다.

# 계정이 없을 경우 생성후 로그인한다.

메뉴 항목 중 ko.atlassian.com을 선택하면, atlassian 도구 다운로드 사이트에 접속할 수 있다.

Bitbucket 설치

Bitbucket Server를 설치하기 위해 다운로드 사이트에 접속한다. (https://www.atlassian.com/software/bitbucket/download)

> 다운로드 받은 atlassian-bitbucket-7.9.1.tar.gz Linux 서버에 업로드

> 압축 해제 후 설정 작업 진행 (다운로드 받은 압축파일 해제 및 bitbucket-home 디렉토리 생성)

[root@ip-192-168-123-141 atlassian-bitbucket-7.9.1]# pwd
/root/atlassian/atlassian-bitbucket-7.9.1
[root@ip-192-168-123-141 atlassian-bitbucket-7.9.1]# ls -la
total 64
drwxr-xr-x 8 root     root       107 Jan 23 07:39 .
drwxr-xr-x 6 root     root       187 Jan 23 08:32 ..
drwxr-xr-x 7 root     root       166 Jan 23 07:39 app
drwxr-xr-x 2 root     root      4096 Jan 23 07:54 bin
drwxr-xr-x 8 ec2-user ec2-user   153 Jan 14 04:47 elasticsearch
drwxr-xr-x 3 root     root        20 Jan 23 07:39 lib
drwxr-xr-x 2 root     root     40960 Jan 23 07:39 licenses
-rw-r--r-- 1 ec2-user ec2-user  2601 Jan 14 04:37 README.txt
drwxr-xr-x 3 root     root        32 Jan 23 07:39 tools
[root@ip-192-168-123-141 atlassian-bitbucket-7.9.1]# ls -la ../
total 626980
drwxr-xr-x  6 root     root           187 Jan 23 08:32 .
dr-xr-x--- 18 root     root          4096 Jan 23 07:50 ..
drwxr-xr-x  8 root     root           107 Jan 23 07:39 atlassian-bitbucket-7.9.1
-rw-r--r--  1 root     root     331295025 Jan 23 07:39 atlassian-bitbucket-7.9.1.tar.gz
drwxr-xr-x 11 root     root           181 Jan 23 07:55 bitbucket-home
[root@ip-192-168-123-141 atlassian-bitbucket-7.9.1]#

- atlassian-bitbucket-7.9.1/bin : 각종 설정 파일 및 Bitbucket 기동/종료 스크립트- bitbucket-home : bitbucket repository home> atlassian-bitbucket-7.9.1/bin/set-bitbucket-home.sh

[set-bitbucket-home.sh]
...
if [ -z "$BITBUCKET_HOME" ]; then
    BITBUCKET_HOME=/root/atlassian/bitbucket-home
fi
...

- BITBUCKET_HOME : bitbucket repository 지정 후 저장atlassian-bitbucket-7.9.1/bin/set-jre-home.sh

[set-jre-home.sh]
...
if [ -z "$JRE_HOME" ]; then
    if [ -z "$JAVA_HOME" ]; then
        JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.amzn2.0.1.x86_64/jre
    elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/jre/bin/java" ]; then
        JRE_HOME="$JAVA_HOME/jre"
    elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then
        JRE_HOME="$JAVA_HOME"
    fi
fi
...

- JRE_HOME : jre 지정 후 저장> atlassian-bitbucket-7.9.1/bin/start-bitbucket.sh

[root@ip-192-168-123-141 bin]# sh start-bitbucket.sh
Starting Atlassian Bitbucket as the current user

Starting bundled Elasticsearch
        Hint: Run start-bitbucket.sh --no-search to skip starting Elasticsearch
could not find java in bundled jdk at /root/atlassian/atlassian-bitbucket-7.9.1/elasticsearch/jdk/bin/java
There was a problem starting bundled Elasticsearch

Bitbucket is being run with a umask that contains potentially unsafe settings.
The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
 - Access is allowed to 'others'. It is recommended that 'others' be denied
   all access for security reasons.
The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
configured in _start-webapp.sh

Starting Bitbucket webapp at http://localhost:7990
The Bitbucket webapp has been started.

If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
https://go.atlassian.com/bbs-troubleshooting-installations
[root@ip-192-168-123-141 bin]#

> Bitbucket Dashboard 접속

- 대시보드 접속 후 Language (English) 선택 후 Database 선택 (Embedded DB (Internal) or External DB)

- Licensing and settings : License 발급을 위해 Server ID 저장, License Key - I need an evaluation license 선택하면 자동으로 라이센스 발급 페이지로 이동 됨

> Bitbucket Trial License Download (New Trial License > Product > Bitbucket)

- Product : Bitbucket

- License type : Bitbucket (Server)

- Organization : waspro

- Your Instance is : not installed yet

- Server ID : XXXX-XXXX-XXXX-XXXX

- Generate License 클릭

> Bitbucket setup

- 발급이 완료되면, 자동으로 라이센스 파일 적용 됨

> Administrator account setup

- Username : admin

- Full name : admin

- Email address : son.nara@lgcns.com

- Password : xxxxxxxx

- Confirm password : xxxxxxxx

등록이 완료되면 로그인 후 다음과 같이 접속할 수 있다.

Bamboo 설치

Bamboo를 설치하기 위해 다운로드 사이트에 접속한다. (https://www.atlassian.com/software/bamboo/download)

> 다운로드 받은 atlassian-bamboo-7.2.2.tar.gz Linux 서버에 업로드

> 압축 해제 후 설정 작업 진행 (다운로드 받은 압축파일 해제 및 bamboo-home 디렉토리 생성)

[atlassian-bamboo/WEB-INF/classes/bamboo-init.properties]
...
bamboo.home=/root/atlassian/bamboo-home
...

- bamboo-home 지정

> atlassian-bamboo-7.2.2/bin/start-bamboo.sh

[root@ip-192-168-123-141 bin]# sh start-bamboo.sh 

To run Bamboo in the foreground, start the server with start-bamboo.sh -fg

Server startup logs are located in /root/atlassian/atlassian-bamboo-7.2.2/bin/logs/catalina.out

Bamboo Server Edition
   Version : 7.2.2
                  

If you encounter issues starting or stopping Bamboo Server, please see the Troubleshooting guide at https://confluence.atlassian.com/display/BAMBOO/Installing+and+upgrading+Bamboo

Using CATALINA_BASE:   /root/atlassian/atlassian-bamboo-7.2.2
Using CATALINA_HOME:   /root/atlassian/atlassian-bamboo-7.2.2
Using CATALINA_TMPDIR: /root/atlassian/atlassian-bamboo-7.2.2/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /root/atlassian/atlassian-bamboo-7.2.2/bin/bootstrap.jar:/root/atlassian/atlassian-bamboo-7.2.2/bin/tomcat-juli.jar
Tomcat started.
[root@ip-192-168-123-141 bin]#

> Bamboo License Download

> 다운로드 받은 라이센스 적용 후 대시보드 로그인

Bamboo Executables

> Bamboo Executables 구성 (Administration - Excutables)

구성에 필요한 모듈을 등록한다. (Maven을 등록하였으며, 필요 시 SVN, Gradle 등을 추가로 등록할 수 있음)

Application Link

다양한 소스 형상관리 도구와 Bamboo를 연결하여 사용할 수 있지만, Atlassian 계열의 Bitbucket과 Bamboo를 연결하여 구성해 보도록 하자. Bitbucket과 Bamboo를 연결하기 위해서 각각 Application Link를 등록해야 한다.

> Bitbucket Application Link (Administration - Application Links)

Configure Application Links에 Bamboo URL을 입력하고 Create new link를 선택한다.

위와 같이 Bitbucket의 Application Link 만으로는 연결을 완료할 수 없다. Bamboo 역시 Bitbucket에 대한 Application Link를 생성하고 등록해 주어야 한다.

> Bamboo Application Link (Administration - Application Links)

위와 같이 Bamboo의 Application Link를 추가한 후 CONFIG ERROR를 확인한다.

위와 같이 [CONFIG ERROR] OAuth mismatch가 나타날 경우 Bitbucket과 Bamboo의 OAuth를 변경하고 적용한다.

각각 Bitbucket과 Bamboo의 Outgoing/Incoming Authentication 방식을 OAuth로 변경 후 Save Chages를 선택한다. 인증설정이 완료되면, 다음과 같이 CONNECTED 상태로 변경되는 것을 확인할 수 있을 것이다.

Bitbucket Project & Repository

> Create project

Repository를 관리할 Project를 생성한다.

- Project name : 프로젝트 이름

- Project key : 자동 생성

- Description : 상세 프로젝트 정보

- Create Project 선택

> Create Repository

생성한 Project의 Repository를 생성한다.

- Name : Repository 이름

- Default branch name : Branch 이름

- Create repository 선택

> Repository Source Push

생성된 Repository에 아래와 같이 Sample Application을 Push한다.

아래와 같이 Repository에 소스코드가 Push 된 것을 확인할 수 있다.

Bitbucket 역시 GitHub, GitLab과 같은 Git Repository와 동일한 형태로 Git 기반의 저장소이다.

Linked Repositories

> Bamboo Linked Repositories (Administration - Linked repositories)

> Add repository - Bitbucket Server / Stash

> Bitbucket Repository 연결 (Name / Login & approve)

Login & Approve를 진행하면, 아래와 같이 Bitbucket에 생성한 Repository와 Branch를 선택할 수 있다.

- Name : Bitbucket Repository Name을 구분하는 이름

- Server : Bitbucket

- Repository : [REPOSITORY]/[PROJECT]

- Branch : [BRANCH]

- Save repository 선택

위와 같이 정상정으로 Bitbucket Repository와 연결된 것을 확인할 수 있다.

다음 포스팅에서는 Bamboo의 빌드/배포 프로세스에 대해 알아보고, Amazon EKS에 배포하는 방법에 대해 알아보자.

728x90
반응형