Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-28620

Nexus Database Migrator fails when symlink is used for data directory or data directory not in standard location

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.33.0
    • Fix Version/s: 3.34.0
    • Labels:
      None
    • Environment:
      Nexus deployments on any container environment and custom $data-dir path environments
    • Story Points:
      5
    • Sprint:
      NXRM Rocket Sprint 15
    • Notability:
      2

      Description

      ISSUE:

      When using nexus database migrator tool, where Data Directory ($data-dir , ./sonatype-work/nexus3 ) is sym-linked to /nexus-data (persistent volume), migrator tool fails.

       

       

      ENVIRONMENT:

      $data-dir is symlinked to /nexus-data persistent volume. 

      In our docker image, /opt/sonatype/sonatype-work/nexus is symlined to /nexus-data, for data persistence. 

      Thus this issue affects all of our container environment deployments.

       

      [nexus@centos79 db]$ ls -l /opt/nexus-psql/sonatype-work
      total 43692
      drwxr-xr-x 10 nexus nexus      141 Apr 13 11:21 blobs
      -rw-r--r--  1 nexus nexus 44740395 Aug 10 10:28 latest.jar
      drwxrwxr-x  2 nexus nexus       46 Aug 10 10:52 logs
      lrwxrwxrwx  1 nexus nexus       11 Aug 10 12:06 nexus -> /nexus-data
      
      
      [nexus@centos79 db]$ pwd
      /opt/nexus-psql/sonatype-work/nexus/db
      
      
      

      ERROR:

      [nexus@centos79 db]$ pwd[nexus@centos79 db]$ pwd
      /opt/nexus-psql/sonatype-work/nexus/db
      
      [nexus@centos79 db]$ java -Xmx4G -Xms4G -XX:MaxDirectMemorySize=4014M -jar /opt/nexus-psql/sonatype-work/latest.jar  --migration_type=postgres --db_url="jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=nexus123"
      12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - --content_migration parameter is absent. Setting it to true.12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------
      12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - Java version: Red Hat, Inc. 1.8.0_28212:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - JVM arguments: -Xmx4G -Xms4G -XX:MaxDirectMemorySize=4014M12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - Migrator arguments: --migration_type=postgres --db_url=jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=**** --content_migration=true12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------
      12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - Starting MigratorApplication v3.33.0-01 on centos79.avsrini.net with PID 10827 (/opt/nexus-psql/sonatype-work/latest.jar started by nexus in /nexus-data/db)
      12:06:51 [main] INFO  c.s.n.d.migrator.MigratorApplication - No active profile set, falling back to default profiles: default
      12:06:52 [main] INFO  o.s.b.c.r.s.JobRepositoryFactoryBean - No database type set, using meta data indicating: POSTGRES
      12:06:52 [main] INFO  c.s.n.d.migrator.MigratorApplication - Started MigratorApplication in 1.495 seconds (JVM running for 1.8)
      12:06:52 [main] INFO  o.s.b.a.b.JobLauncherCommandLineRunner - Running default command line with: [--migration_type=postgres, --db_url=jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=nexus123, --content_migration=true]
      12:06:52 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener -
      Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
      12:06:52 [main] ERROR o.s.boot.SpringApplication - Application run failedjava.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:61)Caused by: com.sonatype.nexus.db.migrator.exception.InvalidMigratorLocationException: You have to put the migrator jar file into the Nexus Repository `sonatype-work/nexus3/db` folder
      

      --orient.folder option also doesn't work. 

       

      [nexus@centos79 db]$ java -Xmx4G -Xms4G -XX:MaxDirectMemorySize=4014M -jar /opt/nexus-psql/sonatype-work/latest.jar --orient.folder=/nexus-data/db --migration_type=postgres --db_url="jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=nexus123"
      12:13:40 [main] INFO  c.s.n.d.migrator.MigratorApplication - --content_migration parameter is absent. Setting it to true.
      12:13:40 [main] INFO  c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------
      ;
      ;
      12:13:41 [main] INFO  o.s.b.a.b.JobLauncherCommandLineRunner - Running default command line with: [--orient.folder=/nexus-data/db, --migration_type=postgres, --db_url=jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=nexus123, --content_migration=true]
      12:13:41 [main] INFO  o.s.b.a.b.JobLauncherCommandLineRunner - Running default command line with: [--orient.folder=/nexus-data/db, --migration_type=postgres, --db_url=jdbc:postgresql://localhost:5432/nexusdb?user=nexus&password=nexus123, --content_migration=true]
      12:13:42 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener -
      Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
      
      12:13:42 [main] ERROR o.s.boot.SpringApplication - Application run failedjava.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:61)Caused by: com.sonatype.nexus.db.migrator.exception.InvalidMigratorLocationException: You have to put the migrator jar file into the Nexus Repository `sonatype-work/nexus3/db` folder

       

      EXPECTED RESULT:

      Migrator tool should allow symlinks and custom paths for $data-dir. 

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ybulatnikov Eugene Bulatnikov
              Reporter:
              sappusamy Srinivasan Appusamy
              Last Updated By:
              Eugene Bulatnikov Eugene Bulatnikov
              Team:
              NXRM - Rocket Raccoon
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title