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

FPO-194: Add docker-compose + LocalStack (www.localstack.cloud) #19

Closed
wants to merge 2 commits into from
Closed
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
69 changes: 69 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: "2"
Copy link
Member

Choose a reason for hiding this comment

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

So I think we can just embed these two configuration files as part of https://github.com/trade-tariff/trade-tariff-tech-docs/blob/main/source/manual/get-started.html.md

Copy link
Member

Choose a reason for hiding this comment

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

That way, when we have a new dev starting they can copy this file into ~

services:
redis:
container_name: redis
image: redis
ports:
- 127.0.0.1:6379:6379
volumes:
- dev-env-redis-volume:/data
hmrc-postgres:
container_name: postgres
image: postgres:13
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_USER=${USER}
- POSTGRES_PASSWORD=
- LANG=C.UTF-8
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- 127.0.0.1:5432:5432
volumes:
- hmrc-postgres13:/var/lib/postgresql/data
hmrc-opensearch:
container_name: hmrc-opensearch
image: opensearchproject/opensearch:2
ports:
- 127.0.0.1:9200:9200
- 127.0.0.1:9300:9300
environment:
- bootstrap.memory_lock=true
- discovery.type=single-node
- "OPENSEARCH_JAVA_OPTS=-Xms500m -Xmx500m"
- cluster.routing.allocation.disk.threshold_enabled=false
- plugins.security.disabled=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
healthcheck:
interval: 60s
retries: 10
test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"'
volumes:
- hmrc-os:/usr/share/opensearch/data
- ./config/opensearch/synonyms_all.txt:/usr/share/opensearch/config/synonyms_all.txt:z
- ./config/opensearch/stemming_exclusions_all.txt:/usr/share/opensearch/config/stemming_exclusions_all.txt:z

localstack:
image: localstack/localstack:latest
ports:
- 4566:4566 # LocalStack edge port
- 4510-4559:4510-4559 # maps various AWS services ports
volumes:
# Initialization Hook (see https://docs.localstack.cloud/references/init-hooks/)
- ./localstack-setup.sh:/etc/localstack/init/ready.d/script.sh
volumes:
dev-env-redis-volume:
driver: local
postgres:
driver: local
hmrc-postgres:
driver: local
hmrc-postgres13:
driver: local
hmrc-os:
driver: local
19 changes: 19 additions & 0 deletions localstack-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
echo "Initializing localstack s3"

# You must specify a region. You can also configure your region by running "aws configure".

echo "Creating dynamodb tables..."
aws --endpoint-url=http://localhost:4566 dynamodb create-table \
--region eu-west-2 \
--table-name CustomerApiKeys \
--attribute-definitions \
AttributeName=CustomerApiKeyId,AttributeType=S \
AttributeName=FpoId,AttributeType=S \
--key-schema \
AttributeName=CustomerApiKeyId,KeyType=HASH \
AttributeName=FpoId,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5

echo "Creating API Gateway..."
Copy link
Member

Choose a reason for hiding this comment

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

Are you thinking you want to do this part in a separate PR?

Copy link
Author

Choose a reason for hiding this comment

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

basically I don't know how to do that 😅
need to dig a bit more on the current AWS setting and replicate it in here

# TODO: Create API Gateway
Loading