Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Update basic tempate (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Mar 4, 2024
1 parent f01d660 commit 35704a0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 65 deletions.
54 changes: 42 additions & 12 deletions templates/sd-template-basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,59 @@ name: jersey-webservice-release-definition-basic
version: '1.0.0'
description: |
Screwdriver CD template for deploying instantiated jersey webservice to AWS through HashiCorp.
This template deploys the webservices only without SSL/HTTPS or any other addons
This template deploys the webservices without SSL/HTTPS or any other addons
maintainer: jack20220723@gmail.com
config:
image: buildpack-deps:22.04-scm
parameters:
ami-region:
value: ["us-east-1", "us-east-2", "us-west-1", "us-west-2"]
description: "The AWS region where webservice AMI will be published to. The published image will be private"
ami-name:
value: "my-webservice-ami"
description: "The published AMI name; it can be arbitrary"
instance-type:
value: ["t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge"]
description: "The EC2 instance type to use when building an AMI as well as launching the instance"
aws-deploy-region:
value: ["us-east-1", "us-east-2", "us-west-1", "us-west-2"]
description: "The AWS region where webservice EC2 instance will be deployed into"
instance-name:
value: "My webservice instance"
description: "The deployed EC2 name as appeared in the instance list of AWS console; it can be arbitrary"
security-groups:
value: '["My WS Security Group 1", "My WS Security Group 2"]'
description: "The list of AWS Security Group names (yes, not ID, but name...) bound to the webservice EC2 instance."
ws-repo-git:
value: "https://github.com/QubitPi/jersey-webservice-template.git"
description: "The git URL to the repository of the webservice to be deployed"
steps:
- setup-jdk: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/QubitPi/hashicorp-aws/master/auxiliary/scripts/setup-jdk-ubuntu.sh)"
- install-maven: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/QubitPi/hashicorp-aws/master/auxiliary/scripts/install-maven-ubuntu.sh)"
- install-packer: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/QubitPi/hashicorp-aws/master/auxiliary/scripts/install-hashicorp-packer-ubuntu.sh)"
- install-terraform: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/QubitPi/hashicorp-aws/master/auxiliary/scripts/install-hashicorp-terraform-ubuntu.sh)"
- setup-jdk: sd-cmd exec QubitPi/install-jdk-ubuntu@latest
- install-maven: sd-cmd exec QubitPi/install-maven-ubuntu@latest
- install-packer: sd-cmd exec QubitPi/install-hashicorp-packer-ubuntu@latest
- install-terraform: sd-cmd exec QubitPi/install-hashicorp-terraform-ubuntu@latest

- checkout-hashicorp-deployment-tool: git clone --depth 1 https://github.com/QubitPi/hashicorp-aws.git ../hashicorp-aws

- setup-packer: cp ../hashicorp-aws/hashicorp/webservice/images/aws-ws.pkr.hcl ../hashicorp-aws/hashicorp/webservice/images/basic
- load-packer-variable-file: echo "$AWS_WS_PKRVARS_HCL" > ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
- load-packer-variable-file: |
echo ami_region = \"$(meta get parameters.ami-region.value)\" >> ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
echo ami_name = \"$(meta get parameters.ami-name.value)\" >> ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
echo instance_type = \"$(meta get parameters.instance-type.value)\" >> ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
echo ws_war_path = \"ROOT.war\" >> ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
echo aws_ws_filebeat_config_file_path = \"filebeat.yml\" >> ../hashicorp-aws/hashicorp/webservice/images/basic/aws-ws.auto.pkrvars.hcl
- load-terraform-variable-file: echo "$AWS_WS_TFVARS" > ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
- load-terraform-variable-file: |
echo aws_deploy_region = \"$(meta get parameters.aws-deploy-region.value)\" >> ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
echo ami_name = \"$(meta get parameters.ami-name.value)\" >> ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
echo instance_type = \"$(meta get parameters.instance-type.value)\" >> ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
echo ec2_instance_name = \"$(meta get parameters.instance-name.value)\" >> ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
echo ec2_security_groups = \"$(meta get parameters.security-groups.value)\" >> ../hashicorp-aws/hashicorp/webservice/instances/basic/aws-ws.auto.tfvars
- clone-webservice: echo "This step must be implemented by pipeline. Please see README doc for more info" && exit 1
- load-properties-file: echo "This step must be implemented by pipeline. Please see README doc for more info" && exit 1
- clone-webservice: git clone --depth 1 $(meta get parameters.ws-repo-git.value) ../ws

- generate-war: cd ../ws && mvn -B clean package -Dcheckstyle.skip -Dmaven.test.skip
- relocate-war-for-hashicorp: cd ../ws && mv target/*.war ../hashicorp-aws/hashicorp/webservice/images/basic
- relocate-war-for-hashicorp: cd ../ws && mv target/*.war ../hashicorp-aws/hashicorp/webservice/images/basic/ROOT.war

- packer-init: cd ../hashicorp-aws/hashicorp/webservice/images/basic && packer init .
- packer-validate: packer validate -var "skip_create_ami=true" .
Expand All @@ -47,7 +79,5 @@ config:
- terraform-validate: terraform validate
- terraform-apply: terraform apply -auto-approve
secrets:
- AWS_WS_PKRVARS_HCL
- AWS_WS_TFVARS
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
53 changes: 0 additions & 53 deletions templates/sd-template-jpa-behind-kong.yaml

This file was deleted.

0 comments on commit 35704a0

Please sign in to comment.