From 2e2f1ab9546732512c99a706530260e3c7fc5618 Mon Sep 17 00:00:00 2001 From: Joy A Date: Wed, 15 Nov 2023 14:46:56 +0530 Subject: [PATCH] avniproject/avni-product#1433 | Deploy to new staging (cherry picked from commit 3b678f02ba016a347d8473b7b5e9557d07dfcea1) --- .circleci/config.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a3986b112..22daee03d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,6 +41,43 @@ commands: sudo rm -rf /tmp/avni-server.rpm EOF + deploy_as_service: + description: Deployment of avni-server as a systemd service + parameters: + env: + type: string + default: "staging" + 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 +# sudo pip3 install ansible + + - run: curl -L https://github.com/avniproject/avni-infra/archive/master.zip >> ~/infra.zip + + - run: | + cd ~/ + unzip infra.zip + mv avni-infra-master avni-infra + rm -rf infra.zip + + - run: echo $ANSIBLE_VAULT_PASS > ~/.vault-pass.txt + + - run: | + pwd + cd ~/avni-infra/configure + VAULT_PASSWORD_FILE=~/.vault-pass.txt app_zip_path=~/artifacts/ make deploy-avni-server-<< parameters.env >> + + - run: rm ~/.vault-pass.txt + jobs: test: docker: @@ -185,6 +222,14 @@ jobs: - deploy: hostname: "ssh.staging.openchs.org" + NEW_STAGING_deploy: + docker: + - image: cimg/deploy + working_directory: ~/ + steps: + - deploy_as_service: + env: "staging" + UAT_deploy: docker: - image: circleci/openjdk:8-jdk @@ -250,6 +295,14 @@ workflows: context: non-prod-deploy requires: - STAGING_approve + - NEW_STAGING_approve: + type: approval + requires: + - build + - NEW_STAGING_deploy: + context: non-prod-deploy + requires: + - NEW_STAGING_approve - UAT_approve: type: approval requires: