This repo installs Harbor registry repo. https://goharbor.io/
Harbor is an open source registry that secures artifacts with policies and role-based access control, ensures images are scanned and free from vulnerabilities, and signs images as trusted.
I have concentrated more on TDD with infrastructure and deploying a simple app. You can find the architectural diagram under Diagram folder.
Packer : For building image for harbor. http://packer.io/ Terraform: For deploying resources in AWS. https://www.terraform.io/ Conftest: For unit testing .tf files in order to enforce policies and checks. (https://www.conftest.dev/) Terratest: For end to end testing which will verify, post the resources are deployed whether the dns url is accessible and return the correct statusCode.(https://terratest.gruntwork.io/)
You must have a valid AWS account. Your must create a hosted zone in AWS Route53 before proceeding with the deployment automation.
Steps to deploy it in AWS :
https://www.packer.io/ Install packer and then run the following command from the demo-harbor/ami folder. Make sure to set AWS credentials in environment variable:
packer build --var-file=setting-aws.json image.json
This command will create a base image. You will find a new image in the AMI of your region.
I have used Conftest (https://www.conftest.dev/) for unit testing and enforcing policies. It uses rego language I have created a Makefile To run unit tests run : make unit.
I have used this to test the the variables are properly set and to test some overall logic. To run contract testing run: make contract.
I have used Terratest(https://terratest.gruntwork.io/) to do terraform init, terraform apply and terraform destroy. It also checks if the external url is accessible and it return the correct status code. To run integration testing run: make integration.
Run: make apply to deploy the infrastructure. This will in turn cann terraform apply
After the infrasturucture is deployed, you can access the horbor server using the dns. This is the landing page you will see:
