n3dr

Nexus3 Disaster Recovery (N3DR) is a tool that is capable of downloading all artifacts from a Nexus3 server and to migrate them to another one.

This project is maintained by 030

N3DR

CI GoDoc Widget GitHub go.mod Go version Go Report Card StackOverflow SE Questions DevOps SE Questions ServerFault SE Questions Docker Pulls Docker Image Size (latest semver) Issues Pull requests Total downloads GitHub forks GitHub watchers GitHub stars License Repository Size Contributors Commit activity Last commit Release date GitHub release (latest SemVer) Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities codecov GolangCI Chocolatey n3dr codebeat badge Conventional Commits semantic-release

Backup or Migrate an entire Nexus Artifact Server

Download all artifacts at once or migrate automatically from Nexus to Nexus.

Although the Nexus backup and restore documentation indicates that one could backup and restore Nexus, the data seems not to be restored completely as 500 errors occur when an artifact is downloaded from the UI after restore. It could also be possible that some steps were not issued as they have should been. Apart from that, the restore is capable of restoring the Nexus configuration.

N3DR excludes the backup of group repositories and is able to backup all Maven2 and NPM repositories and migrate and/or restore Maven2 artifacts to another Nexus server.

Note: uploads to proxy repositories are not supported by Nexus itself. As a workaround one could create a hosted repository in Nexus and upload the backed up proxy content to it.

The aims of the n3dr tool are:

Quickstart

Download the latest N3DR binary:

cd /tmp && \
curl -L https://github.com/030/n3dr/releases/download/7.1.0/n3dr-ubuntu-latest \
  -o n3dr-ubuntu-latest && \
curl -L https://github.com/030/n3dr/releases/download/7.1.0/\
n3dr-ubuntu-latest.sha512.txt \
  -o n3dr-ubuntu-latest.sha512.txt && \
sha512sum -c n3dr-ubuntu-latest.sha512.txt && \
chmod +x n3dr-ubuntu-latest && \
mv n3dr-ubuntu-latest n3dr && \
./n3dr --version

Adjust the ~/.n3dr/config.yml file:

---
n3drPass: some-pass
n3drURL: some-url
n3drUser: some-user
showLogo: false

backup all artifacts:

./n3dr repositoriesV2 --backup --directory-prefix /tmp/some-dir

start another nexus3 server:

docker run \
  --rm \
  -d \
  -p 9000:8081 \
  -p 9001:8082 \
  --name nexus3-n3dr \
  sonatype/nexus3:3.44.0

upload the artifacts to the other nexus server:

./n3dr repositoriesV2 --upload -u admin \
-p $(docker exec -it nexus3-n3dr cat /nexus-data/admin.password) \
-n localhost:9000 --https=false --directory-prefix /tmp/some-dir

repoFormat not detected. Verify whether repo: 'releases' resides in Nexus:

./n3dr configRepository -u admin \
-p $(docker exec -it nexus3-n3dr cat /nexus-data/admin.password) \
-n localhost:9000 --https=false --configRepoName releases \
--configRepoType maven2

repoFormat not detected. Verify whether repo: 'snapshots' resides in Nexus:

./n3dr configRepository -u admin \
-p $(docker exec -it nexus3-n3dr cat /nexus-data/admin.password) \
-n localhost:9000 --https=false --configRepoName snapshots \
--configRepoType maven2 --snapshot

cleanup:

docker stop nexus3-n3dr

Instructions

Stargazers over time

Stargazers over time