Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(squash) Feedback from PR
Browse files Browse the repository at this point in the history
JPRuskin committed Sep 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0ad835a commit 1857bc4
Showing 5 changed files with 61 additions and 57 deletions.
52 changes: 52 additions & 0 deletions automatic/nexus-repository-migrator/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Nexus Repository Migrator

## Features

In release 3.71.0, Sonatype Nexus Repository began using H2 as its default embedded database.
OrientDB is now in Extended Maintenance as defined in our [Sunsetting documentation](https://help.sonatype.com/en/sonatype-sunsetting-information.html).
Those wishing to upgrade to version 3.71.0 or above will need to migrate to either an H2 or PostgreSQL database.
See our detailed [help topic on Upgrading to 3.71.0 and beyond](https://help.sonatype.com/en/upgrading-to-nexus-repository-3-71-0-and-beyond.html).

This package contains the migrator tool to migrate a Sonatype Nexus Repository 3.70.1 database from OrientDb to H2 (available to all) or PostgreSQL (available to Pro license holders).

You can either install the package and run the migrator by following the instructions in Notes, or run the script `ConvertFrom-NexusOrientDb` in the tools directory.

If you have upgraded to the `nexus-repository` package version 3.71.0.6 and your installation is failing to run, you can run the `Repair-Nexus371FailedUpgrade` script in the tools directory.

## Package Parameters

This package supports the following parameters:

* `/Migrate` - Triggers migration of your existing Sonatype Nexus install(s) from OrientDb to a H2 database.
* `/FQDN` - The fully-qualified domain name that matches the subject you are using for your Nexus instance SSL certificate.

You can pass parameters as follows:

`choco install nexus-repository-migrator --parameters="/Migrate /FQDN=nexus.example.com"`

## Notes

**Please note that using the scripts contained within is entirely at the user's own risk. Read them before you run them!**

For more details, including how to migrate to PostgreSQL, see the [Migrating To A New Database article](https://help.sonatype.com/en/migrating-to-a-new-database.html).

### Migration Environment Prerequisite Requirements

The checklist below covers requirements for a successful database migration:

- If you are migrating from OrientDB to H2 or PostgreSQL, your OrientDB-based instance must be on the latest 3.70.x version.
- You must have JRE 8 or JRE 11 available. The Chocolatey `nexus-repository` 3.70.1.6 package contains this already.
- You must have at least 16GB RAM available.
- You must have a database backup in a clean working location.
- The migrator utility requires three times the disk space (minimum 10 GB) as your $data-dir/db directory.

### Migrating From OrientDB to H2

1. Perform a full backup using normal backup procedures.
1. Copy the backup to a clean working location on a different filesystem so that any extraction doesn’t impact the existing production system.
1. Shut down Nexus Repository.
1. Run the following command from the clean working location containing your database backup. You may include any of the optional parameters listed in the section below when running this command.
`java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-*.jar --migration_type=h2`
1. Copy the resultant nexus.mv.db file to your $data-dir/db directory.
1. Edit the $data-dir/etc/nexus.properties file and add the following line: `nexus.datastore.enabled=true`
1. Start Nexus Repository
Original file line number Diff line number Diff line change
@@ -7,62 +7,11 @@
<authors>Sonatype</authors>
<owners>chocolatey-community, jpruskin</owners>
<summary>Migrator for the Sonatype Nexus Repository database.</summary>
<description><![CDATA[# Nexus Repository Migrator
## Features
In release 3.71.0, Sonatype Nexus Repository began using H2 as its default embedded database.
OrientDB is now in Extended Maintenance as defined in our [Sunsetting documentation](https://help.sonatype.com/en/sonatype-sunsetting-information.html).
Those wishing to upgrade to version 3.71.0 or above will need to migrate to either an H2 or PostgreSQL database.
See our detailed [help topic on Upgrading to 3.71.0 and beyond](https://help.sonatype.com/en/upgrading-to-nexus-repository-3-71-0-and-beyond.html).
This package contains the migrator tool to migrate a Sonatype Nexus Repository 3.70.1 database from OrientDb to H2 (available to all) or PostgreSQL (available to Pro license holders).
You can either install the package and run the migrator by following the instructions in Notes, or run the script `ConvertFrom-NexusOrientDb` in the tools directory.
If you have upgraded to the `nexus-repository` package version 3.71.0.6 and your installation is failing to run, you can run the `Repair-Nexus371FailedUpgrade` script in the tools directory.
## Package Parameters
This package supports the following parameters:
* `/AttemptMigration` - Attempts to migrate your existing Sonatype Nexus install from OrientDb to a H2 database.
* `/FQDN` - The fully-qualified domain name that matches the subject you are using for your Nexus instance SSL certificate.
You can pass parameters as follows:
`choco install nexus-repository-migrator --parameters="/AttemptMigration /FQDN=nexus.example.com"`
## Notes
**Please note that using the scripts contained within is entirely at the user's own risk. Read them before you run them!**
For more details, including how to migrate to PostgreSQL, see the [Migrating To A New Database article](https://help.sonatype.com/en/migrating-to-a-new-database.html).
### Migration Environment Prerequisite Requirements
The checklist below covers requirements for a successful database migration:
- If you are migrating from OrientDB to H2 or PostgreSQL, your OrientDB-based instance must be on the latest 3.70.x version.
- You must have JRE 8 or JRE 11 available. The Chocolatey `nexus-repository` 3.70.1.6 package contains this already.
- You must have at least 16GB RAM available.
- You must have a database backup in a clean working location.
- The migrator utility requires three times the disk space (minimum 10 GB) as your $data-dir/db directory.
### Migrating From OrientDB to H2
1. Perform a full backup using normal backup procedures.
1. Copy the backup to a clean working location on a different filesystem so that any extraction doesn’t impact the existing production system.
1. Shut down Nexus Repository.
1. Run the following command from the clean working location containing your database backup. You may include any of the optional parameters listed in the section below when running this command.
`java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-*.jar --migration_type=h2`
1. Copy the resultant nexus.mv.db file to your $data-dir/db directory.
1. Edit the $data-dir/etc/nexus.properties file and add the following line: `nexus.datastore.enabled=true`
1. Start Nexus Repository]]></description>
<description><![CDATA[]]></description>
<projectUrl>https://help.sonatype.com/en/orientdb-downloads.html</projectUrl>
<projectSourceUrl>https://github.com/sonatype/nexus-public</projectSourceUrl>
<docsUrl>https://help.sonatype.com/en/migrating-to-a-new-database.html</docsUrl>
<tags>nexus-repository migration sonatype nexus</tags>
<tags>nexus-repository-migrator utility freeware cross-platform sonatype nexus-repository</tags>
<copyright>Sonatype</copyright>
<licenseUrl>http://www.eclipse.org/legal/epl-v10.html</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ foreach ($Service in Get-NexusRepositoryServiceInstall) {
if ($Force -or (Test-NexusMigratorRequired -DataDir (Split-Path $Service.DataFolder) -ProgramDir $Service.ProgramFolder)) {
Write-Host "Preparing for database migration..."
$MigrationFiles = Join-Path $env:Temp "dbmigration-$($Service.ServiceName)"
$MigratorDownload = @{FileFullPath = Join-Path $PSScriptRoot "nexus-db-migrator.jar"}
$PreMigrationIssues = @()

if (Test-NexusMigratorFreeSpaceProblem -Drive $MigrationFiles.Split(':')[0] -DatabaseFolder (Join-Path $Service.DataFolder "db")) {
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ $PowerShellScript = @{
}
Install-ChocolateyPowershellCommand @PowerShellScript

if ($PackageParameters.AttemptMigration) {
if ($PackageParameters.Migrate) {
$ConvertArguments = @{}
if ($PackageParameters.FQDN) {
$ConvertArguments.Hostname = $PackageParameters.FQDN
8 changes: 5 additions & 3 deletions automatic/nexus-repository/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -44,9 +44,11 @@ if (Test-Path "$env:ProgramFiles\nexus\bin") {

if (Test-NexusMigratorRequired -DataDir $TargetDataFolder -ProgramDir $TargetFolder) {
Write-Error (@(
"This upgrade will fail if you do not migrate your database from OrientDb before proceeding."
"You can do this with the nexus-repository-migrator package, or following the upgrade instructions."
"For more details, please see: https://help.sonatype.com/en/orient-3-70-java-8-or-11.html"
"This upgrade will fail if you do not migrate your database from OrientDb."
"You can do this with the nexus-repository-migrator package, or by following"
"Sonatype's instructions. For details on using the migrator package, see:"
" https://community.chocolatey.org/packages/nexus-repository-migrator#description"
"For details, see: https://help.sonatype.com/en/orient-3-70-java-8-or-11.html"
) -join "`n")
}

0 comments on commit 1857bc4

Please sign in to comment.