STAND-109: Replace the embedded mysql with mariadb4j#68
STAND-109: Replace the embedded mysql with mariadb4j#68dkayiwa merged 45 commits intoopenmrs:masterfrom Muta-Jonathan:STAND-109
Conversation
|
|
||
| // Grant privileges to openmrs user | ||
| mariaDB.run("GRANT ALL PRIVILEGES ON *.* TO '" + DATABASE_USER_NAME + "'@'localhost';"); | ||
| mariaDB.run("FLUSH PRIVILEGES;"); |
There was a problem hiding this comment.
used direct sql here but these above commands can be compiled in a sql file and sourced using mariaDB.source(fileName) but for now as per this PR's aim this should still be good
|
When i build and run, on choosing the |
|
I believe these come from the commented out liquidbase changesets @dkayiwa do we have any recent updated liquidbase changesets i can use
|
Also seems there is a database connectivity issue let me look into it 🙂 |
|
cc @dkayiwa |
|
Does this fix the runtime error that i reported? |
oh yes now on end get the tables error https://pastebin.com/2Wh4KygA which will need just a bump to the latest dump sql openmrs file |
|
Meaning that this is not yet ready for review and testing? |
|
sure in the meantime am going to convert it to draft .. however am wondering if we have archives for the latest dump files I can use inorder to fix the sql table errors also updated liquibase files to try out on the latest version |
|
And FWIW, now the mvn package stage results into this: https://pastebin.com/SWD8mpSF |
|
Choosing the demo data option takes me to the |
|
On this small adjustment have been able to load the updated demo data which have named 2.0.0 however found out that in resulting into errors like find the full errors here https://pastebin.com/LbhM5DRY |
|
@Muta-Jonathan which version of liquibase is the standalone configured with? |
4.4.1 |
|
Does it help if you switch it to 4.31.1? |
let me try that |
|
@Muta-Jonathan i have just run your changes but i still get the |
Am trying to figure out why the war file is not triggering the setup wizard which will then re-direct to the login in page but currently unable to find the cause .... however seen in core for the installation wizard to load the setup must be missing |
src/main/assembly/zip-demo-data.xml
Outdated
| <fileSet> | ||
| <outputDirectory>/</outputDirectory> | ||
| <directory>${project.build.directory}/demodatabase/data</directory> | ||
| <!-- <directory>${project.build.directory}/demodatabase/data</directory>--> |
There was a problem hiding this comment.
Choosing the demo data option takes me to the The OpenMRS 2.8.0 server is currently in maintenance mode. page. It is supposed to do all the setup behind the scenes and just take me to the log in page.
I believe this is happening because of this line in trying to zip the demodatabase it fails here saying the demo is not in the directory
| <configuration> | ||
| <tasks> | ||
| \ <unzip src="${liquibase.demodata.archive}" dest="." /> | ||
| <unzip src="${liquibase.demodata.archive}" dest="." /> |
There was a problem hiding this comment.
which executes here named in the pom.xml as
<liquibase.demodata.archive>Demo-1.9.0.sql.zip</liquibase.demodata.archive>
And since the Unzipped db at this stage contains no tables and schema for the Db ... the tables are not created hence the re-direct to Maintainance page
| mariaDB.run("FLUSH PRIVILEGES;"); | ||
|
|
||
| // Create the OpenMRS database schema if it doesn't exist | ||
| mariaDB.createDB(DATABASE_NAME, DATABASE_USER_NAME, userPassword); |
There was a problem hiding this comment.
Just found the issue causing the installation wizard to fail to start ... this is due to creating the Openmrs database schema here which tells the core that already the scheme is available ...
| build-macos: | ||
| name: on macOS (Java 21) | ||
| runs-on: macos-latest | ||
| runs-on: macos-15 |
There was a problem hiding this comment.
Was getting this error on Ci
dyld[2778]: Symbol not found: _vidattr$NCURSES60
Referenced from: mariadb (built for macOS 15.0 which is newer than running OS)
Expected in: /usr/lib/libncurses.5.4.dylib
According to this so far github maps macos-latest to OS Version: macOS 14.7.6 (23H626) https://arc.net/l/quote/tdcfqkkj ...now had to manually specify macos-15
.github/workflows/standalone-ci.yml
Outdated
|
|
||
| - name: Build and Test with Maven | ||
| run: mvn clean install | ||
| run: mvn clean install -DskipTests |
There was a problem hiding this comment.
Generally this i placed it here because the maven liquibase tests start the db which later seems to delay to close for macos and windows conflicting with the normal java tests causing database fails to start
.github/workflows/standalone-ci.yml
Outdated
|
|
||
| - name: Build and Test with Maven | ||
| run: mvn clean install | ||
| run: mvn clean install -DskipTests |
There was a problem hiding this comment.
But the question still stands ...let me try to refactor for both mac and windows
| build-macos: | ||
| name: on macOS (Java 21) | ||
| runs-on: macos-latest | ||
| runs-on: macos-15 |
There was a problem hiding this comment.
yes @dkayiwa explained the error i was getting above and why i used macos-15
Was getting this error on Ci
dyld[2778]: Symbol not found: _vidattr$NCURSES60
Referenced from: mariadb (built for macOS 15.0 which is newer than running OS)
Expected in: /usr/lib/libncurses.5.4.dylib
According to this so far github maps macos-latest to OS Version: macOS 14.7.6 (23H626) https://arc.net/l/quote/tdcfqkkj ...now had to manually specify macos-15
| cp ../target/*database.zip . | ||
| ln -s ../tomcat tomcat | ||
| cp ../*.png . | ||
| cp ../openmrs-standalone-runtime.properties . |
There was a problem hiding this comment.
Is there a reason why you renamed this?
There was a problem hiding this comment.
yes this was coping ../openmrs-standalone-runtime.properties which doesnot exist basically it is now ../openmrs-runtime.properties
| cp ../openmrs-standalone-runtime.properties . | ||
| cp ../openmrs-runtime.properties . | ||
| cp ../target/*.jar . | ||
| cp ../target/openmrs-standalone.war tomcat/webapps/openmrs-standalone.war |
There was a problem hiding this comment.
Is there a reason why you renamed this?
There was a problem hiding this comment.
yes this was coping ../target/openmrs-standalone.war yet in target we have ../target/openmrs.war also the in the standalone code we look for openmrs.war in the webapps directory not openmrs-standalone.war
There was a problem hiding this comment.
What did we do to change it from the original name?
There was a problem hiding this comment.
from this commit here Muta-Jonathan@c3ea3fc i see that Raf removed it and later openmrs.war was introduced Muta-Jonathan@305097c
There was a problem hiding this comment.
this commit explains why it has been like that for a while ... this is the last commit before my changes Muta-Jonathan@248ac66 here i see in pom.xml that
<configuration>Add commentMore actions
<artifactItems>
<artifactItem>
<groupId>org.openmrs.web</groupId>
<artifactId>openmrs-webapp</artifactId>
<version>${openmrs.version}</version>
<type>war</type>
<outputDirectory>target</outputDirectory>
<destFileName>openmrs-standalone.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
which shows that the packagezip.sh expected the change also done in that commit cp ../target/openmrs-standalone.war tomcat/webapps/openmrs-standalone.war which later even after the update to openmrs.war in the pom.xml this Muta-Jonathan@305097c wasnt addressed
| StandaloneUtil.resetConnectionPassword(); | ||
| StandaloneUtil.startupDatabaseToCreateDefaultUser(); | ||
| StandaloneUtil.startupDatabaseToCreateDefaultUser(mySqlPort); | ||
| System.out.println("Database mode using wizard: " + applyDatabaseChange ); |
There was a problem hiding this comment.
Do you still need the System.out.println statements?
There was a problem hiding this comment.
Added these to be shown in the logs
See https://openmrs.atlassian.net/browse/STAND-109
Description
The change migrates the embedded database used by openmrs-standalone from mysql mxj to MariaDB4j (see https://github.com/MariaDB4j/MariaDB4j)
In order to keep the PR simple I opted to continue using the mysql driver instead of a MariaDB driver as mysql drivers are compatible with MariaDB.
on this PR, uses java version to 8 as the minimum java version. Also using
MariaDB4J (3.2.0v) latestversion with mac silicon (M1,M2+) supportTesting
In addition to the new unit tests I also performed the below manual tests and not sure if I need to do any validation on the other artifacts that get generated from packaging.
Use cases
Am using a mac M2 chip and the following are the steps needed to run the openmrs-standalone-2.4.0
mvn cleanmvn packageopenmrs-standalone/target/openmrs-standalone-2.4.0-SNAPSHOT.zipzipped file to any desired destination on unzip from therejava --versionin your terminalopenmrs-standalone.jarScreenShots
Showing the folder