From 543a7f9c7cc58d6b4b921a18e20e1989d206367d Mon Sep 17 00:00:00 2001 From: himeshr Date: Tue, 10 Dec 2024 12:33:21 +0530 Subject: [PATCH] #813 | Remove rpm related ciconfig and make commands --- .circleci/config.yml | 71 ++---------------------------- Makefile | 3 -- avni-server-api/build.gradle | 1 - avni-server-api/rpm.gradle | 83 ------------------------------------ 4 files changed, 3 insertions(+), 155 deletions(-) delete mode 100644 avni-server-api/rpm.gradle diff --git a/.circleci/config.yml b/.circleci/config.yml index 66e9de6a2..db95661aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,46 +4,6 @@ orbs: aws-cli: circleci/aws-cli@4.1.1 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: @@ -160,20 +120,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: @@ -240,14 +191,6 @@ jobs: - deploy_as_service: env: "staging" - UAT_deploy: - docker: - - image: cimg/openjdk:21.0 - working_directory: ~/ - steps: - - deploy: - hostname: "ssh.uat.openchs.org" - PRERELEASE_deploy: docker: - image: cimg/deploy:2023.09 @@ -264,7 +207,7 @@ jobs: PERF_deploy: docker: - - image: cimg/openjdk:21.0 + - image: cimg/deploy:2023.09 working_directory: ~/ steps: - aws-cli/setup: @@ -273,8 +216,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: @@ -351,14 +294,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: diff --git a/Makefile b/Makefile index 2cfe4050e..f201ee33c 100644 --- a/Makefile +++ b/Makefile @@ -184,9 +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 - # exec-sql: ## Usage: make exec-sql sqlfile= psql -Uopenchs -f $(sqlfile) diff --git a/avni-server-api/build.gradle b/avni-server-api/build.gradle index 3a69d942e..593c69c4b 100644 --- a/avni-server-api/build.gradle +++ b/avni-server-api/build.gradle @@ -24,7 +24,6 @@ ext { springBootVersion = '3.3.5' } apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'idea' -apply from: 'rpm.gradle' apply plugin: 'io.spring.dependency-management' java { diff --git a/avni-server-api/rpm.gradle b/avni-server-api/rpm.gradle deleted file mode 100644 index 876aa4394..000000000 --- a/avni-server-api/rpm.gradle +++ /dev/null @@ -1,83 +0,0 @@ -import groovy.json.JsonSlurper - -apply plugin: "com.netflix.nebula.ospackage" - -ospackage { - packageName = 'avni-server' - release = System.env.CIRCLE_BUILD_NUM ?: 0 - version = "${project.version.replace('-SNAPSHOT', '')}" - arch = NOARCH - os = LINUX - user = 'root' - - signingKeyId("72845CB15D05862A") - signingKeyPassphrase("$System.env.KEY_PASSWORD") - - conflicts("java-1.7.0-openjdk") - requires("java-1.21.0-openjdk") - preInstall file("${project.rootProject.rootDir}/infra/rpm/scripts/preInstall.sh") - postInstall file("${project.rootProject.rootDir}/infra/rpm/scripts/postInstall.sh") - preUninstall file("${project.rootProject.rootDir}/infra/rpm/scripts/preUninstall.sh") - postUninstall file("${project.rootProject.rootDir}/infra/rpm/scripts/postUninstall.sh") - - into '/opt/openchs' - - from(bootJar.outputs.files) { - rename { String fileName -> - fileName.replace("-${project.version}", "") - } - fileMode = 0644 - createDirectoryEntry = true - into 'bin/' - } - - from("${project.rootProject.rootDir}/infra/rpm/config/openchs.conf") { - createDirectoryEntry = true - into 'config' - include('openchs.conf') - } - - - from("${project.rootProject.rootDir}/infra/rpm/service/openchs.pid") { - fileMode = 0644 - createDirectoryEntry = true - into 'run' - } - - from("${project.rootProject.rootDir}/infra/rpm/service/openchs.log") { - fileMode = 0644 - createDirectoryEntry = true - into 'log' - } - - from("${project.rootProject.rootDir}/infra/rpm/service/openchs") { - fileMode = 0644 - createDirectoryEntry = true - into 'scripts' - } - - from("${project.rootProject.rootDir}/infra/rpm/service/start.sh") { - fileMode = 0644 - createDirectoryEntry = true - into 'scripts' - } -} - -buildRpm { - dependsOn 'build' -} - -task uploadRpm { - dependsOn buildRpm - def rpmName = buildRpm.assembleArchiveName() - def rpmVersion = buildRpm.release - def rpmFilePath = buildRpm.outputs.files.singleFile.getAbsolutePath() - doLast { - def minorVersionFile = new File("$project.rootProject.rootDir/minor_version") - def majorVersionFile = new File("$project.rootProject.rootDir/major_version") - minorVersionFile.createNewFile() - majorVersionFile.createNewFile() - minorVersionFile.text = "$buildRpm.release" - majorVersionFile.text = "$buildRpm.version" - } -}