티스토리 뷰

728x90
반응형

본 포스팅에서는 Nexus2에서 Nexus3로 Spring Boot Maven Repository 업그레이드 과정에 대해 살펴보겠습니다.

앞선 여러번의 포스팅에서 Nexus2가 Nexus3보다 Maven Repository 관리 측면에서 편의성이 뛰어나다는 이야기를 했습니다.

다만 Nexus3에서 Docker Registry를 제공하고 이미지 파일, 레포지파일 등을 암호화해서 관리한다는 측면에서 최근 클라우드 환경을 사용하는 사이트에서 하나하나 Nexus3로 업그레이드를 하는 추세입니다.

이에 본 포스팅을 통해 Nexus2에 있는 Maven Repository를 Nexus3로 이관하는 과정에 대해 상세히 살펴보고자 합니다.

지난 포스팅은 다음을 참고하시기 바랍니다.

 

[Docker] 폐쇄망에 Docker 구축하기

[Spring Boot] git clone을 활용한 Spring Boot 프로젝트 repository 이관

[Spring Boot] gitlab & Eclipse 연동을 통한 Spring Boot 개발 프로젝트 구축

[Spring Boot] Spring Boot Maven Repo 구축(Nexus2 OSS 내부 저장소)

[Spring Boot] Spring Boot Maven Repo 연동(Nexus2 OSS 내부 저장소)

[Spring Boot] Spring Boot Structure

[Spring Boot] Nexus3 도커 레지스트리

Nexus2 -> Nexus3 업그레이드 준비

먼저 Nexus2와 Nexus3를 각각 기동합니다.

1) Nexus 포트 변경

Nexus의 경우 기본 8081 포트를 사용하므로 동일 서버에 구축할 경우 하나의 서버는 포트를 변경해 주어야 합니다.

Nexus3의 경우

[root@guruson etc]# pwd 
/root/nexus/nexus3/nexus-3.17.0-01/etc 
[root@guruson etc]# 

경로의 nexus-default.properties 파일을 수정하여 포트를 변경할 수 있습니다.

## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties 
## 
# Jetty section 
application-port=8081 
application-host=0.0.0.0 
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml 
nexus-context-path=/ 

# Nexus section 
nexus-edition=nexus-pro-edition 
nexus-features=\ 
 nexus-pro-feature 

nexus.hazelcast.discovery.isEnabled=true

8081 포트를 8082 포트로 변경하도록 하겠습니다.

Nexus3의 포트를 유지하고 Nexus2의 포트를 변경하고자 할 경우

[root@guruson conf]# pwd 
/root/nexus/nexus2/nexus-2.14.13-01/conf 
[root@guruson conf]# 

경로의 nexus.properties 파일을 수정하여 포트를 변경할 수 있습니다.

# 
# Sonatype Nexus (TM) Open Source Version 
# Copyright (c) 2008-present Sonatype, Inc. 
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. 
# 
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, 
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. 
# 
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks 
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the 
# Eclipse Foundation. All other trademarks are the property of their respective owners. 
# 

# Sonatype Nexus 
# ============== 
# This is the most basic configuration of Nexus. 

# Jetty section 
application-port=8081 
application-host=0.0.0.0 
nexus-webapp=${bundleBasedir}/nexus 
nexus-webapp-context-path=/nexus 

# Nexus section 
nexus-work=${bundleBasedir}/../sonatype-work/nexus 
runtime=${bundleBasedir}/nexus/WEB-INF 

# orientdb buffer size in megabytes 
storage.diskCache.bufferSize=4096

2) Nexus 기동

변경이 완료되었으면 다음과 각각 Nexus를 기동합니다.

Nexus2는

[root@guruson bin]# pwd 
/root/nexus/nexus2/nexus-2.14.13-01/bin 
[root@guruson bin]# 

경로의 nexus 바이너리를 이용하여 기동합니다.

[root@guruson bin]# ./nexus start &
[1] 11812
[root@guruson bin]# 

**************************************** 
WARNING - NOT RECOMMENDED TO RUN AS ROOT 
**************************************** 
Starting Nexus OSS... 
Removed stale pid file: /root/nexus/nexus2/nexus-2.14.13-01/bin/../bin/jsw/linux-x86-64/nexus.pid 
Started Nexus OSS. 

[1]+  Done                    ./nexus start 
[root@guruson bin]# 

Nexus3는

[root@guruson bin]# pwd 
/root/nexus/nexus3/nexus-3.17.0-01/bin 
[root@guruson bin]# 

경로의 nexus 바이너리를 이용하여 기동합니다.

[root@guruson bin]# ./nexus run &
[1] 16356
[root@guruson bin]# 

WARNING: ************************************************************ 
WARNING: Detected execution as "root" user.  This is NOT recommended! 
WARNING: ************************************************************ 
2019-07-29 23:07:12,688+0900 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.pax.logging.NexusLogActivator - start 
2019-07-29 23:07:13,815+0900 WARN  [FelixStartLevel] *SYSTEM uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4JInitialiser - Your logging framework class org.ops4j.pax.logging.slf4j.Slf4jLogger is not known - if it needs access to the standard println methods on the console you will need to register it by calling registerLoggingSystemPackage 
...

