Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workflow #331

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy-apm-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
# --no-execute-changeset \
# --no-fail-on-empty-changeset \
# --parameter-overrides \
# "LambdaHandler=index.kinesisStreamDummyHandler" \
# "KinesisStreamShardCount=$AWS_KINESIS_STREAM_SHARD_COUNT" \
# "OpensearchUrl=$AWS_OPENSEARCH_URL"

Expand All @@ -79,5 +80,6 @@ jobs:
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--parameter-overrides \
"LambdaHandler=index.kinesisStreamDummyHandler" \
"KinesisStreamShardCount=$AWS_KINESIS_STREAM_SHARD_COUNT" \
"OpensearchUrl=$AWS_OPENSEARCH_URL"
2 changes: 1 addition & 1 deletion .github/workflows/remove-apm-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ vars.AWS_REGION }}

- name: SAM destroy
- name: SAM delete
run: |
sam delete \
--stack-name nr-apm-stack \
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/run-workflow-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ jobs:
node-version: 18

- name: NPM install
run: npm ci
working-directory: ./workflow-cli

- name: Setup AWS SAM
uses: aws-actions/setup-sam@v2
with:
use-installer: true
run: npm ci

- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -40,6 +35,7 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}

- name: Build workflow
working-directory: ./workflow-cli
run: npm run build

- name: workflow-cli opensearch-sync
Expand Down
52 changes: 18 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,42 @@ https://bcdevops.github.io/nr-apm-stack/

# Getting Started

The product in deployed using Github actions. A Terraform cloud team server handles running the Terraform. A CI pipeline is setup to run static analysis of the Typescript.
The product runs using AWS services. The CI/CD pipeline uses Github actions.

## Built With

### AWS Services

* [Amazon OpenSearch Service](https://aws.amazon.com/opensearch-service)
* [Amazon Lambda](https://aws.amazon.com/lambda/)
* [Terraform](https://www.terraform.io)
* [Terragrunt](https://terragrunt.gruntwork.io)
* [Typescript](https://www.typescriptlang.org)
* [Amazon S3](https://aws.amazon.com/s3/)
* [Amazon Kinesis](https://aws.amazon.com/kinesis/)

### Deployment Stack

Notes:
* [Amazon SAM](https://aws.amazon.com/serverless/sam/)
* [Amazon Cloudformation](https://aws.amazon.com/cloudformation/)
* [Github Actions](https://github.com/features/actions)

### Languages

* [Typescript](https://www.typescriptlang.org)

* Terraform is limited in the objects it can manage by the AWS Landing Zone permissions.
* Github holds the keycloak secrets.
* The folder `terragrunt/<env>` holds most of the environment specific configuration.
## Local Deployment Setup

## Local Setup
If you want to run SAM locally, you will need to install the CLI. For production, running the deployment locally is not recommended.

If you want to run Terragrunt locally, you will need to setup a number of environment variables. Running the deployment locally is not recommended.
SAM requires that you setup a number of environment variables.

### AWS - Environment Variables

As documented in the [AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) which can be obtained from the [Cloud PathFinder login page](https://oidc.gov.bc.ca/auth/realms/umafubc9/protocol/saml/clients/amazon-aws) and clicking on "Click for Credentials" of the appropriate project/environment.
As documented in the [AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) which can be obtained from the [Cloud PathFinder login page](http://login.nimbus.cloud.gov.bc.ca/) and clicking on "Click for Credentials" of the appropriate project/environment.

- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_SESSION_TOKEN`
- `AWS_DEFAULT_REGION`

### Keycloak - Environment Variables

You will need a client service account with realm admin privilege.

- `KEYCLOAK_BASEURL`: The base URL ending with "/auth"
- `KEYCLOAK_REALM_NAME`
- `KEYCLOAK_CLIENT_ID`
- `KEYCLOAK_CLIENT_SECRET`

### Terraform cloud team token

You will need a terraform cloud team token, and have it setup in `~/terraform.d/credentials.tfrc.json`. The token is input using a secret for Github actions.

```
{
"credentials": {
"app.terraform.io": {
"token": "<TERRAFORM TEAM TOKEN>"
}
}
}
```

# Principles
- Infrastructure as Code
- Configuration as Code
Expand Down