Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-3427: Update SDK to follow updated /distro_root structure #291

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,28 @@ private String buildDistro(File targetDirectory, Artifact distroArtifact, Distro
downloadOWAs(targetDirectory, distroProperties, owasDir);
}


boolean isAbovePlatform2point0 = isAbovePlatformVersion(new Version(distroProperties.getPlatformVersion()), 2, 0);
if(isAbovePlatform2point0) {
File openmrsCoreDir = new File(web, "openmrs_core");
openmrsCoreDir.mkdir();
new File(web, "openmrs.war").renameTo(new File(openmrsCoreDir, "openmrs.war"));
new File(web, "modules").renameTo(new File(web, "openmrs_modules"));
new File(web, "frontend").renameTo(new File(web, "openmrs_spa"));
new File(web, "configuration").renameTo(new File(web, "openmrs_config"));
new File(web, "owa").renameTo(new File(web, "openmrs_owas"));
}

wizard.showMessage("Creating Docker Compose configuration...\n");
String distroVersion = adjustImageName(distroProperties.getVersion());
writeDockerCompose(targetDirectory, distroVersion);
writeReadme(targetDirectory, distroVersion);
copyBuildDistroResource("setenv.sh", new File(web, "setenv.sh"));
copyBuildDistroResource("startup.sh", new File(web, "startup.sh"));
copyBuildDistroResource("wait-for-it.sh", new File(web, "wait-for-it.sh"));
if(!isAbovePlatform2point0) {
copyBuildDistroResource("setenv.sh", new File(web, "setenv.sh"));
copyBuildDistroResource("startup.sh", new File(web, "startup.sh"));
copyBuildDistroResource("wait-for-it.sh", new File(web, "wait-for-it.sh"));
}

