Skip to content

Fix. Healthcheck params for OpenELIS and Odoo DB containers #983

Fix. Healthcheck params for OpenELIS and Odoo DB containers

Fix. Healthcheck params for OpenELIS and Odoo DB containers #983

name: Deploy to Bahmni Standard Docker Env
on:
push:
branches:
- master
paths:
- 'bahmni-standard/**'
- '.github/workflows/bahmni_standard_docker_env.yaml'
repository_dispatch:
types:
- bahmni-helm-publish-event
- openmrs-db-publish-event
- openelis-publish-event
- odoo16-publish-event
- odoo-connect-publish-event
- dcm4chee-pacs-publish-event
- bahmni-proxy-publish-event
- bahmni-ipd-microfrontend-event
workflow_dispatch:
inputs:
update_bahmni_option:
description: 'Choose the option to update Bahmni. "Update without removing volumes" or "Update and remove volumes"'
required: true
type: choice
default: update_without_removing_volumes
options:
- update_without_removing_volumes
- update_and_remove_volumes
env:
UPDATE_BAHMNI_OPTION: ${{ github.event.inputs.update_bahmni_option || 'update_without_removing_volumes'}}
jobs:
deploy:
name: Deploy to Remote Instance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.BAHMNI_AWS_ID }}
aws-secret-access-key: ${{ secrets.BAHMNI_AWS_SECRET }}
aws-region: ap-south-1
role-to-assume: ${{ secrets.BAHMNI_INFRA_ADMIN_ROLE }}
role-duration-seconds: 1200 # 20 mins
role-session-name: BahmniInfraAdminSession
- name: Create/Update Containers
run: |
if [ "$UPDATE_BAHMNI_OPTION" == "update_without_removing_volumes" ]; then
command="docker compose --env-file .env.dev up -d"
elif [ "$UPDATE_BAHMNI_OPTION" == "update_and_remove_volumes" ]; then
command="docker compose --env-file .env.dev down -v && docker compose --env-file .env.dev up -d"
fi
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=bahmni-standard-docker" "Name=instance-state-name,Values=running" --query "Reservations[].Instances[].InstanceId" --output text)
if [ -z "$INSTANCE_ID" ]; then
echo "Instance not running"
else
aws ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name "AWS-RunShellScript" \
--comment "Update running containers" \
--parameters '{
"commands": [
". /home/ubuntu/.bash_profile",
"git pull -r",
"docker compose --env-file .env.dev pull",
"'"$command"'",
"docker compose --env-file .env.dev restart proxy",
"docker image prune -f"
],
"workingDirectory": [
"/home/ubuntu/bahmni-docker/bahmni-standard"
]
}' | jq '.Command | {CommandId: .CommandId, Parameters: .Parameters, Status: .Status}'
fi