Skip to content

janvanlith/n3dr

 
 

Repository files navigation

n3dr

GoDoc Widget Build Status Go Report Card DevOps SE Questions Issues Pull requests Total downloads License Repository Size Contributors Commit activity Last commit Release date Latest Production Release Version Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities CII Best Practices codecov BCH compliance GolangCI

The aims of the n3dr tool are:

  • to backup all artifacts from a certain Nexus maven repository.
  • to migrate all artifacts from NexusA to NexusB.

Installation

curl -L https://github.com/030/n3dr/releases/download/3.1.1/n3dr-linux -o n3dr-linux
curl -L https://github.com/030/n3dr/releases/download/3.1.1/n3dr-linux.sha512.txt -o n3dr-linux.sha512.txt
sha512sum --check n3dr-linux.sha512.txt
chmod +x n3dr-linux
./n3dr-linux

Debian

VERSION=3.3.3 && \
curl -L https://github.com/030/n3dr/releases/download/${VERSION}/n3dr_${VERSION}-0.deb -o n3dr.deb && \
sudo apt -y install ./n3dr.deb

Check the help menu

user@computer:~/dev$ ./n3dr-linux -h
N3DR is a tool that is able to download all artifacts from
a certain Nexus3 repository.

Usage:
  n3dr [command]

Available Commands:
  backup       Backup all artifacts from a Nexus3 repository
  help         Help about any command
  repositories Count the number of repositories or return their names
  upload       Upload all artifacts to a specific Nexus3 repository

Flags:
  -v, --apiVersion string   The Nexus3 APIVersion, e.g. v1 or beta (default "v1")
  -d, --debug               Enable debug logging
  -h, --help                help for n3dr
      --insecureSkipVerify  Skip repository certificate check
  -p, --n3drPass string     The Nexus3 password
  -n, --n3drURL string      The Nexus3 URL
  -u, --n3drUser string     The Nexus3 user
  -z, --zip                 Add downloaded artifacts to a ZIP archive

Use "n3dr [command] --help" for more information about a command.

Store the password in a read-only file

Define the password in ~/.n3dr.yaml:

---
n3drPass: admin123

and set the permissions to 400 by issuing:

chmod 400 ~/.n3dr.yaml

Backup artifacts from a certain repository

All artifacts from a repository will be stored in a download folder when the following command is run:

./n3dr-linux backup -u admin -n http://localhost:8081 -r maven-releases

Backup all repositories

All artifacts from various repositories will be stored in a download folder when the following command is issued:

./n3dr-linux repositories -u admin -n http://localhost:8081 -b

Note: a new folder will be created for every repository:

  • download/maven-public
  • download/maven-releases

Add all downloaded archives to a ZIP archive

In order to add all archives to a zip archive, one has to use the --zip or -z flag.

Upload all artifacts to a certain repository

It is possible to upload all JARs that reside in a folder by running the following command:

./n3dr-linux upload -u admin -n http://localhost:8081 -r maven-public

"Clone" the content of a repository in a different Nexus 3 server in a different repository

This is the basic steps to "clone" and eventually rename the content of a repository from one nexus3 server to another server in a different repository name

./n3dr-linux backup -u <source nexus3 user> -n <source nexus3 server url> -r <repo-source-name>
cd download
mv <repo-source-name> <repo-target-name>
./n3dr-linux upload -u <target nexus3 user> -n <target nexus3 server url> -r <repo-target-name>

Rationale for N3DR

Although there is a number of equivalent tools:

None of them seems to be able to backup all repositories by running a single command.

About

Nexus3 backup and recovery tool

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 87.8%
  • Shell 12.2%