Skip to content

Commit cc812da

Browse files
committed
Improves local development environment setup
Adds a command to remove volumes during local development teardown. Updates the indexer to load environment variables from a .env file if it exists, falling back to system variables if not. Refactors the docker-compose setup to use an external network, enhancing network configuration flexibility.
1 parent 96d4e46 commit cc812da

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ dev-down: ## Stop local development environment
5454
@echo "Stopping local development environment..."
5555
docker compose -f docker/docker-compose.local.yml down
5656

57+
dev-down-volumes: ## Stop local development environment and remove volumes
58+
@echo "Stopping local development environment and removing volumes..."
59+
docker compose -f docker/docker-compose.local.yml down --volumes
60+
5761
dev-clean: ## Stop and clean local development environment (removes volumes)
5862
@echo "Cleaning local development environment..."
5963
docker compose -f docker/docker-compose.local.yml down -v
@@ -62,8 +66,13 @@ dev-clean: ## Stop and clean local development environment (removes volumes)
6266
# Application
6367
run-indexer: ## Run the modern indexer service (production)
6468
@echo "Starting modern indexer service..."
65-
@echo "Ensure .env file is configured or export required environment variables"
66-
cargo run --bin fossil_indexer
69+
@if [ -f .env ]; then \
70+
echo "Loading environment variables from .env..."; \
71+
export $$(grep -v '^#' .env | xargs) && cargo run --bin fossil_indexer; \
72+
else \
73+
echo "No .env file found, using system environment variables"; \
74+
cargo run --bin fossil_indexer; \
75+
fi
6776

6877
run-cli: ## Run the legacy CLI tool (debugging)
6978
@echo "Available CLI commands:"

docker/docker-compose.local.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
context: ..
55
dockerfile: docker/Dockerfile.migrate
66
networks:
7-
- local_network
7+
- fossil-network
88
environment:
99
- DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
1010
depends_on:
@@ -18,7 +18,7 @@ services:
1818
ports:
1919
- "3000:3000"
2020
networks:
21-
- local_network
21+
- fossil-network
2222
env_file:
2323
- ../.env
2424
environment:
@@ -38,7 +38,7 @@ services:
3838
ports:
3939
- "5432:5432"
4040
networks:
41-
- local_network
41+
- fossil-network
4242
volumes:
4343
- db_local_data:/var/lib/postgresql/local_test
4444
healthcheck:
@@ -48,6 +48,8 @@ services:
4848
retries: 5
4949

5050
networks:
51-
local_network:
51+
fossil-network:
52+
external: true
53+
name: fossil-network
5254
volumes:
5355
db_local_data:

0 commit comments

Comments
 (0)