Sonatype Nexus migration from built-in OrientDB to PostgreSQL in separate container
Deutsch
English
Note: This post is mostly just a collection of commands I’ve tried. I am not 100% sure what the correct way to do this is, but this worked out for me in the end. Ensure to backup your data before trying!
Based on the official Sonatype migration instructions and our 5-minute Nexus configuration but adapted for Docker.
Ensure Nexus is running in version 3.70.0 and add depends_on to the Nexus service in docker-compose.yml:
nexus_postgres_migration.yml
nexus:
image: sonatype/nexus3:3.70.0
# ...
depends_on:
- postgresAdd config for Postgres to .env
nexus_postgres.env
POSTGRES_DB=nexus
POSTGRES_USER=nexus
POSTGRES_PASSWORD=ahyath1thaem4Aedaemeoph5AadohbAdd datastore config to nexus_data/etc/nexus.properties:
nexus.properties
nexus.datastore.enabled=trueAdd PostgreSQL connection string to nexus_data/etc/fabric/nexus-store.properties:
nexus-store.properties
username=nexus
password=ahyath1thaem4Aedaemeoph5Aadohb
jdbcUrl=jdbc\:postgresql\://postgres\:5432/nexusAdd PostgreSQL container
docker-compose-nexus-postgres.yml
services:
postgres:
image: postgres
restart: unless-stopped
volumes:
- ./pg_data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}Download migrator into mapped data directory
download_nexus_migrator.sh
cd nexus_data
wget https://download.sonatype.com/nexus/nxrm3-migrator/nexus-db-migrator-3.72.0-01.jar
cd ..Run migrator
run_nexus_migrator.sh
docker-compose run nexus /bin/bash -c 'java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar /nexus-data/nexus-db-migrator-* --migration_type=postgres --db_url="jdbc:postgresql://postgres:5432/nexus?user=nexus&password=ahyath1thaem4Aedaemeoph5Aadohb"'Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow