diff --git a/.github/workflows/tomcat_build_upload.yml b/.github/workflows/tomcat_build_upload.yml index 83887c8..2c4385a 100644 --- a/.github/workflows/tomcat_build_upload.yml +++ b/.github/workflows/tomcat_build_upload.yml @@ -5,12 +5,13 @@ on: - master paths: - "bahmni-embedded-tomcat/**" + - "bahmni-embedded-tomcat-10/**" - "gradle.properties" - ".github/workflows/tomcat_build_upload.yml" workflow_dispatch: jobs: - Trivy: + trivy: runs-on: ubuntu-latest steps: - name: Checkout code @@ -21,14 +22,15 @@ jobs: build-upload-artifact: name: Build and upload embedded Tomcat Server artifact runs-on: ubuntu-latest - needs: Trivy + needs: trivy steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: - java-version: 1.8 - - name: Generate Artifact + distribution: 'corretto' + java-version: '1.8' + - name: Generate Artifact for bahmni-embedded-tomcat run: ./gradlew :bahmni-embedded-tomcat:clean :bahmni-embedded-tomcat:build - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 @@ -36,5 +38,26 @@ jobs: aws-access-key-id: ${{ secrets.S3_MVN_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.S3_MVN_SECRET_KEY }} aws-region: ap-southeast-1 - - name: Upload Artifact + - name: Upload Artifact for bahmni-embedded-tomcat run: aws s3 cp bahmni-embedded-tomcat/build/libs/bahmni-embedded-tomcat-*.jar s3://repo.mybahmni.org/packages/build/ + + build-upload-artifact-10: + name: Build and upload embedded Tomcat 10 Server artifact + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'corretto' + java-version: '17' + - name: Generate Artifact for bahmni-embedded-tomcat-10 + run: mvn clean package -f bahmni-embedded-tomcat-10/pom.xml + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.S3_MVN_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.S3_MVN_SECRET_KEY }} + aws-region: ap-southeast-1 + - name: Upload Artifact for bahmni-embedded-tomcat-10 + run: aws s3 cp bahmni-embedded-tomcat-10/target/bahmni-embedded-tomcat-10-*.jar s3://repo.mybahmni.org/packages/build/ diff --git a/bahmni-embedded-tomcat-10/.gitignore b/bahmni-embedded-tomcat-10/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/bahmni-embedded-tomcat-10/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/bahmni-embedded-tomcat-10/pom.xml b/bahmni-embedded-tomcat-10/pom.xml new file mode 100644 index 0000000..39edfc8 --- /dev/null +++ b/bahmni-embedded-tomcat-10/pom.xml @@ -0,0 +1,96 @@ + + + 4.0.0 + + org.bahmni.deployment.launch + bahmni-embedded-tomcat-10 + 1.0-SNAPSHOT + pom + Bahmni Embedded Tomcat 10 + https://github.com/Bahmni/bahmni-package.git + Embedded Tomcat v10 For Bahmni Services + + + GNU AFFERO GENERAL PUBLIC LICENSE + https://www.gnu.org/licenses/agpl-3.0.txt + + + + + Bahmni + info@bahmni.org + Bahmni + https://github.com/Bahmni + + + + scm:git:git@github.com:Bahmni/bahmni-package.git + scm:git:git@github.com:Bahmni/bahmni-package.git + https://github.com/Bahmni/bahmni-package/tree/master/bahmni-embedded-tomcat-10/ + + + + 17 + 17 + UTF-8 + 10.1.24 + + + + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcatVersion} + + + org.apache.tomcat + tomcat-juli + ${tomcatVersion} + + + org.apache.tomcat.embed + tomcat-embed-jasper + ${tomcatVersion} + + + org.apache.tomcat + tomcat-jasper + ${tomcatVersion} + + + org.apache.tomcat + tomcat-jasper-el + ${tomcatVersion} + + + org.apache.tomcat + tomcat-jsp-api + ${tomcatVersion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + org.bahmni.deployment.launch.Main + + + + + + \ No newline at end of file diff --git a/bahmni-embedded-tomcat-10/src/main/java/org/bahmni/deployment/launch/Main.java b/bahmni-embedded-tomcat-10/src/main/java/org/bahmni/deployment/launch/Main.java new file mode 100644 index 0000000..f785164 --- /dev/null +++ b/bahmni-embedded-tomcat-10/src/main/java/org/bahmni/deployment/launch/Main.java @@ -0,0 +1,27 @@ +package org.bahmni.deployment.launch; + +import jakarta.servlet.ServletException; +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.startup.Tomcat; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +import static java.lang.System.getenv; + +public class Main { + public static void main(String[] args) throws NumberFormatException, NullPointerException, IllegalArgumentException, ServletException, LifecycleException, IllegalStateException, FileNotFoundException, IOException{ + Tomcat tomcat = new Tomcat(); + tomcat.setPort(Integer.parseInt(getenv("SERVER_PORT"))); + tomcat.setBaseDir(getenv("BASE_DIR")); + + Context context = tomcat.addWebapp(getenv("CONTEXT_PATH"), new File(getenv("WAR_DIRECTORY")).getAbsolutePath()); + context.setSessionTimeout(120); + context.setUseHttpOnly(false); + + tomcat.start(); + tomcat.getServer().await(); + } +}