Skip to content

STAND-136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts#92

Closed
Muta-Jonathan wants to merge 5 commits intoopenmrs:openmrs-emr3from
Muta-Jonathan:STAND-136
Closed

STAND-136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts#92
Muta-Jonathan wants to merge 5 commits intoopenmrs:openmrs-emr3from
Muta-Jonathan:STAND-136

Conversation

@Muta-Jonathan
Copy link
Member

@Muta-Jonathan Muta-Jonathan commented Sep 12, 2025

Issue

https://openmrs.atlassian.net/browse/STAND-136

Description

Currently, the referenceapplication-standalone project relies on Docker Compose steps in the build scripts to start and initialize OpenMRS and its dependencies (e.g., MySQL). This approach introduces several drawbacks:

  • Requires Docker and Docker Compose pre-installed to setup in automated environments like Bamboo
  • Adds unnecessary complexity for local developers who may not want to run Docker.

Proposed Change

  • Remove Docker Compose–based steps from the standalone build scripts.
  • Integrate OpenMRS SDK (openmrs-sdk-maven-plugin) to manage setup and runtime:
    • Automated server setup with predefined runtime properties.
    • Automatic runtime properties and checksum generation.

Benefits

  • Simplifies local setup for developers.
  • Provides consistent environment across local development and CI/CD pipelines.

Screenshots

Screenshot 2025-09-12 at 10 27 29 AM Screenshot 2025-09-12 at 10 27 46 AM

@Muta-Jonathan
Copy link
Member Author

cc @Ruhanga @dkayiwa

@Muta-Jonathan Muta-Jonathan changed the title Stand 136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts STAND136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts Sep 12, 2025
@Muta-Jonathan Muta-Jonathan changed the title STAND136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts STAND-136: Replace Docker Compose setup steps with OpenMRS SDK in standalone build scripts Sep 12, 2025
PID=$(lsof -ti:8080 || true)
if [ -n "$PID" ]; then
echo "⚠️ Port 8080 is in use by PID $PID. Stopping it..."
kill -9 $PID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works if I don’t care about what’s running on port 8080. But what if I do have a process I want to keep there? Killing it blindly might stop something important. Maybe we should add a check or a prompt before killing, or even allow overriding the port instead of always freeing 8080.

Something like:

  echo "Port $PORT is in use by PID $PID."
  read -p "Do you want to stop this process? (y/N) " choice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to use a free port within a specific range, such as 8000 to 9000.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that makes sense @mherman22 .... let me update it to go as @Ruhanga suggests

@Muta-Jonathan
Copy link
Member Author

cc @Ruhanga @mherman22 @dkayiwa

@dkayiwa
Copy link
Member

dkayiwa commented Sep 12, 2025

@Muta-Jonathan have you tested this?

@Muta-Jonathan
Copy link
Member Author

@Muta-Jonathan have you tested this?

yes @dkayiwa

Comment on lines +51 to +53
connection.url=jdbc:mariadb://127.0.0.1:3308/openmrs-example?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
connection.username=root
connection.password=Admin123
Copy link
Member

@Ruhanga Ruhanga Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to detect whether a MySQL instance is running on the host machine or inside a Docker container, so the script can dynamically choose the correct connection URL—either jdbc:mariadb://127.0.0.1:* for a host-based instance, or jdbc:mariadb://<mysql-service-name>:* for a Docker-based instance?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure @Ruhanga let me address it

@Muta-Jonathan
Copy link
Member Author

cc @Ruhanga @dkayiwa

@dkayiwa
Copy link
Member

dkayiwa commented Sep 24, 2025

@Muta-Jonathan do you know why this standalone goes all the way to over 500 mbs?

@dkayiwa
Copy link
Member

dkayiwa commented Sep 24, 2025

@Muta-Jonathan are you also able to run this command? mvn package -Drefapp.version=3.5.0

@Muta-Jonathan
Copy link
Member Author

mvn package -Drefapp.version=3.5.0

let me addess this

@Muta-Jonathan
Copy link
Member Author

Muta-Jonathan commented Sep 26, 2025

@Muta-Jonathan do you know why this standalone goes all the way to over 500 mbs?

@dkayiwa seems mine is about 492.4mb when zipped and around Total ≈ 705 MB unpacked
Basically this is due to AppData including modules, checksums

