Skip to content

Commit

Permalink
#813 | Merge java-upgrade into master
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Dec 13, 2024
2 parents cb71524 + c05eb76 commit 68c5022
Show file tree
Hide file tree
Showing 474 changed files with 2,578 additions and 2,955 deletions.
79 changes: 7 additions & 72 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,6 @@ orbs:
aws-cli: circleci/[email protected]

commands:
deploy:
description: Deployment of server
parameters:
hostname:
type: string
default: "ssh.staging.openchs.org"
steps:
- attach_workspace:
at: ~/artifacts

- run: sudo apt-get install make openssl

- run:
name: Install dependencies
command: |
sudo apt-get -y -qq update
sudo apt-get -y -qq install python3-pip
sudo pip3 install awscli --upgrade
- run:
name: Copy build to server
command: |
scp -o StrictHostKeyChecking=no ~/artifacts/avni-server-*.noarch.rpm ec2-user@<< parameters.hostname >>:/tmp/avni-server.rpm
- run:
name: Deploy server
command: |
ssh -o StrictHostKeyChecking=no ec2-user@<< parameters.hostname >> \<< EOF
sudo service openchs stop 2>&1 >/dev/null
sleep 5
sudo yum clean all 2>&1 >/dev/null
sudo rm -rf /var/cache/yum 2>&1 >/dev/null
sudo yum -y updateinfo 2>&1 >/dev/null
sudo yum -y remove avni-server openchs-server java-1.7.0-openjdk 2>&1 >/dev/null
sudo yum -y install /tmp/avni-server.rpm 2>&1 >/dev/null
sudo service openchs start 2>&1 >/dev/null
sleep 20
sudo rm -rf /tmp/avni-server.rpm
EOF
deploy_as_service:
description: Deployment of avni-server as a systemd service
parameters:
Expand Down Expand Up @@ -94,7 +54,7 @@ commands:
jobs:
test:
docker:
- image: circleci/openjdk:8-jdk
- image: cimg/openjdk:21.0

- image: circleci/postgres:12.7
environment:
Expand Down Expand Up @@ -133,7 +93,7 @@ jobs:
destination: testReports
build:
docker:
- image: circleci/openjdk:8-jdk
- image: cimg/openjdk:21.0
resource_class: medium

working_directory: ~/avni-server
Expand All @@ -151,7 +111,7 @@ jobs:

- run: sudo apt-get install make openssl

- run: make upload-rpm
- run: make build_server

- save_cache:
paths:
Expand All @@ -162,20 +122,11 @@ jobs:

- run: mkdir -p ~/artifacts;

- run: cp minor_version ~/artifacts/minor_version;

- run: cp major_version ~/artifacts/major_version;

- run: cp ~/avni-server/avni-server-api/build/distributions/avni-server-*.noarch.rpm ~/artifacts/;

- run: cp ~/avni-server/avni-server-api/build/libs/avni-server-*.jar ~/artifacts/;

- persist_to_workspace:
root: ~/artifacts
paths:
- minor_version
- major_version
- avni-server-*.noarch.rpm
- avni-server-*.jar

- store_artifacts:
Expand Down Expand Up @@ -242,14 +193,6 @@ jobs:
- deploy_as_service:
env: "staging"

UAT_deploy:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/
steps:
- deploy:
hostname: "ssh.uat.openchs.org"

PRERELEASE_deploy:
docker:
- image: cimg/deploy:2023.09
Expand All @@ -266,7 +209,7 @@ jobs:

PERF_deploy:
docker:
- image: circleci/openjdk:8-jdk
- image: cimg/deploy:2023.09
working_directory: ~/
steps:
- aws-cli/setup:
Expand All @@ -275,8 +218,8 @@ jobs:
- setup_server_access:
instance-id: "i-0f30399b30e24a49b"
availability-zone: "ap-south-1a"
- deploy:
hostname: "ssh.perf.avniproject.org"
- deploy_as_service:
env: "prerelease"

