Skip to main content

Lifecycle API

Warning

These operations are intended to be used with the guidance of Sonatype support. Usage without supervision of Sonatype is not supported or recommended.

Introduction

The Lifecycle API allow Nexus Repository Manager administrators to change the phase in which a NXRM instance is running. A lifecycle phase is a step in the start up process used to group similar components and ensure that their dependencies are started before them. In order of execution during startup, the phases are:

  1. OFF - NXRM is completely off and the process is shut down.

  2. KERNEL - The most basic parts of the node are running.

  3. STORAGE - The databases and caches are setup.

  4. RESTORE - Any restoring from backups happens in this phase.

  5. UPGRADE - If any upgrades are needed, they will occur is this phase.

  6. SCHEMAS - This creates any missing schemas in the database.

  7. EVENTS - The event bus is initialized.

  8. SECURITY - The parts of NXRM responsible for security are enabled.

  9. SERVICES - This phase starts the all of the services, such as repositories.

  10. CAPABILITIES - The capabilities are started.

  11. TASKS - The task scheduler is enabled, and tasks may run.

Endpoints

Lifecycle Phase

GET /service/rest/v1/lifecycle/phase

This returns the current phase in which Nexus Repository is running.

curl -u admin:admin123 -X GET "http://localhost:8081/service/rest/v1/lifecycle/phase" -H "accept: text/plain"

Example Response

TASKS
PUT /service/rest/v1/lifecycle/phase

This sets NXRM to run in a particular phase. Any features that are enabled by later phases are shut down. e.g. Setting NXRM to the CAPABILITIES phase will stop any tasks from running, since they only occur in the TASKS phase.

curl -u admin:admin123 -X PUT "http://localhost:8081/service/rest/v1/lifecycle/phase" -H "accept: application/json" -H "Content-Type: text/plain" -d "SERVICES"

Lifecycle Bounce

PUT /service/rest/v1/lifecycle/bounce

This operation takes the instance down to the supplied Lifecycle phase, and then back to the phase in which it was originally running. This is used primarily to restart phase in one operation.

curl -u admin:admin123 -X PUT "http://localhost:8081/service/rest/v1/lifecycle/bounce" -H "accept: application/json" -H "Content-Type: text/plain" -d "TASKS"