and to break it down

AppData: 398.7 MB (~56%)
Tomcat: 105.9 MB (~15%)
Standalone JAR: 198.6 MB (~28%)
DB Dumps + misc: ~3 MB (<1%)


Screenshot from 2025-09-26 13-57-36

Copy link
Member

@Ruhanga Ruhanga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Muta-Jonathan for your continued effort on this. It's becoming clear that we'll likely need to move away from Bamboo in the near future and so, relying on Dockerized builds may soon be obsolete, especially with the greater flexibility offered by GitHub Actions.

With this in mind, I'd suggest we consider closing this PR in favor of a GitHub Actions-based approach.

@dkayiwa
Copy link
Member

dkayiwa commented Sep 26, 2025

@Ruhanga doesn't GitHub actions offer dockerised builds?

@Ruhanga
Copy link
Member

Ruhanga commented Sep 26, 2025

Absolutely. GitHub does support Dockerized builds, along with a variety of other build environments like Java and more. This means we're no longer limited or constrained to using the SDK solely for the sake of Dockerized builds, as is the case with Bamboo.

@Muta-Jonathan
Copy link
Member Author

Absolutely. GitHub does support Dockerized builds, along with a variety of other build environments like Java and more. This means we're no longer limited or constrained to using the SDK solely for the sake of Dockerized builds, as is the case with Bamboo.

does this mean we need to switch back the script to use docker compose rather than yhe sdk?

@Ruhanga
Copy link
Member

Ruhanga commented Sep 28, 2025

does this mean we need to switch back the script to use docker compose

@Muta-Jonathan this is the case already. Introducing the SDK was primarily to resolve build issues on Bamboo, due to complications with Docker-in-Docker builds.

What we would need, in favour of Github actions already, is a workflow that is able to publish a standalone to SourceForge given a released distro.

@Muta-Jonathan
Copy link
Member Author

thanks @Ruhanga that makes sense
@dkayiwa since the dockerised approach was faster at build time I think its okay we close out this since github actions can handle the build now

@dkayiwa
Copy link
Member

dkayiwa commented Sep 29, 2025

@Muta-Jonathan can you point me to the github actions that are handling the build now?

@Muta-Jonathan
Copy link
Member Author

Muta-Jonathan commented Sep 29, 2025

@Muta-Jonathan can you point me to the github actions that are handling the build now?

Basically am meaning these Github actions on PR builds https://github.com/openmrs/openmrs-standalone/actions/runs/17127633070/job/48583108852 One thing we are missing for the one which would publish to SourceForge

@dkayiwa
Copy link
Member

dkayiwa commented Sep 29, 2025

Can we create that such that we achieve our ultimate goal?

@Muta-Jonathan
Copy link
Member Author

Can we create that such that we achieve our ultimate goal?

sure i think @Ruhanga needs to create this workflow

  1. build the project from this branch
  2. publish the zip from target folder to sourgeforge

Since He has the credentials

@Ruhanga
Copy link
Member

Ruhanga commented Oct 3, 2025

@Muta-Jonathan where you able to update the database damps to contain the released Ref Apps metadata, as the current ones seem to have been generated using the pre-release distro?

@Muta-Jonathan
Copy link
Member Author

@Ruhanga Let me see if i can make the database dumps be extracted at build time instead of manually to avoid this manual update each time

cc @dkayiwa

@Muta-Jonathan
Copy link
Member Author

Muta-Jonathan commented Oct 21, 2025

@dkayiwa @Ruhanga Have been looking into this and am thinking why not to go with the sdk approach instead

Simply because this helps to get rid of docker requirement at build time ... been playing with docker these weeks but seems to extract demo sql but sometimes misses the table data on extraction ... that's why am suggesting this ...one downside is it takes sometime than docker build but ready to hear your suggestions

@dkayiwa
Copy link
Member

dkayiwa commented Feb 6, 2026

@Muta-Jonathan is this still relevant?

@Muta-Jonathan
Copy link
Member Author

Muta-Jonathan commented Feb 8, 2026

Since we decided to move away from bamboo builds am thinking I can close this out.
The challenge this PR was addressing was all about the Bamboo builds now this will be handled by github actions

Is there any objections to this (me closing this) @Ruhanga @dkayiwa ?

@dkayiwa dkayiwa closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants