Skip to content

Application Deployment

Ben Matern edited this page Jan 27, 2022 · 12 revisions

Up the version.

  • Version is in pom.xml.
  • Is it committed to the proper branch? Probably we're deploying the "develop" branch

Build application using Maven

Put build artifact on aws s3

  • setup aws cli locally (first time only)
  • run aws configure (user api keyand password must be known)
  • copy file to aws s3 bucket
    • aws s3 cp ihiw-management-1.0.2.jar s3://ihiw.management.build.artifacts/

Add keys to keychain (directory with .pem keyfiles)

  • ssh-add -D
  • ssh-add -k *

Run application on aws instance

  • access bastion instance via ssh
    • ssh -A ec2-user@aws.ihiws.org
  • access ihiw app server instance [STAGING 10.0.1.60; PROD 10.0.2.207]
    • ssh -A ec2-user@[server-IP]
  • fetch build artifact from S3
    • sudo -s
    • cd /usr/local/ihiw
    • aws s3 cp s3://ihiw.management.build.artifacts/ihiw-management-1.0.2.jar .
  • start/stop ihiw app
    • run stop.sh
    • adjust softlink to new build artifact: ln -sf ihiw-management-1.0.2.jar ihiw-management-app
    • run start.sh
    • start.sh: #!/bin/bash java -jar ihiw-management-app --spring.config.location=classpath:/config/application.yml,file:/usr/local/ihiw/application-prod.yml --spring.profiles.active=prod >> output.log 2>&1 & echo $! > ./pid.file &
    • stop.sh: #!/bin/bash kill $(cat ./pid.file)