PROD_deploy:
docker:
Expand Down Expand Up @@ -334,7 +277,7 @@ workflows:
- build:
<<: *tags_filter
requires:
- test
- test
- build_docker_image:
context:
- dockerhub
Expand All @@ -353,14 +296,6 @@ workflows:
context: non-prod-deploy
requires:
- STAGING_approve
- UAT_approve:
type: approval
requires:
- build
- UAT_deploy:
context: non-prod-deploy
requires:
- UAT_approve
- PRERELEASE_approve:
type: approval
requires:
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8
21.0
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,6 @@ open_test_results:
open avni-server-api/build/reports/tests/test/index.html
open-test-results: open_test_results

build-rpm:
./gradlew clean avni-server-api:buildRpm -x test --info --stacktrace

upload-rpm:
@openssl aes-256-cbc -a -md md5 -in infra/rpm/keys/openchs.asc.enc -d -out infra/rpm/keys/openchs.asc -k ${ENCRYPTION_KEY}
-rm -rf avni-server-api/build
./gradlew clean avni-server-api:uploadRpm -x test --info --stacktrace --rerun-tasks

# <exec-sql>
exec-sql: ## Usage: make exec-sql sqlfile=</path/to/sql>
psql -Uopenchs -f $(sqlfile)
Expand All @@ -200,3 +192,6 @@ exec-sql: ## Usage: make exec-sql sqlfile=</path/to/sql>
# remote
tail-prod:
ssh avni-prod "tail -f /var/log/avni_server/chs.log"