copyBuildDistroResource(".env", new File(targetDirectory, ".env"));
copyDockerfile(web, distroProperties);
distroProperties.saveTo(web);
Expand Down Expand Up @@ -429,9 +444,9 @@ private void copyDockerfile(File targetDirectory, DistroProperties distroPropert
} else {
if (isPlatform2point5AndAbove(platformVersion)) {
if (bundled) {
copyBuildDistroResource("Dockerfile-tomcat8-bundled", new File(targetDirectory, "Dockerfile"));
copyBuildDistroResource("Dockerfile-jre11-bundled", new File(targetDirectory, "Dockerfile"));
} else {
copyBuildDistroResource("Dockerfile-tomcat8", new File(targetDirectory, "Dockerfile"));
copyBuildDistroResource("Dockerfile-jre11", new File(targetDirectory, "Dockerfile"));
}
}
else {
Expand All @@ -445,10 +460,15 @@ private void copyDockerfile(File targetDirectory, DistroProperties distroPropert
}

private boolean isPlatform2point5AndAbove(Version platformVersion) {
return platformVersion.getMajorVersion() > 2
|| (platformVersion.getMajorVersion() == 2 && platformVersion.getMinorVersion() >= 5);
return isAbovePlatformVersion(platformVersion, 2, 5);
}

private boolean isAbovePlatformVersion(Version platformVersion, int majorVersion, int minorVersion) {
return platformVersion.getMajorVersion() > majorVersion
|| (platformVersion.getMajorVersion() == majorVersion && platformVersion.getMinorVersion() >= minorVersion);
}


/**
* name of sql dump file is unknown, so wipe all files with 'sql' extension
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ version: "3.7"

services:
db:
image: mariadb:10.8.2
image: mariadb:10.11.7
command: "mysqld --character-set-server=utf8 --collation-server=utf8_general_ci"
environment:
MYSQL_DATABASE: openmrs
MYSQL_USER: ${OPENMRS_DB_USER:-openmrs}
MYSQL_PASSWORD: ${OPENMRS_DB_PASSWORD:-openmrs}
MYSQL_USER: ${OMRS_DB_USER:-openmrs}
MYSQL_PASSWORD: ${OMRS_DB_PASSWORD:-openmrs}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-openmrs}
volumes:
- db-data:/var/lib/mysql
Expand All @@ -24,8 +24,7 @@ services:
OMRS_CONFIG_AUTO_UPDATE_DATABASE: "true"
OMRS_CONFIG_CREATE_TABLES: "true"
OMRS_CONFIG_CONNECTION_SERVER: db
OMRS_CONFIG_CONNECTION_URL: ${OPENMRS_DB_URL:-jdbc:mysql://localhost:3306/openmrs}
OMRS_CONFIG_CONNECTION_DATABASE: ${OPENMRS_DB_NAME:-openmrs}
OMRS_CONFIG_CONNECTION_DATABASE: openmrs
OMRS_CONFIG_CONNECTION_USERNAME: ${OPENMRS_DB_USER:-openmrs}
OMRS_CONFIG_CONNECTION_PASSWORD: ${OPENMRS_DB_PASSWORD:-openmrs}
healthcheck:
Expand Down
10 changes: 10 additions & 0 deletions maven-plugin/src/main/resources/build-distro/web/Dockerfile-jre11
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Docker configuration automatically generated by openmrs SDK

FROM openmrs/openmrs-core:nightly-amazoncorretto-11

COPY openmrs_core/openmrs.war /openmrs/distribution/openmrs_core/
COPY openmrs-distro.properties /openmrs/distribution/
COPY openmrs_modules /openmrs/distribution/openmrs_modules
COPY openmrs_owas /openmrs/distribution/openmrs_owas
COPY openmrs_config /openmrs/distribution/openmrs_config
COPY openmrs_spa /openmrs/distribution/openmrs_spa
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openmrs/openmrs-core:nightly-amazoncorretto-11

COPY openmrs_core/openmrs.war /openmrs/distribution/openmrs_core/
COPY openmrs-distro.properties /openmrs/distribution/
27 changes: 7 additions & 20 deletions maven-plugin/src/main/resources/build-distro/web/Dockerfile-jre8
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
FROM tomcat:7-jre8

# Docker configuration automatically generated by openmrs SDK

COPY openmrs.war /usr/local/tomcat/webapps/openmrs.war
COPY modules /usr/local/tomcat/.OpenMRS/modules
COPY owa /usr/local/tomcat/.OpenMRS/owa

COPY setenv.sh /usr/local/tomcat/bin/setenv.sh

COPY wait-for-it.sh /usr/local/tomcat/wait-for-it.sh
COPY startup.sh /usr/local/tomcat/startup.sh

RUN sed -i '/Connector port="8080"/a URIEncoding="UTF-8" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"' /usr/local/tomcat/conf/server.xml

RUN chmod +x /usr/local/tomcat/wait-for-it.sh
RUN chmod +x /usr/local/tomcat/startup.sh

# For documentation purpose only
COPY openmrs-distro.properties /root/openmrs-distro.properties
COPY Dockerfile /root/Dockerfile
FROM openmrs/openmrs-core:nightly-amazoncorretto-8

CMD ["/usr/local/tomcat/startup.sh"]
COPY openmrs_core/openmrs.war /openmrs/distribution/openmrs_core/
COPY openmrs-distro.properties /openmrs/distribution/
COPY openmrs_modules /openmrs/distribution/openmrs_modules
COPY openmrs_owas /openmrs/distribution/openmrs_owas
COPY openmrs_config /openmrs/distribution/openmrs_config
COPY openmrs_spa /openmrs/distribution/openmrs_spa
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
FROM tomcat:7-jre8
FROM openmrs/openmrs-core:nightly-amazoncorretto-8

# Docker configuration automatically generated by openmrs SDK

COPY openmrs.war /usr/local/tomcat/webapps/openmrs.war

COPY setenv.sh /usr/local/tomcat/bin/setenv.sh

COPY wait-for-it.sh /usr/local/tomcat/wait-for-it.sh
COPY startup.sh /usr/local/tomcat/startup.sh

RUN sed -i '/Connector port="8080"/a URIEncoding="UTF-8" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"' /usr/local/tomcat/conf/server.xml

RUN chmod +x /usr/local/tomcat/wait-for-it.sh
RUN chmod +x /usr/local/tomcat/startup.sh

# For documentation purpose only
COPY openmrs-distro.properties /root/openmrs-distro.properties
COPY Dockerfile /root/Dockerfile

CMD ["/usr/local/tomcat/startup.sh"]
COPY openmrs_core/openmrs.war /openmrs/distribution/openmrs_core/
COPY openmrs-distro.properties /openmrs/distribution/
Loading