Infrastructure as Code for the GC Forms environment.
Pull Requests in this repository require all commits to be signed before they can be merged. Please see this guide for more information.
Docker Hub or Colima
Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Terragrunt:
brew install warrensbox/tap/tfswitch
tfswitch 1.9.8
brew install warrensbox/tap/tgswitch
tgswitch 0.69.0
Yarn (if you want to deploy the infrastructure locally):
$ brew install yarn
(source https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable)
awslocal (if you want to deploy the infrastructure locally):
$ brew install awscli-local
(source https://formulae.brew.sh/formula/awscli-local)
OR
$ pip install awscli-local
brew install docker docker-compose docker-credential-helper
Modify the docker config file to use mac os keychain as credStore
nano ~/.docker/config.json
{
...
"credsStore": "osxkeychain",
...
}
brew install colima
# as /var/ is a protected directory, we will need sudo
sudo ln ~/.colima/default/docker.sock /var/run
# we can verify this has worked by running
ls /var/run
# and confirming that docker.sock is now in the directory
Colima can be set as a service to start on login: brew services start colima
You will need to create a Localstack account using your CDS email address here and then ask your supervisor to assign you a Pro license license.
Create an .env
file at the root of the project and use the .env.example
as a template. You can find some of the values in 1Password > Local Development .ENV secure note.
The LOCALSTACK_AUTH_TOKEN
value will be accessible here once you have been assigned a Pro license.
$ docker-compose up
Once Localstack is ready to use you should be able to interact with local AWS services using the Localstack web application.
If the Localstack web application is not able to connect to the instance you just started you may have to add 127.0.0.1 localhost.localstack.cloud
to your /etc/hosts
.
Now that we have localstack up and running it's time to deploy our local AWS services to mimic our cloud environments.
$ ./localstack_services.sh
Please note that if you stop Localstack you don't need to run this script again.
Localstack Pro offers automatic persistence for all deployed services. This is enabled by default and can be tweaked through your .env
file.
Congratulations! You should now have all the necessary infrastructure configured on Localstack to support all the web applications functions completely locally without needing an AWS account.
$ awslocal lambda invoke --function-name <name_of_the_function> output.txt
In case you want to invoke a function that expects a specific payload you can pass it using the --payload '{}'
argument.
The deps.sh
script allows you to download required dependencies for all Lambda packages available under /lambda-code
.
$ cd lambda-code/
$ ./deps.sh install
Once you have changed the code in one or multiple Lambda packages, you can call the deploy-lambda-images.sh
. It will build, tag and push all Lambda images to ECR as well as letting the Lambda service know that a new version of the code should be used.
$ cd lambda-code/
$ ./deploy-lambda-images.sh
There is a skip
argument you can pass to that script if you only want to deploy the Lambda images for which you have made changes. It uses the git diff HEAD .
command in every single Lambda folder to know whether the image should be deployed or skipped
This Index supports the archiving of Vault responses
This Index supports the future feature of the Retrieval API. Essentially the ability to retrieve responses without using the Application Interface.
This Index supports the Nagware feature. It gives the ability to retrieve form submissions with a specific status and creation date.