Skip to content
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ next-env.d.ts
dist/

diagram.txt

# localstack
localstack/data/
31 changes: 31 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ services:
DATABASE_URL: postgresql://postgres:asdfasdf@db:5432/postgres
TEST_DATABASE_URL: postgresql://postgres:asdfasdf@test_db:5432/postgres
JOB_FUNCTION_URL: http://job_worker:8080/2015-03-31/functions/function/invocations
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_ENDPOINT_URL_S3: http://localstack:4566
AWS_S3_FORCE_PATH_STYLE: "true"
volumes:
- ./:/app
- server-node-modules:/app/node_modules
Expand All @@ -17,6 +22,8 @@ services:
depends_on:
db:
condition: service_healthy
localstack:
condition: service_healthy
job_worker:
build:
context: .
Expand All @@ -25,6 +32,12 @@ services:
restart: always
environment:
DATABASE_URL: postgresql://postgres:asdfasdf@db:5432/postgres
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_ENDPOINT_URL_S3: http://localstack:4566
AWS_S3_FORCE_PATH_STYLE: "true"
EXPORT_PUBLIC_S3_ENDPOINT: http://localhost:4566
volumes:
- ./:/app
- job-worker-node-modules:/app/node_modules
Expand All @@ -33,9 +46,27 @@ services:
depends_on:
db:
condition: service_healthy
localstack:
condition: service_healthy
env_file:
- path: .env
required: false
localstack:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like when using docker compose, we need to mount a volume for all localstack data otherwise the system state will be lost. Let's mount ./localstack/data to /var/lib/localstack and add that file to gitignore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a volume 7d03ffd

image: localstack/localstack:4
environment:
- SERVICES=s3
- DEFAULT_REGION=us-east-1
- LS_LOG=warn
volumes:
- ./localstack/data:/var/lib/localstack
- ./localstack/init:/etc/localstack/init
ports:
- 4566:4566
healthcheck:
test: ["CMD", "bash", "-c", "awslocal s3 ls >/dev/null 2>&1"]
interval: 10s
timeout: 5s
retries: 5
db:
build:
dockerfile: db/Dockerfile
Expand Down
11 changes: 11 additions & 0 deletions localstack/init/ready.d/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu

bucket_prefix="${EXPORT_BUCKET_PREFIX:-gbt-exports}"
bucket_name="${bucket_prefix}-local"

if ! awslocal s3api head-bucket --bucket "$bucket_name" >/dev/null 2>&1; then
awslocal s3 mb "s3://${bucket_name}" >/dev/null
fi

echo "Localstack S3 bucket ready: ${bucket_name}"