Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Latest commit

 

History

History
154 lines (104 loc) · 6.03 KB

configuring-nexus.md

File metadata and controls

154 lines (104 loc) · 6.03 KB

Configuring Nexus

Table of Contents

One is to log-in as admin (the default password is admin123) and head over to Administration/Security/Users. Click the admin user and change its password by pointing to More > Change password. Make sure to change the email address as well.

Nexus comes pre-configured with a default blob store which is used by all repositories. Since this blob store is backed-up periodically, it is recommended to create a new blob store to host proxied/cached artifacts that do not require backup (e.g., those coming from Maven Central).

In order to do so, one is to head over to Administration/Blob Stores, click Create blob store and configure the new blob store as follows:

proxied-blob-store

Finally, one is to click Create blob store to finish the process.

Once the proxied blob store is created, one must configure the maven-central proxy to use the new blob store. Unfortunately it is not possible to change the blob store associated with an already existing repository, so one must delete the maven-central repository and re-create it.

In order to do so, one is to head over to Administration/Repositories, click Create repository, choose the maven2 (proxy) recipe and configure it as follows:

maven-central

One is to make sure to choose proxied as the underlying blob store.

After re-creating the maven-central repository, it is necessary to edit the maven-public group. In order to do so, one is to head over to maven-public and add maven-central to the list of Member repositories as follows:

maven-public

For using Nexus as a Docker registry, an hosted repository must be created. In order to do so, one is to head over to Administration/Repositories, click Create repository, choose the docker (hosted) recipe and configure it as follows:

docker-hosted

One is to make sure to choose 5003 as the port for the HTTP connector and default as the underlying blob store. Finally, one is to click Create repository to finish the process.

For Nexus to act as a repository for Python software, it is necessary to create a pypi-all virtual repository that will group two other repositories:

  • pypi-proxied repository, which will proxy packages from PyPI, and
  • pypi-hosted repository, which will host private (our own) packages.

Configuring pypi-proxied

One is to head over to Administration/Repositories, click Create repository, choose the pypi (proxy) recipe and configure it as follows:

pypi-proxied

One is to make sure to choose proxied as the underlying blob store. Finally, one is to click Create repository to finish the process.

Configuring pypi-hosted

One is to head over to Administration/Repositories, click Create repository, choose the pypi (hosted) recipe and configure it as follows:

pypi-hosted

One is to make sure to choose default as the underlying blob store. Finally, one is to click Create repository to finish the process.

Configuring pypi-all

One is to head over to Administration/Repositories, click Create repository, choose the pypi (group) recipe and configure it as follows:

pypi-all

One is to make sure to choose default as the underlying blob store. Finally, one is to click Create repository to finish the process.

For the implemented backup process to work as expected, one must create a couple of periodic tasks.

Attention: Nexus provides default intervals, e.g. daily, but also supports CRON notation for advanced configuration. While this tool tries to amenize any misconfigurations, be warned that erroneous cron expressions may lead to corrupt backups or even no backups at all.

One clear example of this was one tester who wanted thirty (30) minute intervals between backups, defined the cron expression as * */30 * * * instead of 0 0/30 * * *. This resulted in a backup process being queued every second, instead. For more details check Configuring and Executing Tasks.

The first task, called backup-1, is responsible for triggering the backup procedure itself. In order to create it, one is to head over to Administration/Tasks, click Create task, choose Execute script and proceed as detailed below:

backup-1-task

In this example, Nexus will touch the /nexus-data/backup/.backup file everyday at 4am UTC, triggering the backup process - there's a process monitoring this file that reacts to changes and starts the process.

The second task, called backup-2, is responsible for backing-up the Nexus databases, configurations and metadata. In order to create it, one is to head over to Administration/Tasks, click Create task, choose Export databases for backup and proceed as detailed below:

backup-2-task

In this example, Nexus will backup its internal databases everyday at 4am UTC. The abovementioned process waits for the task to complete and includes the resulting file in the backup bundle.