chore(setup): replace LocalStack with moto-server for local SQS simulation#27
Open
prshant70 wants to merge 4 commits into
Open
chore(setup): replace LocalStack with moto-server for local SQS simulation#27prshant70 wants to merge 4 commits into
prshant70 wants to merge 4 commits into
Conversation
- Remove LocalStack version-check, pip install, and start block from notify_setup.py - Add moto-server container start sequence (docker rm --force, pull motoserver/moto, docker run -p 5000:5000 --detach) - Add urllib.request readiness poll (30 retries, 1s sleep) with exit(1) on timeout - Replace docker network connect localstack-main with moto-server in notify_setup.py - Replace port 4566 / localstack-main with port 5000 / moto-server in gateway_setup.py, core_setup.py, and handler_setup.py - Replace docker exec awslocal queue-creation loops with inline boto3 sqs.create_queue calls in all three service setup scripts
- gateway_setup.py, core_setup.py, handler_setup.py: remove darwin/linux ternary from _sqs_endpoint; always use http://localhost:5000 - moto-server publishes -p 5000:5000 so localhost:5000 is reachable from the host on both macOS and Linux; 'moto-server' hostname is only valid inside the Docker network (container-to-container), not from the host - config.json SQS_ENDPOINT_URL values (http://moto-server:5000 on Linux) are unchanged — they are correct for container-to-container use Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
DeputyDev will no longer review pull requests automatically.To request a review, simply comment #review on your pull request—this will trigger an on-demand review whenever you need it. |
If something is already listening on localhost:5000 (e.g. a moto-server started in a previous run), the script now detects it upfront and skips the pull/rm/run sequence entirely instead of failing with a port-binding error. Also suppress stderr on `docker rm --force moto-server` so the expected "No such container" message on a fresh run does not pollute output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Port 5000 is commonly occupied on macOS (AirPlay Receiver) and potentially other services. Map the moto-server container's internal port 5000 to host port 15000 via `-p 15000:5000`. Updates all host-side references: readiness poll, boto3 queue-creation endpoint, and macOS config.json SQS_ENDPOINT_URL. Container-to-container URLs (http://moto-server:5000) are unchanged — that is the container's internal port and is unaffected by the host port mapping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #26
What
Replaces LocalStack with the credential-free
motoserver/motoDocker image as the local SQS simulator used bypython3 notify_setup.py. The four superproject setup scripts (notify_setup.py,gateway_setup.py,core_setup.py,handler_setup.py) are updated: LocalStack install/start logic is removed, a moto-server container is started on port 5000 with a readiness poll, and all queue-creation commands previously usingdocker exec awslocalare replaced with direct boto3 calls againsthttp://localhost:5000.Why
LocalStack now requires authentication (a license token), which blocks first-time contributors from completing quick-setup with no AWS account.
motoserver/motois a drop-in replacement that requires no credentials, ships multi-arch Docker images (amd64 + arm64), and exposes a compatible HTTP endpoint on port 5000.How
notify_setup.py: deletes the LocalStack version-check/pip-install/start block; insertsdocker rm --force moto-server,docker pull motoserver/moto,docker run -p 5000:5000 --detach --name moto-server, and a 30-retry stdliburllib.requestreadiness poll. Updates thedocker network connectcall fromlocalstack-maintomoto-server. Addsimport timeandimport urllib.request(stdlib only, no new dependencies).gateway_setup.py,core_setup.py,handler_setup.py: addimport boto3; update darwin/linux SQS endpoint URL strings from port 4566 /localstack-mainto port 5000 /moto-server; replacedocker exec awslocalqueue-creation subprocess loops withboto3.client('sqs', endpoint_url='http://localhost:5000', ...)loops using inline dummy credentials (non-secret moto-server placeholders). The queue-creation endpoint is unconditionallyhttp://localhost:5000on both macOS and Linux because the scripts run on the host and the container publishes port 5000 via-p 5000:5000. TheSQS_ENDPOINT_URLvalues written to each service'sconfig.jsonremainhttp://moto-server:5000on Linux for container-to-container routing.Testing
No automated test suite exists for these setup scripts. Manual verification:
Passing state:
notify_setup.pycompletes to##### Congratulations! NotifyOne system setup Completed #####,list_queuesreturns all expected queue names, bothgrepcommands return no output,py_compileexits 0. Re-running a second time must not fail with "container name already in use".Checklist
python3 -m py_compile notify_setup.py gateway_setup.py core_setup.py handler_setup.py)test/testare non-secret moto-server placeholders)python3 notify_setup.pyon a clean machine with no AWS account and no LocalStack installed; confirm setup completes andlist_queuesreturns expected queues; re-run a second time to confirm no "container name already in use" error