-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (42 loc) · 1.37 KB
/
Makefile
File metadata and controls
51 lines (42 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
CARGO = cargo
PSQL = psql
DB_NAME = main
DB_USER = postgres
DB_PASSWORD = postgres
DB_HOST = localhost
DB_PORT = 5433
# Section: Postgres & Local
test:
@echo "Running tests with Postgres and local storage..."
RUST_LOG=trace \
$(CARGO) test
local-run:
@echo "Running in local mode with Postgres and Local Semantic Store"
RUST_LOG=trace \
$(CARGO) run --bin local
production-run:
@echo "Running in production mode with Snowflake and S3 Semantic Store"
RUST_LOG=info \
$(CARGO) run --bin production
# Shared commands for both configurations
setup-postgres:
@echo "Starting Postgres container..."
@docker run --name postgres -e POSTGRES_PASSWORD=$(DB_PASSWORD) -p $(DB_PORT):5432 -d postgres
@echo "Waiting for Postgres to be ready..."
@sleep 2
create-postgres:
@echo "Creating databases $(DB_NAME) and $(SCHEMA_DB_NAME)..."
@$(PSQL) postgres://$(DB_USER):$(DB_PASSWORD)@127.0.0.1:$(DB_PORT) -c "CREATE DATABASE $(DB_NAME)"
populate-postgres:
@echo "Populating main database..."
@$(PSQL) postgres://$(DB_USER):$(DB_PASSWORD)@127.0.0.1:$(DB_PORT)/$(DB_NAME) -f ./scripts/populate_db.sql
teardown:
@echo "Stopping and removing containers..."
@docker stop postgres
@docker rm postgres
clean:
@echo "Cleaning up..."
@docker stop postgres
@docker rm postgres
@rm -rf target
.PHONY: test local-run production-run setup-postgres create-postgres populate-postgres teardown clean