Skip to content

Commit d23abd3

Browse files
STAND-120: Move Demo and CIEL Database Packaging from Build-Time to Runtime Platform (#77)
* move Demo and CIEL Database Packaging from Build-Time to Runtime * fixing test failures * adding support for mysqldump via MySQL on CI * removing the wildcard* * addressing linux and win install mysql * finding mysqldump on ci * revert to mysqldump * adding ci linux mysqldump checks * adding arg column-statistics=0 to pass the linux build * cleanup and updating README.md * adding cleaning step for linux * using bin/mariadb-dump instead of mysqldump * using bin/mariadb-dump instead of mysqldump * using scripts to solve mysqldump for windows * using java DatabaseDumper to solve mysqldump for windows * adding skip-extended-insert * added rebuild the search index on database * fixing windows ci failure * fixing windows ci failure * addressing the mvn package failure * re-correcting the update search index
1 parent f46f202 commit d23abd3

File tree

15 files changed

+266
-96
lines changed

15 files changed

+266
-96
lines changed

README.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Depending on what OpenMRS software artifact you are releasing, you may need to c
1717
* If you are building OpenMRS Platform => use the `master` branch
1818
* If you are building OpenMRS Reference Application => use the `openmrs-emr2` branch
1919

20-
## Building openmrs-standalone for OpenMRS version 2.4 or later
20+
## Building openmrs-standalone for OpenMRS version 2.7 or later
2121

2222
### Increasing maven memory
2323

@@ -30,16 +30,14 @@ argument to use --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED
3030

3131
Building openmrs-standalone is decomposed into five steps as different steps use different version of the Liquibase Maven plugin.
3232

33-
Openmrs-core is using Liquibase 3.x as of OpenMRS version 2.4.x. However, Liquibase version 3.x *fails* to load
34-
large sql files such as the CIEL concept dictionary. Liquibase version 2.x successfully loads large sql files.
33+
Openmrs-core is using Liquibase 4.x as of OpenMRS version 2.6.x. However, Liquibase version 4.x *fails* to load
34+
large sql files such as the CIEL concept dictionary. instead we use the script runner tracing in DbInitializer which loads large sql files.
3535

36-
* Steps 1, 3, and 5 use version 3.10.2 of the plugin as they depend on openmrs-core version 2.4.x or later.
37-
38-
* Steps 2 and 4 load large sql files and continue to use Liquibase version 2.0.1.
36+
* Steps 1, 3, and 5 use version 4.32.0 of the plugin as they depend on openmrs-core version 2.7.x or later.
3937

4038
When running
4139

42-
$ mvn clean package -Dopenmrs.version=2.4.0
40+
$ mvn clean package -Dopenmrs.version=2.7.4-SNAPSHOT
4341

4442
the `clean` step is executed for each module. This means that the folder
4543

@@ -50,7 +48,7 @@ is deleted at the beginning of step 2 and the database created in step 1 is no l
5048
To avoid that, `mvn clean` needs to be run separately before the rest of the build:
5149

5250
$ mvn clean
53-
$ mvn package -Dopenmrs.version=2.4.0
51+
$ mvn package -Dopenmrs.version=2.7.4-SNAPSHOT
5452

5553
### Choosing demo data
5654

@@ -65,17 +63,17 @@ just downloaded
6563

6664
### Choosing CIEL data
6765

68-
* Download the latest CIEL for OpenMRS 1.9.x (use 1.9.x regardless of the maintenance release version) as described [here](https://wiki.openmrs.org/x/ww4JAg).
66+
* Download the latest CIEL for OpenMRS 2.5.5 (use 2.5.x regardless of the maintenance release version) as described [here](https://wiki.openmrs.org/x/ww4JAg).
6967

7068
* Upload it to mavenrepo by running (adjust the version and the file parameters to match the downloaded version of CIEL):
71-
`mvn deploy:deploy-file -DgroupId=org.openmrs.contrib -DartifactId=ciel-dictionary -Dversion=1.9.9-20170409 -Dpackaging=zip -Dfile=openmrs_concepts_1.9.9_20170409.sql.zip -DrepositoryId=openmrs-repo-contrib -Durl=https://mavenrepo.openmrs.org/nexus/content/repositories/contrib`
69+
`mvn deploy:deploy-file -DgroupId=org.openmrs.contrib -DartifactId=ciel-dictionary -Dversion=2.5.5-20250512 -Dpackaging=zip -Dfile=openmrs_concepts_2.5.5_20250512.sql.zip -DrepositoryId=openmrs-repo-contrib -Durl=https://mavenrepo.openmrs.org/nexus/content/repositories/contrib`
7270

7371
* Update the CIEL version in pom.xml.
7472

7573
### Other tips
7674

77-
* If running `mvn clean` and `mvn package` second time, ALWAYS check to make sure mariaDB processes on port 3326 and/or
78-
3328 and/or 33326 are stopped. If you DON'T do that, then the `mvn clean` will not really clean.
75+
* If running `mvn clean` and `mvn package` second time, ALWAYS check to make sure mariaDB processes on port 3316 and/or
76+
33326 and/or 33328 are stopped. If you DON'T do that, then the `mvn clean` will not really clean.
7977

8078
* A good command to use is: "pkill -f standalone" (kills anything with "standalone" in the path)
8179

@@ -86,7 +84,7 @@ permission failures since by default linux may fail to modify privileges on non
8684
-> output is in the target folder, as openmrs-standalone-(openmrs.version).zip
8785
-> the contents of that zip are in the similarly-named folder under /target, if you want to test in-place
8886

89-
## Building openmrs-standalone for OpenMRS version 2.3 or earlier
87+
## Building openmrs-standalone for OpenMRS version 2.7 or earlier
9088

9189
Please note that this version of openmrs-standalone cannot be used for openmrs-core 2.3.x or earlier.
9290

@@ -207,7 +205,7 @@ NOTE: Without this folder structure, you will get errors while trying to run the
207205
* contextname-runtime.properties
208206
* e.g openmrs-runtime.properties, openmrs-1.6.1-runtime.properties, openmrs-1.9.0-runtime.properties, etc
209207
* If you want to use this runtime properties file, make sure that the web application context name does not match with any existing runtime properties file in say the user's home folder. This is because of the openmrs runtime properties file search order which will only look in the current application folder as the last resort if no runtime properties file has been found in any of the other possible locations.
210-
* standalone-0.0.1-SNAPSHOT.jar
208+
* standalone.jar
211209
* This is the output executable jar for this standalone project.
212210
* You can build this right from eclipse by right clicking on the project and then select Export -> Java -> Runnable JAR file.
213211
* The name of this jar file needs to be standalone-0.0.1-SNAPSHOT.jar because it is hard coded in the Bootstrap class as so.
@@ -235,14 +233,6 @@ NOTE: When creating a new database using the openmrs database setup wizard, reme
235233

236234
The embedded MariaDB4j database engine is a fully functional database engine that you can connect too using any database
237235
GUI query tools like Navicat, EMS MySQL Manager, etc
238-
239-
240-
241-
242-
243-
244-
245-
246236

247237
## SOME ROUGH STATISTICS SO FAR
248238

pom-step-01.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@
5252
<goal>start</goal>
5353
</goals>
5454
</execution>
55-
<execution>
56-
<id>stop-empty-database</id>
57-
<phase>process-resources</phase>
58-
<goals>
59-
<goal>stop</goal>
60-
</goals>
61-
</execution>
6255
</executions>
6356
</plugin>
6457
<plugin>
@@ -146,7 +139,7 @@
146139
<plugin>
147140
<groupId>org.liquibase</groupId>
148141
<artifactId>${liquibase.plugin.artifactId}</artifactId>
149-
<version>${liquibase.plugin.version.3.x}</version>
142+
<version>${liquibase.plugin.version.4.x}</version>
150143
<dependencies>
151144
<dependency>
152145
<groupId>org.openmrs.api</groupId>

pom-step-02.xml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@
1616
<relativePath>pom.xml</relativePath>
1717
</parent>
1818

19+
<dependencies>
20+
<dependency>
21+
<groupId>org.openmrs.api</groupId>
22+
<artifactId>openmrs-api</artifactId>
23+
<version>${openmrs.version}</version>
24+
<type>jar</type>
25+
<scope>provided</scope>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.openmrs.distro</groupId>
29+
<artifactId>platform</artifactId>
30+
<version>${openmrs.version}</version>
31+
<type>war</type>
32+
<scope>provided</scope>
33+
</dependency>
34+
</dependencies>
35+
1936
<build>
2037
<plugins>
2138
<plugin>
@@ -26,16 +43,6 @@
2643
<baseDir>${project.build.directory}/emptydatabase</baseDir>
2744
<dataDir>${project.build.directory}/emptydatabase/data</dataDir>
2845
</configuration>
29-
30-
<executions>
31-
<execution>
32-
<id>start-empty-database</id>
33-
<phase>initialize</phase>
34-
<goals>
35-
<goal>start</goal>
36-
</goals>
37-
</execution>
38-
</executions>
3946
</plugin>
4047
<plugin>
4148
<artifactId>maven-resources-plugin</artifactId>
@@ -146,7 +153,7 @@
146153
<plugin>
147154
<groupId>org.liquibase</groupId>
148155
<artifactId>${liquibase.plugin.artifactId}</artifactId>
149-
<version>${liquibase.plugin.version.3.x}</version>
156+
<version>${liquibase.plugin.version.4.x}</version>
150157
<dependencies>
151158
<dependency>
152159
<groupId>org.openmrs.liquibase.ext</groupId>

pom-step-03.xml

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,6 @@
3535

3636
<build>
3737
<plugins>
38-
<plugin>
39-
<groupId>ch.vorburger.mariaDB4j</groupId>
40-
<artifactId>mariaDB4j-maven-plugin</artifactId>
41-
<configuration>
42-
<port>33326</port>
43-
<baseDir>${project.build.directory}/emptydatabase</baseDir>
44-
<dataDir>${project.build.directory}/emptydatabase/data</dataDir>
45-
</configuration>
46-
47-
<executions>
48-
<execution>
49-
<id>stop-empty-database</id>
50-
<phase>verify</phase>
51-
<goals>
52-
<goal>stop</goal>
53-
</goals>
54-
</execution>
55-
</executions>
56-
</plugin>
5738
<plugin>
5839
<groupId>org.liquibase</groupId>
5940
<artifactId>${liquibase.plugin.artifactId}</artifactId>
@@ -86,13 +67,64 @@
8667
</execution>
8768
</executions>
8869
</plugin>
70+
71+
<!-- Exec: Empty Dump DB to SQL -->
72+
<plugin>
73+
<groupId>org.codehaus.mojo</groupId>
74+
<artifactId>exec-maven-plugin</artifactId>
75+
<executions>
76+
<execution>
77+
<id>dump-empty-database</id>
78+
<phase>package</phase>
79+
<goals>
80+
<goal>java</goal>
81+
</goals>
82+
<configuration>
83+
<mainClass>org.openmrs.standalone.DatabaseDumper</mainClass>
84+
<arguments>
85+
<argument>${project.build.directory}</argument>
86+
<argument>emptydatabase</argument>
87+
<argument>--port=33326</argument>
88+
<argument>--user=openmrs</argument>
89+
<argument>--password=test</argument>
90+
<argument>--skip-lock-tables</argument>
91+
<argument>--skip-extended-insert</argument>
92+
<argument>--ssl=0</argument>
93+
<argument>openmrs</argument>
94+
<argument>--result-file=${project.build.directory}/openmrs-empty-dump.sql</argument>
95+
</arguments>
96+
<classpathScope>compile</classpathScope>
97+
</configuration>
98+
</execution>
99+
</executions>
100+
</plugin>
101+
102+
<plugin>
103+
<groupId>ch.vorburger.mariaDB4j</groupId>
104+
<artifactId>mariaDB4j-maven-plugin</artifactId>
105+
<configuration>
106+
<port>33326</port>
107+
<baseDir>${project.build.directory}/emptydatabase</baseDir>
108+
<dataDir>${project.build.directory}/emptydatabase/data</dataDir>
109+
</configuration>
110+
111+
<executions>
112+
<execution>
113+
<id>stop-empty-database</id>
114+
<phase>verify</phase>
115+
<goals>
116+
<goal>stop</goal>
117+
</goals>
118+
</execution>
119+
</executions>
120+
</plugin>
89121
</plugins>
90122
<pluginManagement>
91123
<plugins>
92124
<plugin>
93125
<groupId>org.liquibase</groupId>
94126
<artifactId>${liquibase.plugin.artifactId}</artifactId>
95-
<version>${liquibase.plugin.version.3.x}</version>
127+
<version>${liquibase.plugin.version.4.x}</version>
96128
<dependencies>
97129
<dependency>
98130
<groupId>org.openmrs.api</groupId>

pom-step-04.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@
1616
<relativePath>pom.xml</relativePath>
1717
</parent>
1818

19+
<dependencies>
20+
<dependency>
21+
<groupId>org.openmrs.api</groupId>
22+
<artifactId>openmrs-api</artifactId>
23+
<version>${openmrs.version}</version>
24+
<type>jar</type>
25+
<scope>provided</scope>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.openmrs.distro</groupId>
29+
<artifactId>platform</artifactId>
30+
<version>${openmrs.version}</version>
31+
<type>war</type>
32+
<scope>provided</scope>
33+
</dependency>
34+
</dependencies>
35+
1936
<build>
2037
<plugins>
2138
<plugin>
@@ -83,7 +100,7 @@
83100
<plugin>
84101
<groupId>org.liquibase</groupId>
85102
<artifactId>${liquibase.plugin.artifactId}</artifactId>
86-
<version>${liquibase.plugin.version.3.x}</version>
103+
<version>${liquibase.plugin.version.4.x}</version>
87104
<dependencies>
88105
<dependency>
89106
<groupId>org.openmrs.liquibase.ext</groupId>

0 commit comments

Comments
 (0)