-
Notifications
You must be signed in to change notification settings - Fork 43
Nexus: Upgrade Process from version 2.x to 3.7.1
This wiki page provides an upgrade plan and steps to upgrade Nexus in-place on your ADOP/C instance.
Please do not pull the latest changes in adop-docker-compose and run init as that will invalidate your Nexus setup if you are running on a 2.x version of Nexus.
Before proceeding with the upgrade, ensure to take a backup of your ADOP/C volumes.
These Nexus steps are based on the assumption that your ADOP/C is running on AWS but instructions can be adapted as appropriate for another cloud provider or on-premise.
Current Version: 2.x
Upgraded Version: 3.7.1
- Upgrade from version 2.11.3-01 to 2.14.5
- Deploy Nexus v3.7.1 container on ADOP/C
- Enable the upgrade capabilities in both version 2 and version 3
- Perform Upgrade using HTTP Download method
- Kill Nexus 2 and rdeploy Nexus 3 on ADOP/C
Skip this step if you already have 2.14.5
Steps -
- Redeploy Nexus using version 2.14.5 (docker image: accenture/adop-nexus:0.1.4)
- SSH onto your ADOP/C
- cd to your root adop-docker-compose folder
- Update docker-compose.yml to use image: accenture/adop-nexus:0.1.4 Nexus docker image
- Re-deploy ADOP/C
export PRIVATE_IP=$(curl http://instance-data/latest/meta-data/local-ipv4)
./adop compose -i ${PRIVATE_IP} -f etc/aws/default.yml init
- Validate that Nexus is up and running with the 2.14.5 version
- Perform basic Nexus functional tests
Steps -
- SSH on your ADOP/C
-
cd to your root adop-docker-compose folder and create a new docker-compose.nexus3.yml file and paste the content below:
nexus3:
container_name: nexus3
restart: always
image: accenture/adop-nexus:0.2.2
net: ${CUSTOM_NETWORK_NAME}
volumes:
- nexus_data:/nexus-data
ports:
- "8082:8081"
environment:
NEXUS_BASE_URL: "http://${PRIVATE_IP}:8082/nexus3"
NEXUS_CONTEXT: "nexus3"
NEXUS_ADMIN_PASSWORD: "${INITIAL_ADMIN_PASSWORD_PLAIN}"
LDAP_SEARCH_BASE: "${LDAP_FULL_DOMAIN}"
LDAP_ENABLED: "true"
LDAP_URL: "ldap"
LDAP_BIND_DN: "${LDAP_ADMIN},${LDAP_FULL_DOMAIN}"
LDAP_BIND_PASSWORD: "${LDAP_PWD}"
LDAP_USER_PASSWORD_ATTRIBUTE: "userPassword"
LDAP_USER_BASE_DN: "${LDAP_USER_BASE_DN}"
LDAP_GROUP_BASE_DN: "${LDAP_GROUP_BASE_DN}"
- Run these commands in your shell
export CUSTOM_NETWORK_NAME=local_network
export PRIVATE_IP=$(curl http://instance-data/latest/meta-data/local-ipv4)
source ./conf/env.provider.sh
source credentials.generate.sh
source env.config.sh
docker-compose -f docker-compose.nexus3.yml up -d
- To access Nexus 3 you have to add port 8082 in your AWS Security group temporarily (for another cloud provider you have to do the same or open the relevant firewall rules if you are not using a cloud). Nexus 3 Url: http://##your-adop-c-private-ip##:8082/nexus3
-
In version 2, enable the Upgrade: Agent capability to open the connection for the upgrade-agent. Follow these steps:
-
In version 2, enable the Upgrade: Agent capability to open the connection for the upgrade-agent. Follow these steps:
- Click to expand Administration in the left-hand panel.
- Click the Capabilities menu item to open the respective screen.
- Click the New button to access the Create new capability modal.
- Select Upgrade: Agent as your capability Type.
- Click Add to close the modal and add the capability.
- Copy and save the Access Token found on the Status tab for your new capability. You need it to configure the Upgrade tool in version 3.
In the lower section of the Capabilities interface, the repository manager acknowledges the upgrade-agent as Active.
-
In version 3, enable the Upgrade capability to open the connection for the upgrade-agent and access the Upgrade tool.
Follow these steps:
- Click Capabilities in the System section of the Administration main menu to open the Capabilities feature view.
- Click Create capability.
- Select Upgrade, then click Create capability to enable the upgrade capability.
Note: The next few steps will cause an outage while the upgrade is taking place and you should ensure you are ready to proceed with the process.
Steps -
- In version 3, go to the Administration menu.
- Select Upgrade located in the System section of the Administration main menu to open the wizard.
- In the Overview screen, click Next to begin.
- In the Agent Connection screen, provide the IP URL of Nexus 2 (http://nexus:8081/nexus) and the Access Token copied from Nexus 2 Upgrade: Agent capability Status tab (same token you noted earlier). Click Next.
- In the Content screen, select the following and click Next.
- Repository configuration and content (this includes user accounts and associated security settings)
- Server configuration
- In the Repository Defaults screen, select "Download (slowest)" as the transfer method and click Next. Note: When selecting a different transfer method, the method might not be updated. Validate that the transfer method is correct by checking the Method column on the next step. If the Method column is different with the method selected, you will need to start again the upgrade process from Step 1.
- In the Repositories screen, select all the repositories to be upgraded and click Next.
- In the Preview screen, validate that everything is INITIALIZED and click Begin to proceed.
- Click Yes on the Begin Upgrade window.
- As the upgrade process starts, you will be logged out from Nexus and will be prompted with login dialog box.
- Login to Nexus 3 using your username and password (make sure your user have Administrator access in Nexus 2 before the upgrade so you will be able to login to Nexus 3 with the same access level)
- Go to Administrator menu
- Select Upgrade located in the System section of the _Administration _main menu.
- In the _Preparing _screen, the status of the contents and repositories to be upgraded are shown.
- Once all the statuses are COMPLETED, click Continue.
- In the _Synchonizing _screen, the sync process status is shown. This is when the copy process is happening. During the sync process, user can still update the existing repositories in Nexus 2 and any updates on the repository will be synced to Nexus 3.
- When you see " since last change, press "Continue" when ready" on the last row, you will notice that the Continue button is still disabled. Refresh the page to enable the Continue button.
- When you are done with the syncing process, click Continue.
- Click Yes on the Stop waiting for changes dialog box to confirm. When sync process is done, any changes made on the repositories in Nexus 2 will no longer be copied to Nexus 3.
- In the finishing screen, the upgrade status of the repositories is shown.
- Once all the statuses are COMPLETED, click Done. You will then see a small dialog box on the upper right of the screen that "Upgrade is Done"
- Validate that everything is still working as expected.
As we have upgraded our Nexus data now we need to deploy Nexus 3 in the proper way.
Steps -
- Remove 8082 port what you add to your AWS security group for another cloud provider you have to do the same or close firewall if you are not using a cloud.
- Remove Nexus3 container.
docker-compose -f docker-compose.nexus3.yml down
- Update docker-compose and default volume yml files. The snippet of changes you need to make to the Nexus service in docker-compose.yml
nexus:
container_name: nexus
restart: always
- image: accenture/adop-nexus:0.1.4
+ image: accenture/adop-nexus:0.2.2
net: ${CUSTOM_NETWORK_NAME}
expose:
- "8081"
environment:
NEXUS_BASE_URL: "${PROTO}://${TARGET_HOST}/nexus"
+ NEXUS_CONTEXT: "nexus"
+ NEXUS_ADMIN_PASSWORD: "${INITIAL_ADMIN_PASSWORD_PLAIN}"
LDAP_SEARCH_BASE: "${LDAP_FULL_DOMAIN}"
LDAP_ENABLED: "true"
LDAP_URL: "ldap"
LDAP_BIND_DN: "${LDAP_ADMIN},${LDAP_FULL_DOMAIN}"
+ LDAP_BIND_PASSWORD: "${LDAP_PWD}"
LDAP_USER_PASSWORD_ATTRIBUTE: "userPassword"
LDAP_USER_BASE_DN: "${LDAP_USER_BASE_DN}"
LDAP_GROUP_BASE_DN: "${LDAP_GROUP_BASE_DN}"
- LDAP_BIND_PASSWORD: "${LDAP_PWD}"
The snippet of changes you need to make to the Nexus service in etc/volumes/local/default.yml
nexus:0
volumes:
- - nexus_sonatype_work:/sonatype-work
+ - nexus_data:/nexus-data
(Update if you are using NFS) The snippet of changes you need to make to the Nexus service in etc/volumes/nfs/default.yml
nexus:
volume_driver: nfs
volumes:
- - ${NFS_HOST}/nfs/nexus_sonatype_work:/sonatype-work
+ - ${NFS_HOST}/nfs/nexus_sonatype_work:/nexus-data
- Update local administrator password, skip if your password is the same as default: "admin123".
echo your-local-admin-password > $(docker volume inspect -f {{.Mountpoint}} nexus_data)
- Re-launch adop
export PRIVATE_IP=$(curl http://instance-data/latest/meta-data/local-ipv4)
./adop compose -i ${PRIVATE_IP} -f etc/aws/default.yml init
Note: If you hit Nexus and it gives a 502 you can restart proxy container. It still holds the old cache and that's why it is not able to reach the site.
Test Case | Test Steps | Expected Result |
---|---|---|
Upload artifact to hosted repository manually | 1. Open the command line on your local machine and ensure you have curl installed2. Run the following command: curl -v --user : --upload-file local_file_name.extension http://<NEXUS3_URL>/repository/<REPO_NAME>/<REPO_FILE_PATH>/name_of_file.extension 3. Ensure you replace and with your username and password respectively. Make sure to also replace local_file_name.extension with the file name and path of where your file is stored that you want to upload. Finally replace <REPO_NAME>, <REPO_FILE_PATH> and name_of_file.extension with the correct repository name, the repository target path and the new name for your file with its appropriate extension. 4. For more information regarding how to upload artifacts refer to this page |
Artifact is uploaded and accessible using the repository path. |
Download artifact from repository path | 1. Go to the hosted repository path 2. Download the artifact that you uploaded earlier |
Artifact is downloaded and not corrupted. |
Search functionality | 1. On the left-hand pane, click "Search" 2. Search for a repository/privilege/role |
Search result is displayed. |
- View privileges are missing on the migrated repositories. The solution for this issue is on the SonaType ticket.
- Known issue as per https://issues.sonatype.org/browse/NEXUS-12222
- Artifacts can still be downloaded but not browsable from the UI
Useful links:
https://help.sonatype.com/display/NXRM3/Upgrading#Upgrading-Upgradingfrom2.xto3.y
https://help.sonatype.com/display/NXRM3/Upgrade+Procedures
https://help.sonatype.com/display/NXRM3/Data+Transfer+Methods
https://forums.aws.amazon.com/thread.jspa?threadID=261370 - Disk Quota Exceeded error