show-dependency-graph:
./gradlew avni-server-api:dependencies
122 changes: 70 additions & 52 deletions avni-server-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext {
springBootVersion = '2.0.0.RELEASE'
osPackageVersion = "6.2.1"
springBootVersion = '3.3.5'
osPackageVersion = "11.10.0"
}
repositories { mavenCentral() }
dependencies {
Expand All @@ -12,86 +12,104 @@ buildscript {

plugins {
id 'org.springframework.boot' version "${springBootVersion}"
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id "nebula.ospackage" version "6.2.1"
id 'io.spring.dependency-management' version '1.1.6'
id "com.netflix.nebula.ospackage" version "11.10.0"
id 'java'
}

ext { springBootVersion = '2.0.0.RELEASE' }
ext { springBootVersion = '3.3.5' }
//todo: Remove when upgrading Spring version. This was introduced to use SameSiteCookies
ext['tomcat.version'] = '9.0.80'
//ext['tomcat.version'] = '9.0.80'

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
apply from: 'rpm.gradle'
apply plugin: 'io.spring.dependency-management'

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

repositories { mavenCentral() }

bootJar {
baseName = "avni-server"
archiveBaseName = "avni-server"
version = "0.0.1-SNAPSHOT"
mainClassName = 'org.avni.Avni'
mainClass = 'org.avni.Avni'
}

configurations {
dev
all*.exclude group: 'org.slf4j', module: 'slf4j-reload4j'
all*.exclude group: 'org.slf4j', module: 'slf4j-simple'
}

dependencies {
compile group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '8.5.46'
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-data-rest:${springBootVersion}"
compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
implementation group: 'org.apache.tomcat', name: 'tomcat-jdbc'
implementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
implementation "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-data-rest:${springBootVersion}"
implementation("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
testImplementation "com.github.tomakehurst:wiremock-jre8-standalone:2.34.0"
compile "org.postgresql:postgresql:9.4-1200-jdbc41"
implementation 'org.springframework.boot:spring-boot-starter-batch'
testImplementation 'org.springframework.batch:spring-batch-test'
compile "joda-time:joda-time:2.9.4"
compile group: 'org.jadira.usertype', name: 'usertype.core', version: '6.0.1.GA'
compile "org.flywaydb:flyway-core:4.0.3"
compile "org.flywaydb.flyway-test-extensions:flyway-spring-test:4.0"
compile "com.zaxxer:HikariCP:2.5.1"
compile "org.apache.poi:poi:3.16-beta2"
compile "org.apache.poi:poi-ooxml:3.16-beta2"
compile 'org.apache.httpcomponents:httpclient:4.5.9'
compile 'com.auth0:jwks-rsa:0.3.0'
compile 'com.auth0:java-jwt:3.3.0'
compile group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.9.2.Final'
compile 'com.bugsnag:bugsnag:3.+'
compile 'com.amazonaws:aws-java-sdk-s3'
compile 'com.amazonaws:aws-java-sdk-cognitoidp'
compile 'commons-validator:commons-validator:1.4.1'
compile 'org.passay:passay:1.6.3'
implementation "org.postgresql:postgresql"
implementation("org.springframework.boot:spring-boot-starter-batch:${springBootVersion}")
testImplementation 'org.springframework.batch:spring-batch-test:5.1.2'
implementation "joda-time:joda-time:2.10.10"
implementation("org.hibernate:hibernate-java8:5.6.15.Final") {
exclude(group: 'org.hibernate', module: 'hibernate-core')
}
runtimeOnly("javax.transaction:jta:1.1")
// implementation(group: 'org.jadira.usertype', name: 'usertype.core', version: '7.0.0.CR1') {
// exclude(group: 'org.hibernate', module: 'hibernate-core')
// }
implementation "org.flywaydb:flyway-core:10.20.1"
runtimeOnly("org.flywaydb:flyway-database-postgresql:10.20.1")
implementation "org.flywaydb.flyway-test-extensions:flyway-spring6-test:10.0.0"
implementation "com.zaxxer:HikariCP"
implementation "org.apache.poi:poi:3.16-beta2"
implementation "org.apache.poi:poi-ooxml:3.16-beta2"
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.3'
implementation 'com.auth0:jwks-rsa:0.3.0'
implementation 'com.auth0:java-jwt:3.3.0'
// implementation(group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.9.2.Final') {
// exclude(group: 'org.hibernate', module: 'hibernate-core')
// }
implementation 'com.bugsnag:bugsnag:3.+'
implementation 'com.amazonaws:aws-java-sdk-s3'
implementation 'com.amazonaws:aws-java-sdk-cognitoidp'
implementation 'commons-validator:commons-validator:1.4.1'
implementation 'org.passay:passay:1.6.3'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.keycloak:keycloak-spring-boot-starter:21.0.2'
implementation 'org.keycloak:keycloak-admin-client:21.0.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.6'
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.6'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.6'
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.12.6'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.6'
implementation 'org.hibernate:hibernate-ehcache:5.2.14.Final'
implementation 'org.keycloak:keycloak-spring-boot-starter:24.0.4'
implementation 'org.keycloak:keycloak-admin-client:24.0.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.4'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.4'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.4'
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.15.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.15.4'
implementation('org.hibernate:hibernate-ehcache:5.6.15.Final') {
exclude(group: 'org.hibernate', module: 'hibernate-core')
}
runtimeOnly("javax.xml.bind:jaxb-api:2.3.1")
runtimeOnly('org.ehcache:ehcache:3.10.8')
runtimeOnly("org.hibernate:hibernate-jcache:6.5.1.Final")
implementation 'javax.cache:cache-api:1.1.1'
dev "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
testCompile "org.mockito:mockito-core:2.23.4"
testCompile 'org.powermock:powermock-core:2.0.9'
testCompile 'org.powermock:powermock-api-mockito2:2.0.9'
testCompile 'org.powermock:powermock-module-junit4:2.0.9'
runtime("org.springframework.boot:spring-boot-properties-migrator")
testImplementation "org.mockito:mockito-core:3.12.4"
testImplementation 'org.powermock:powermock-core:2.0.9'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
runtimeOnly("org.springframework.boot:spring-boot-properties-migrator")
implementation 'org.apache.tika:tika-core:2.7.0'
compile 'org.owasp.encoder:encoder:1.2.3'
implementation 'org.owasp.encoder:encoder:1.2.3'
implementation 'org.apache.commons:commons-csv:1.10.0'
compile 'com.googlecode.libphonenumber:libphonenumber:8.12.32'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.32'
testImplementation 'org.slf4j:slf4j-reload4j:2.0.6'
compile 'com.google.guava:guava:33.2.1-jre'
implementation 'com.google.guava:guava:33.2.1-jre'
implementation 'org.codehaus.jettison:jettison:1.5.4'
}

bootRun {
Expand Down
Loading

0 comments on commit 68c5022

Please sign in to comment.