Creating an executable zip file and uploading the file via terraform to AWS.
- Run make:
cd /src/facet/api
make
- Run AWS Serverless Application Model (SAM) from the root directory of the project:
sam local start-api --port 3002 --env-vars env.json
- Terraform is called a GH action.
go test
You can access JMeter tests via the S3
link: https://cdn.facet.ninja/test/api/regression/PUT_THE_CI_NUMBER_HERE/index.html
,
i.e: https://cdn.facet.ninja/test/api/regression/88/index.html
.
Environment variables are declared in both SAM (local development) and terraform modules (all the other environments). These are the steps to declare an environment variable:
- Declaring the variable under Parameters:
MY_VARIABLE:
Type: String
Description: An example variable
Default: This is the default example
- Passing it into the lambda environment by reference:
Environment:
Variables:
MY_VARIABLE: !Ref MY_VARIABLE
- Adding the actual value in
env.json
:
{
"API": {
"MY_VARIABLE": "This variable was loaded from env.json"
}
}
- Reading it in the application:
fmt.Println(os.Getenv("MY_VARIABLE"))
- Declaring it in the terraform module lambda.tf:
environment_variables = {
MY_VARIABLE = "This variable was loaded in Terraform"
}
Read here for more about this pattern.
Everytime there is an environment variable change, please add its name and description at env-example-template.json.
Go: 1.15.2
Java: 15
Docker desktop: 2.5
TF version: 0.13.5
For deploying to the test
environment, run terraform apply
with current directory being ./deploy
. You will need to
have preconfigured SSH keys to access GH
repos. Follow this guide
to generate SSH keys and upload them to GH.
Setup Tomcat server for locally debugging the https://github.com/facets-io/my-website-facets.io. Use Intellij's Artifact
plugin and run it through the Tomcat debugger. Change the hosts
file to map localhost with an example domain
i.e.: 127.0.0.1 example-website.facet.run
.