I tried upgrading artifactory 7.90.6 to 7.104.7. Created a backup of the artifactory/derby
and access/derby
derby dbs.
Launching the new version, a db migration fails. Looks like multiple JVMs attempt to connect:
2025-02-20T20:48:20.106Z [jftpl] [ERROR] [ ] [o.s.b.SpringApplication:857 ] [main ] - Application run failed
com.jfrog.topology.server.changelogs.DatabaseMigrationException: org.flywaydb.core.internal.dbsupport.FlywaySqlException:
Unable to obtain Jdbc connection from DataSource
------------------------------------------------
SQL State : XSDB6
Error Code : 45000
Message : Another instance of Derby may have already booted the database /var/opt/jfrog/artifactory/data/derby.
I see in the release notes that "JFrog Topology" is a new service, and that it's "extracted from Access".
I tried manually starting only that service with sudo -u artifactory /opt/jfrog/artifactory/app/topology/bin/topology.sh
, which worked fine.
Config:
shared:
database:
allowNonPostgresql: true
type: derby
driver: org.apache.derby.jdbc.EmbeddedDriver
url: jdbc:derby:/opt/jfrog/artifactory/var/data/artifactory/derby
user: artifactory
artifactory:
port: 8081
tomcat:
...
access:
http:
port: 8040
database:
type: derby
driver: org.apache.derby.jdbc.EmbeddedDriver
url: jdbc:derby:/opt/jfrog/artifactory/var/data/access/derby
tomcat:
...
Since the upgrade failed, I tried to go back to 7.90.6. I restored both databases, unfortunately then the jfmd
metadata service fails to start with "unknown migration in database: v040_resize_pkg_tags_value_column.sql":
2025-02-20T20:27:03.274Z [jfmd ] [INFO ] [ ] [database_bearer.go:143 ] [main ] - Db connection driver::sqlite3 and kerberosAuth::false [database]
2025-02-20T20:27:03.276Z [jfmd ] [INFO ] [ ] [database_bearer.go:158 ] [main ] - Connecting to (db config: {sqlite jdbc:derby:/opt/jfrog/artifactory/var/data/artifactory/derby}) [database]
2025-02-20T20:27:03.309Z [jfmd ] [INFO ] [ ] [migrator.go:63 ] [main ] - Applying migration files [database]
2025-02-20T20:27:03.310Z [jfmd ] [INFO ] [ ] [migrator.go:164 ] [main ] - Migration lock table created or is already present [database]
2025-02-20T20:27:03.310Z [jfmd ] [INFO ] [ ] [migration_lock_manager.go:49 ] [main ] - Trying to acquire migration lock for ip-172-31-10-237 [database]
2025-02-20T20:27:03.328Z [jfmd ] [INFO ] [ ] [migration_lock_manager.go:70 ] [main ] - Migration lock acquired for ip-172-31-10-237 [database]
2025-02-20T20:27:03.328Z [jfmd ] [INFO ] [ ] [migration_lock_manager.go:76 ] [main ] - Trying to release lock owned by: ip-172-31-10-237 [database]
2025-02-20T20:27:03.335Z [jfmd ] [INFO ] [ ] [migration_lock_manager.go:90 ] [main ] - Released lock owned by node ip-172-31-10-237 [database]
2025-02-20T20:27:03.336Z [jfmd ] [ERROR] [ ] [application.go:99 ] [main ] - Could not execute database migrations unknown migration in database: v040_resize_pkg_tags_value_column.sql
jfrog.com/metadata/v7/services/common/db.validateNoUnknownMigrations
jfrog.com/metadata/v7@v7.72.6/services/common/db/migrator_planner.go:61
So I'm stuck for now. Either way forward would be helpful... jfmd
starts up fine when I'm launching 7.104.7.
I managed to start up the new version 7.104.7, at least temporarily, by using the derby network server. The idea is thanks to a chatbot, IIRC.
Config changes:
shared:
database:
allowNonPostgresql: true
type: derby
#driver: org.apache.derby.jdbc.EmbeddedDriver
driver: org.apache.derby.jdbc.ClientDriver
#url: jdbc:derby:/opt/jfrog/artifactory/var/data/artifactory/derby
url: jdbc:derby://localhost:1527//opt/jfrog/artifactory/var/data/artifactory/derby
username: APP
password: APP
Copied the client driver libraries (note: two different versions):
db-derby-10.17.1.0-bin/lib/derbyclient.jar
to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/
db-derby-10.14.2.0-bin/lib/derbyclient.jar
to /opt/jfrog/artifactory/app/topology/tomcat/lib/
Started the derby server:
sudo -u artifactory java -jar db-derby-10.17.1.0-bin/lib/derbyrun.jar server start
And then launched artifactory.