rspace-os / rspace-web

This the main repository for RSpace: rspace-web. Check https://github.com/rspace-os/rspace-web/blob/main/DevDocs/DeveloperNotes/GettingStarted/GettingStarted.md for setup instructions.
https://github.com/rspace-os/rspace-web/wiki
GNU Affero General Public License v3.0
12 stars 3 forks source link

Deployment properties set through command line not honored #63

Closed ll4strw closed 4 weeks ago

ll4strw commented 1 month ago

I am instructing RSpace v2.0.0 to use a different database than the default rspace by launching it with jetty using

RS_FILE_BASE=/home/leonardo/RSPACE/rspace_file_store mvn clean jetty:run \
-Denvironment=drop-recreate-db -DRS.devlogLevel=INFO \
-Dspring.profiles.active=run -Dliquibase.context=dev-test \
-DgenerateReactDist -Dlog4j2.configurationFile=log4j2-dev.xml \
-Djdbc.url=jdbc:mysql://localhost:3306/rspace_vanilla

I would expect from option -Djdbc.url=jdbc:mysql://localhost:3306/rspace_vanilla that an existing database named rspace would be left untouched, instead it is dropped and recreated where as the new database rspace_vanilla ends up containing only the following tables

+--------------------------+
| Tables_in_rspace_vanilla |
+--------------------------+
| DATABASECHANGELOG        |
| DATABASECHANGELOGLOCK    |
+--------------------------+

Eventually the building and launch process fails with error

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'rspace_vanilla.roles' doesn't exist

Are perhaps options -Denvironment=drop-recreate-db and -Djdbc.url=jdbc:mysql://localhost:3306/rspace_vanilla incompatible? Or is their appearance order important? Thanks.

rs-fraser commented 4 weeks ago

@ll4strw I have updated the documentation in this PR https://github.com/rspace-os/rspace-web/pull/86 to explain an additional deployment property required to use a different database name.

In your case above, you would need to add (in addition to the existing params) -Djdbc.db=rspace_vanilla.

Let me know if you have any issues. More info here: https://github.com/rspace-os/rspace-web/blob/main/DevDocs/DeveloperNotes/GettingStarted/GettingStarted.md#set-deployment-properties-through-command-line

ll4strw commented 4 weeks ago

@rs-fraser I have tried the following with rspace v2.0.0

mvn clean compile

mvn clean jetty:run -Denvironment=drop-recreate-db -DRS.devlogLevel=INFO -Dspring.profiles.active=run -Dliquibase.context=dev-test -DgenerateReactDist -Dlog4j2.configurationFile=log4j2-dev.xml -Djdbc.url=jdbc:mysql://localhost:3306/rspace_vanilla -Djdbc.db=rspace_vanilla

but I still get a bunch of errors like the ones below

ERROR] HHH000389: Unsuccessful: alter table AppConfigElement drop foreign key FK_da27586fw25ixb3nchld54abj
[ERROR] Table 'rspace.AppConfigElement' doesn't exist
[ERROR] HHH000389: Unsuccessful: alter table AppConfigElement drop foreign key FK_aln55rabki06r7hr7r8fmbwvp
[ERROR] Table 'rspace.AppConfigElement' doesn't exist
[ERROR] HHH000389: Unsuccessful: alter table AppConfigElementDescriptor drop foreign key FK_s70jodrxnueplu21nv7x0cxcc

and finally the process stops with

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'rspace_vanilla.roles' doesn't exist

Must I use the latest version of rspace?

rs-fraser commented 4 weeks ago

@ll4strw apologies, there's an additional param also required -Djdbc.db.maven=rspace_vanilla which should work for you. I've update the docs as well.

I'll create an internal ticket too to see if we can simplify these params as we are repeating information and it's quite confusing.