diff --git a/automatic/nexus-repository-migrator/Readme.md b/automatic/nexus-repository-migrator/Readme.md new file mode 100644 index 000000000000..02683e56edbd --- /dev/null +++ b/automatic/nexus-repository-migrator/Readme.md @@ -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` - 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="/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 \ No newline at end of file diff --git a/automatic/nexus-repository-migrator/nexus-repository-migrator.nuspec b/automatic/nexus-repository-migrator/nexus-repository-migrator.nuspec index cde70104e767..50aa57465e16 100644 --- a/automatic/nexus-repository-migrator/nexus-repository-migrator.nuspec +++ b/automatic/nexus-repository-migrator/nexus-repository-migrator.nuspec @@ -7,62 +7,11 @@ Sonatype chocolatey-community, jpruskin Migrator for the Sonatype Nexus Repository database. - + https://help.sonatype.com/en/orientdb-downloads.html https://github.com/sonatype/nexus-public https://help.sonatype.com/en/migrating-to-a-new-database.html - nexus-repository migration sonatype nexus + nexus-repository-migrator utility freeware cross-platform sonatype nexus-repository Sonatype http://www.eclipse.org/legal/epl-v10.html false diff --git a/automatic/nexus-repository-migrator/tools/ConvertFrom-NexusOrientDb.ps1 b/automatic/nexus-repository-migrator/tools/ConvertFrom-NexusOrientDb.ps1 index a4bc1149c328..e4aa5eb28221 100644 --- a/automatic/nexus-repository-migrator/tools/ConvertFrom-NexusOrientDb.ps1 +++ b/automatic/nexus-repository-migrator/tools/ConvertFrom-NexusOrientDb.ps1 @@ -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")) { diff --git a/automatic/nexus-repository-migrator/tools/chocolateyInstall.ps1 b/automatic/nexus-repository-migrator/tools/chocolateyInstall.ps1 index 525325a917b6..4e643da1ea4e 100644 --- a/automatic/nexus-repository-migrator/tools/chocolateyInstall.ps1 +++ b/automatic/nexus-repository-migrator/tools/chocolateyInstall.ps1 @@ -17,7 +17,7 @@ $PowerShellScript = @{ } Install-ChocolateyPowershellCommand @PowerShellScript -if ($PackageParameters.AttemptMigration) { +if ($PackageParameters.Migrate) { $ConvertArguments = @{} if ($PackageParameters.FQDN) { $ConvertArguments.Hostname = $PackageParameters.FQDN diff --git a/automatic/nexus-repository/tools/chocolateyinstall.ps1 b/automatic/nexus-repository/tools/chocolateyinstall.ps1 index 5ce39a93f8f8..300f6e96aab0 100644 --- a/automatic/nexus-repository/tools/chocolateyinstall.ps1 +++ b/automatic/nexus-repository/tools/chocolateyinstall.ps1 @@ -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") }