Skip to content

Commit f3fda61

Browse files
author
Eugene Istrati
committed
localstack debugging
1 parent be9ef25 commit f3fda61

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

bin/setup-environment.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ run_preflight_checks() {
380380
install_prerequisites() {
381381
print_section "System Prerequisites"
382382

383-
local packages="ca-certificates curl gnupg lsb-release apt-transport-https"
383+
local packages="ca-certificates curl python3-pip gnupg lsb-release apt-transport-https"
384384
packages="$packages software-properties-common unzip wget jq"
385385

386386
if [ "$INSTALL_DNSMASQ" = true ]; then
@@ -1773,16 +1773,15 @@ main() {
17731773

17741774
# Install everything
17751775
install_prerequisites
1776+
install_python "3.11"
1777+
install_python "3.12"
1778+
install_python "3.13"
1779+
install_python "3.14"
17761780
install_vscode
17771781
install_intellij
17781782
install_pycharm
17791783
install_chrome
17801784
install_docker
1781-
install_terraform
1782-
install_awscli
1783-
install_localstack
1784-
install_tflocal
1785-
install_awslocal
17861785
install_postgres "$POSTGRES_VERSION"
17871786
configure_postgres_auth
17881787
install_pgadmin
@@ -1791,10 +1790,11 @@ main() {
17911790
configure_mongodb_auth
17921791
install_mongodb_compass
17931792
install_nodejs
1794-
install_python "3.14"
1795-
install_python "3.13"
1796-
install_python "3.12"
1797-
install_python "3.11"
1793+
install_terraform
1794+
install_awscli
1795+
install_localstack
1796+
install_tflocal
1797+
install_awslocal
17981798
configure_dnsmasq
17991799

18001800
# Verification and summary

bin/start-dev.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,20 @@ echo -e " ✓ Docker is running"
198198
# Check if LocalStack is running
199199
LOCALSTACK_OK=false
200200
if curl -s http://localhost:4566/_localstack/health > /dev/null 2>&1; then
201-
LOCALSTACK_OK=true
202-
echo -e " ✓ LocalStack is running"
203-
else
201+
# Verify the correct image is running
202+
RUNNING_IMAGE=$(docker inspect localstack-main --format '{{.Config.Image}}' 2>/dev/null || echo "")
203+
if [ "$RUNNING_IMAGE" != "$LOCALSTACK_IMAGE" ]; then
204+
echo -e " ⚠ LocalStack running with wrong image ($RUNNING_IMAGE), expected $LOCALSTACK_IMAGE. Restarting..."
205+
localstack stop
206+
docker stop localstack-main 2>/dev/null || true
207+
sleep 5
208+
else
209+
LOCALSTACK_OK=true
210+
echo -e " ✓ LocalStack is running ($LOCALSTACK_IMAGE)"
211+
fi
212+
fi
213+
214+
if [ "$LOCALSTACK_OK" = false ]; then
204215
# Check if LocalStack docker container is already running
205216
if docker ps | grep -q localstack-main; then
206217
echo -e " ⚠ Stopping existing LocalStack container..."
@@ -260,10 +271,12 @@ fi
260271
# Detect MongoDB host for LocalStack Lambda functions
261272
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
262273
export TF_VAR_mongodb_host="172.17.0.1"
263-
echo -e " Detected Linux - using MongoDB host: 172.17.0.1"
274+
export TF_VAR_aws_postgres_host="172.17.0.1"
275+
echo -e " Detected Linux - using host: 172.17.0.1"
264276
else
265277
export TF_VAR_mongodb_host="host.docker.internal"
266-
echo -e " Detected Mac/Windows - using MongoDB host: host.docker.internal"
278+
export TF_VAR_aws_postgres_host="host.docker.internal"
279+
echo -e " Detected Mac/Windows - using host: host.docker.internal"
267280
fi
268281

269282
# Change to infrastructure directory
@@ -382,6 +395,7 @@ echo "============================================================"
382395
echo ""
383396
echo "Services Status:"
384397
echo " • MongoDB: Running on 0.0.0.0:27017"
398+
echo " • PostgreSQL: Running on localhost:5432"
385399
echo " • LocalStack: Running on localhost:4566"
386400
echo " • Backend: Deployed to LocalStack"
387401
echo " • Proxy: Running on localhost:3001"

infra/variable.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ variable "aws_mongo_host" {
3333
type = string
3434
default = null
3535
}
36+
37+
variable "aws_postgres_host" {
38+
description = "PostgreSQL host for LocalStack. Defaults to 'host.docker.internal' (on Linux, set to '172.17.0.1')."
39+
type = string
40+
default = null
41+
}

0 commit comments

Comments
 (0)