...
2019-07-29 23:07:42,593+0900 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.siesta.SiestaServlet - Initialized 
2019-07-29 23:07:42,596+0900 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Initialized 
2019-07-29 23:07:42,621+0900 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@63197a02{Sonatype Nexus,/,file:///root/nexus/nexus3/nexus-3.17.0-01/public/,AVAILABLE} 
2019-07-29 23:07:42,649+0900 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@53d58129{HTTP/1.1,[http/1.1]}{0.0.0.0:8082} 
2019-07-29 23:07:42,649+0900 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.Server - Started @31447ms 
2019-07-29 23:07:42,649+0900 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer -  
------------------------------------------------- 

Started Sonatype Nexus OSS 3.17.0-01 

-------------------------------------------------

Nexus2는 ./nexus start & Nexus3는 ./nexus run &임에 유의합니다.

3) Nexus Webadmin 확인

Nexus2부터 확인해 보도록 하겠습니다.

Nexus2는 접속 URL이 http://Nexus_Install_Server_IP:8081/nexus이며

Webadmin은 위와 같습니다.

Nexus3는 접속 URL이 http://Nexus_Install_Server_IP:8082이며

Webadmin 화면은 위와 같습니다.

4) Nexus2 Maven Repository 확인

지난 포스팅에서 생성한 Nexus2 Maven Repository를 재확인하겠습니다.

위와 같이 3rd party repository에 Spring Boot 관련 리포지토리들이 생성되어 있는 것을 볼 수 있습니다.

Nexus 업그레이드

이제 준비가 완료되었으니 Nexus 업그레이드를 위한 설정을 진행하겠습니다.

1) Nexus2 업그레이드 기능 설정

먼저 Nexus2의 업그레이드 기능을 활성화 합니다.

위와 같이 왼쪽 메뉴바의 Administration 탭의 Capabilities 항목을 선택하고 상단의 New 버튼을 클릭합니다.

다음으로 Type을 Upgrade: Agent를 선택하고 Access Token으로 Nexus3에서 승인 요청할 토큰을 하나 입력하고 Add 버튼을 클릭합니다.

정상적으로 추가가 완료되면 위와 같이 Ready 상태로 Upgrade: Agent가 생성되어 있을 것입니다.

2) Nexus3 업그레이드 기능 설정

다음으로 Nexus3에서 Nexus2 라이브러리를 전달 받기 위한 설정입니다.

왼쪽 System 메뉴 바의 Capabilities를 선택하고 Create Capability를 클릭합니다.

다음으로 메뉴 항목 중 Upgrade를 선택하고 Create Capability 버튼을 클릭합니다.

위와 같이 Upgrade 항목이 Enabled 상태로 생성되면 업그레이드 할 준비가 완료된 것입니다.

3) 업그레이드 진행

이제 준비가 완료되었으니 업그레이드를 진행해 보겠습니다.

업그레이드는 Nexus3에서 Nexus2에서 생성한 토큰 기반으로 접근하는 방식을 사용합니다.

Nexus3에서 Capabilities에서 추가한 Upgrade 항목이 이제 System 하단에 생성되었을 것입니다.

업그레이드를 선택하고 Next 버튼을 클릭합니다.

위와 같이 Nexus2 URL과 입력한 Access Token 그리고 Fetch Size를 지정하고 Next 버튼을 클릭합니다.

이후 과정은 각 과정에 맞게 필요한 항목을 선택하면서 진행합니다.

가져올 Content와 Repository 경로 및 전송 속도를 선택하고, Nexus2에서 가져올 Repository를 선택합니다.

이때 3rd party에 Spring Boot Repository가 존재합니다. 그 밖에도 가져오고자 하는 Repositories를 모두 선택하고 Next 버튼을 클릭합니다.

다음 화면에서 Begin 버튼을 클릭하면, 

다음과 같이 Progress Bar가 진행되며 Continue 버튼을 클릭하면 실제 바이너리 복사가 진행됩니다.

잠시 시간이 흐르면 다운로드가 완료됩니다. Done 버튼을 클릭하고 생성된 리포지토리를 확인해 보겠습니다.

위와 같이 thirdparty 리포지토리에 Nexus2 라이브러리가 옮겨진 것을 확인할 수 있습니다.

 

사실 Nexus2에서 단순히 Storage 디렉토리로 업로드 하는 것만으로 리포지토리에 반영할 수 있는 반면 Nexus3에서는 jar를 파일을 하나하나 수동으로 올리거나, Coordination을 진행해야 하는 번거로움이 있어 Nexus2를 유지하는 경우가 많으나, Docker Repository와 통합 관리를 위한 용도로 Nexus2에 업로드 된 Spring Boot 라이브러리를 이관하고 이후 추가되는 라이브러리만 Nexus3에 직접 반영하거나 Nexus2에 다시 반영하여 업그레이드를 다시 진행하는 방식이 보다 간편하게 관리할 수 있는 방법 중 하나일 것입니다.

물론 이후 버전에서 Nexus3에 업로드 기능의 편의성이 확보된다면 이러한 번거로움도 없어지겠지만,,

그럼 이번 포스팅은 여기서 마치겠습니다.

728x90
반응형