Skip to content

Commit 0b02dd3

Browse files
authored
Merge branch 'main' into revamp-readme
2 parents b5fefca + 7285cce commit 0b02dd3

32 files changed

+948
-207
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ jobs:
2626
command:
2727
pip3 install -r requirements-dev.txt --upgrade
2828
- localstack/wait
29+
- run:
30+
name: Build lambdas
31+
command:
32+
bin/build_lambdas.sh
33+
2934
- run:
3035
name: Deploy infrastructure
3136
command:
32-
bin/deploy.sh
37+
deployment/awslocal/deploy.sh
38+
3339
- run:
3440
name: Export state
3541
command: localstack state export ls-state.zip
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "LocalStack DinD setup",
3+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
4+
5+
"remoteEnv": {
6+
// Activate LocalStack Pro: https://docs.localstack.cloud/getting-started/auth-token/
7+
"LOCALSTACK_AUTH_TOKEN": "${localEnv:LOCALSTACK_AUTH_TOKEN}", // required for Pro, not processed via template due to security reasons
8+
"LOCALSTACK_API_KEY": "${localEnv:LOCALSTACK_API_KEY}",
9+
// LocalStack configuration: https://docs.localstack.cloud/references/configuration/
10+
"ACTIVATE_PRO": true,
11+
"DEBUG": true,
12+
"LS_LOG": "trace",
13+
"PERSISTENCE": false,
14+
"AWS_ENDPOINT_URL": "http://localhost.localstack.cloud:4566",
15+
"AUTO_LOAD_POD": "",
16+
"ENFORCE_IAM": false,
17+
"AWS_REGION": "us-east-1",
18+
"AWS_DEFAULT_REGION": "us-east-1",
19+
"IMAGE_NAME": "localstack/localstack-pro:latest",
20+
"LOCALSTACK_VOLUME_DIR": "/data"
21+
},
22+
23+
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
24+
"features": {
25+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
26+
"ghcr.io/localstack/devcontainer-feature/localstack-cli:latest": {
27+
"version": "latest",
28+
"awslocal": true, // if true, add in features manually: ghcr.io/devcontainers/features/aws-cli
29+
"cdklocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/aws-cdk
30+
"pulumilocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/pulumi
31+
"samlocal": false, // if true, add in features manually: ghcr.io/customink/codespaces-features/sam-cli
32+
"tflocal": false // if true, add in features manually: ghcr.io/devcontainers-contrib/features/terraform-asdf
33+
},
34+
"ghcr.io/devcontainers/features/aws-cli:1": {},
35+
"ghcr.io/devcontainers/features/python:1": {
36+
"version": "3.11"
37+
}
38+
},
39+
40+
// 👇 Use 'postCreateCommand' to run commands after the container is created.
41+
"postCreateCommand": "type localstack; true && localstack start -d || true",
42+
"mounts": [
43+
{
44+
// to persist build data and images
45+
"source": "dind-var-lib-docker",
46+
"target": "/var/lib/docker",
47+
"type": "volume"
48+
},
49+
{
50+
"source": "./.volume",
51+
"target": "/data",
52+
"type": "bind",
53+
"consistency": "cached"
54+
}
55+
]
56+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Activate LocalStack Pro: https://docs.localstack.cloud/getting-started/auth-token/
2+
LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:-} # required for Pro, not processed via template due to security reasons
3+
LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY:-}
4+
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
5+
ACTIVATE_PRO=true
6+
DEBUG=true
7+
LS_LOG=trace
8+
PERSISTENCE=false
9+
AWS_ENDPOINT_URL=http://localhost.localstack.cloud:4566
10+
LOCALSTACK_HOST=localhost.localstack.cloud:4566
11+
AUTO_LOAD_POD=
12+
ENFORCE_IAM=false
13+
AWS_REGION=us-east-1
14+
AWS_DEFAULT_REGION=us-east-1
15+
IMAGE_NAME=localstack/localstack-pro:latest
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Keep this folder for DevContainers DooD setup
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM mcr.microsoft.com/devcontainers/base:bookworm
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "LocalStack DooD setup",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
7+
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
8+
"features": {
9+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
10+
"ghcr.io/localstack/devcontainer-feature/localstack-cli:latest": {
11+
"version": "latest",
12+
"awslocal": true, // if true, add in features manually: ghcr.io/devcontainers/features/aws-cli
13+
"cdklocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/aws-cdk
14+
"pulumilocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/pulumi
15+
"samlocal": false, // if true, add in features manually: ghcr.io/customink/codespaces-features/sam-cli
16+
"tflocal": false // if true, add in features manually: ghcr.io/devcontainers-contrib/features/terraform-asdf
17+
},
18+
"ghcr.io/devcontainers/features/aws-cli:1": {},
19+
"ghcr.io/devcontainers/features/python:1": {
20+
"version": "3.11"
21+
}
22+
}
23+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: "3.8"
2+
3+
services:
4+
localstack:
5+
container_name: "localstack-main"
6+
image: localstack/localstack-pro:latest # required for Pro
7+
ports:
8+
- "127.0.0.1:4566:4566" # LocalStack Gateway
9+
- "127.0.0.1:4510-4559:4510-4559" # external services port range
10+
- "127.0.0.1:443:443" # LocalStack HTTPS Gateway (Pro)
11+
env_file:
12+
- .env
13+
volumes:
14+
- "/var/run/docker.sock:/var/run/docker.sock"
15+
- "./.volume:/var/lib/localstack"
16+
networks:
17+
ls:
18+
# Set the container IP address in the info subnet
19+
ipv4_address: 10.0.2.20
20+
21+
app:
22+
build:
23+
context: .
24+
dockerfile: Dockerfile
25+
volumes:
26+
- ../..:/workspaces:cached
27+
# Overrides default command so things don't shut down after the process ends.
28+
command: sleep infinity
29+
init: true
30+
env_file:
31+
- .env
32+
dns:
33+
# Set the DNS server to be the LocalStack container
34+
- 10.0.2.20
35+
networks:
36+
- ls
37+
38+
networks:
39+
ls:
40+
ipam:
41+
config:
42+
# Specify the subnet range for IP address allocation
43+
- subnet: 10.0.2.0/24

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LOCALSTACK_AUTH_TOKEN=YOUR_TOKEN

.github/workflows/cloudpod_release.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

.github/workflows/integration-test.yml

Lines changed: 87 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,90 @@ on:
2222
type: choice
2323
options:
2424
- ubuntu-latest
25-
- macos-latest
25+
- macos-13
2626

2727

2828
jobs:
29-
run-it-tests-job:
29+
run-terraform-deployment:
30+
name: Run Terraform Deployment
3031
runs-on: ${{ inputs.runner-os || 'ubuntu-latest' }}
3132
steps:
3233
- name: Checkout
33-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python 3.11
37+
id: setup-python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: 3.11
41+
42+
- name: Install Terraform
43+
uses: hashicorp/setup-terraform@v3
44+
45+
- name: Install Terraform Local
46+
run: |
47+
pip install --upgrade terraform-local
48+
49+
- name: Set up Project
50+
run: |
51+
pip install -r requirements-dev.txt
52+
53+
- name: Start LocalStack
54+
uses: LocalStack/[email protected]
55+
with:
56+
image-tag: 'latest'
57+
use-pro: 'true'
58+
configuration: LS_LOG=trace
59+
install-awslocal: 'true'
60+
env:
61+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
62+
63+
- name: Build lambdas
64+
run: |
65+
bin/build_lambdas.sh
66+
67+
- name: Deploy infrastructure
68+
run: |
69+
cd deployment/terraform
70+
tflocal init
71+
tflocal apply --auto-approve
72+
73+
- name: Show localstack logs
74+
if: always()
75+
run: |
76+
localstack logs
77+
78+
- name: Send a Slack notification
79+
if: failure() || github.event_name != 'pull_request'
80+
uses: ravsamhq/notify-slack-action@v2
81+
with:
82+
status: ${{ job.status }}
83+
token: ${{ secrets.GITHUB_TOKEN }}
84+
notification_title: "{workflow} has {status_message}"
85+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
86+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
87+
notify_when: "failure"
88+
env:
89+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
90+
91+
- name: Generate a Diagnostic Report
92+
if: failure()
93+
run: |
94+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
95+
96+
- name: Upload the Diagnostic Report
97+
if: failure()
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: diagnose.json.gz
101+
path: ./diagnose.json.gz
102+
103+
run-integration-tests-job:
104+
name: Run Integration Tests
105+
runs-on: ${{ inputs.runner-os || 'ubuntu-latest' }}
106+
steps:
107+
- name: Checkout
108+
uses: actions/checkout@v4
34109

35110
- name: Set up Python 3.11
36111
id: setup-python
@@ -39,9 +114,9 @@ jobs:
39114
python-version: 3.11
40115

41116
- name: Docker setup (macos only)
42-
id: setup-docker-mac
43117
if: ${{ runner.os == 'macOS' }}
44118
run: |
119+
brew install colima
45120
brew install docker
46121
colima start
47122
@@ -50,18 +125,22 @@ jobs:
50125
pip install -r requirements-dev.txt
51126
52127
- name: Start LocalStack
53-
uses: LocalStack/setup-localstack@main
128+
uses: LocalStack/setup-localstack@v0.2.4
54129
with:
55130
image-tag: 'latest'
56131
use-pro: 'true'
57132
configuration: LS_LOG=trace
58133
install-awslocal: 'true'
59134
env:
60-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
135+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
136+
137+
- name: Build lambdas
138+
run: |
139+
bin/build_lambdas.sh
61140
62141
- name: Deploy infrastructure
63142
run: |
64-
bin/deploy.sh
143+
deployment/awslocal/deploy.sh
65144
66145
- name: Run Tests
67146
env:
@@ -97,7 +176,7 @@ jobs:
97176
98177
- name: Upload the Diagnostic Report
99178
if: failure()
100-
uses: actions/upload-artifact@v3
179+
uses: actions/upload-artifact@v4
101180
with:
102181
name: diagnose.json.gz
103182
path: ./diagnose.json.gz

0 commit comments

Comments
 (0)