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

Allow development to use localstack over AWS #1961

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

neilmiddleton
Copy link
Contributor

Jira link

BAU / Experiment.

What?

This PR allows local development to use localstack over AWS for development purposes. This allows developers to work offline, or seperated from other developers in a non-shared environment.

Note this PR only covers S3 usage rather than other services.

Fails-safe to the current way of working so localstack is an opt-in change

@willfish
Copy link
Member

willfish commented Sep 5, 2024

Having used localstack a bunch in the developer hub, I'm wondering if we can add a couple of Make targets to get started? And maybe a docker-compose.yml file?

localstack: clean-localstack
	$(eval USAGE_PLAN_ID=$(shell docker-compose up | grep -m1 'usagePlanId=' | awk -F'=' '{print $$2}'))
	@if [ -z "$(USAGE_PLAN_ID)" ]; then \
		echo "Failed to extract USAGE_PLAN_ID"; \
		exit 1; \
	fi
	@sed -i'' -e 's/export USAGE_PLAN_ID=.*/export USAGE_PLAN_ID=$(USAGE_PLAN_ID)/' .env.development
	@echo "Updated USAGE_PLAN_ID in .env.development to $(USAGE_PLAN_ID)"
	@echo "Localstack is running. Run make stop-localstack to stop it."

clean-localstack: stop-localstack
	docker-compose rm -f -s -v

stop-localstack:
	docker-compose down
version: "2"
services:
  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/)
      - .bin/seed.sh:/etc/localstack/init/ready.d/script.sh

@neilmiddleton
Copy link
Contributor Author

Yeah, adding localstack to the local docker-compose so there's essentially zero setup for people would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants