Skip to main content

GitHub Actions for Jersey Webservice Deployments

Jersey webservice deployment on AWS through HashiCorp is an opinionated GitHub Action that

  1. packages webservice WAR file into and registers AMI image on AWS, then
  2. deploys an EC2 instance of that AMI onto AWS

How to Use

---
name: My CI/CD

jobs:
hashicorp:
name: Generated Webservice WAR in GitHub Action, and Publish Template AMI Image and Deploy it to EC2 through HashiCorp
runs-on: ubuntu-latest
steps:
- name: Deployment
uses: QubitPi/jersey-webservice-deployment@master
with:
template: basic
ssl: false

aws-ws-pkrvars-hcl: ${{ secrets.AWS_WS_PKRVARS_HCL }}
aws-ws-tfvars: ${{ secrets.AWS_WS_TFVARS }}

aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

The following inputs are required:

The following GitHub Secrets needs to be defined:

Jersey Webservice Template (JPA through Elide)

If deployed webservice is JWT JPA the following inputs are also required

  • model-package-jar-group-id is the Maven group ID of JAR containing data models, e.g. "com.myorg"
  • model-package-jar-artifact-id is the Maven artifact ID of JAR containing data models, e.g. "my-data-models"
  • model-package-jar-version is the version of JAR containing data models, e.g. "3.1.7"
  • models-path is the relative path to the data models repo, usually prefixed by "../". e.g. "../jpa-models"

For example:

---
name: My CI/CD

jobs:
hashicorp:
name: Generated Webservice WAR in GitHub Action, and Publish Template AMI Image and Deploy it to EC2 through HashiCorp
runs-on: ubuntu-latest
steps:
- name: Deployment
uses: QubitPi/jersey-webservice-deployment@master
with:
template: basic
ssl: false

aws-ws-pkrvars-hcl: ${{ secrets.AWS_WS_PKRVARS_HCL }}
aws-ws-tfvars: ${{ secrets.AWS_WS_TFVARS }}

aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

model-package-jar-group-id: com.myorg
model-package-jar-artifact-id: my-data-models
model-package-jar-version: 1.0.0
models-path: ../my-data-models