Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bdd4329 committed Jan 27, 2024
0 parents commit 85cea10
Show file tree
Hide file tree
Showing 547 changed files with 88,464 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows-unused/ci-lambda-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI Lambda Rewrite Tests

on: pull_request

jobs:
terraform-localstack:
name: "CI: LocalStack Lambda Rewrite Tests"
runs-on: ubuntu-latest
env:
DEFAULT_REGION: us-east-1
AWS_ACCOUNT_ID: "000000000000"
AWS_ACCESS_KEY_ID: dummy-access-key
AWS_SECRET_ACCESS_KEY: dummy-secret-key

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.6

- name: Setup node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install zip if using nektos/act
run: apt-get update && apt-get install -y zip
if: ${{ env.ACT }}

- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install python modules
run: pip install -r ./localstack/requirements.txt

- name: Install docker-compose if using nektos/act
run: |
sudo curl -L https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
if: ${{ env.ACT }}

- name: Start LocalStack
working-directory: ./localstack
run: docker-compose up -d

- name: Run rewrite tests
working-directory: ./localstack
run: ./run_lambda_test.sh

- name: Report test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: localstack/testing_output/*.xml
report_individual_runs: "true"

- name: Stop LocalStack
working-directory: ./localstack
run: docker-compose down
if: always()
13 changes: 13 additions & 0 deletions .github/workflows/update-semver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Update Semver
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
update-semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: haya14busa/action-update-semver@v1
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
localstack/venv
localstack/testing_dir
localstack/testing_output
**/.terraform
**/sm-key*
.DS_Store
*.zip
22 changes: 22 additions & 0 deletions 1password.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Store the S3 access keys in 1password

data "onepassword_vault" "s3_vault" {
name = var.onepassword_vault
}

resource "onepassword_item" "s3_credentials" {
vault = data.onepassword_vault.s3_vault.uuid
title = local.domain
category = "login"
username = aws_iam_access_key.key.id
password = aws_iam_access_key.key.secret
url = local.domain

section {
label = "notes"
field {
label = "S3 Bucket"
value = aws_s3_bucket.bucket.bucket
}
}
}
7 changes: 7 additions & 0 deletions LambdaEdgeFunctions/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.9"
services:
build:
image: public.ecr.aws/lambda/nodejs:${LAMBDA_RUNTIME}
volumes:
- ./:/app
entrypoint: bash -c 'cd /app && npm install'
7 changes: 7 additions & 0 deletions LambdaEdgeFunctions/host_header/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.9"
services:
build:
image: public.ecr.aws/lambda/nodejs:${LAMBDA_RUNTIME}
volumes:
- ./:/app
entrypoint: bash -c 'cd /app && npm install'
14 changes: 14 additions & 0 deletions LambdaEdgeFunctions/host_header/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
module.exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const host = request.headers["host"][0].value;

// Add an alternate way for the origin request Lambda to get the host header
// without causing problems for S3 origin requests
request.headers["x-forwarded-host"] = [{
key: "X-Forwarded-Host",
value: host
}];

callback(null, request);
};
12 changes: 12 additions & 0 deletions LambdaEdgeFunctions/host_header/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "cascade-www-edge-host-headers",
"version": "1.0.0",
"description": "HTTP host headers addition for CloudFront requests",
"repository": "",
"author": "Blake Dworaczyk<blaked@tamu.edu>",
"license": "MIT",
"dependencies": {
},
"devDependencies": {
}
}
Loading

0 comments on commit 85cea10

Please sign in to comment.