diff --git a/docs/nix_services_setup.md b/docs/nix_services_setup.md --- a/docs/nix_services_setup.md +++ b/docs/nix_services_setup.md @@ -6,10 +6,11 @@ ## LocalStack -We use LocalStack to emulate AWS services, allowing us to develop and test our services locally. To start LocalStack, run: +We use LocalStack to emulate AWS services, allowing us to develop and test our services locally. To start LocalStack, run the following commands: ``` -comm-dev services start +cd services +./scripts/docker_localstack_up.sh ``` Make sure your LocalStack resources are up to date: diff --git a/services/scripts/docker_localstack_up.sh b/services/scripts/docker_localstack_up.sh new file mode 100755 --- /dev/null +++ b/services/scripts/docker_localstack_up.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +# Start services +comm-dev services start + +# Disable Nix-based localstack by checking for "localstack_main" container +if docker ps | grep localstack_main &> /dev/null; then + echo "Disabling Nix-based localstack..." >&2 + bash ../scripts/localstack_down.sh +else + echo "Nix-based localstack is already disabled, skipping shutdown" +fi + +# Start Docker Compose-based localstack +if ! docker ps | grep localstack &> /dev/null; then + echo "Starting Docker compose-based localstack..." >&2 + yarn init-local-cloud +else + echo "Docker compose-based localstack is already running, skipping localstack initialization" +fi