Skip to content

Commit

Permalink
change make file docker container name
Browse files Browse the repository at this point in the history
  • Loading branch information
juancwu committed Dec 15, 2024
1 parent 3125683 commit 2ea37cf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ sql:

seed:
@echo "Running development seed data..."
@cat .sqlc/seeds/development_seed.sql | docker exec -i nokap-postgres psql -U postgres -d postgres
@cat .sqlc/seeds/development_seed.sql | docker exec -i spur-postgres psql -U postgres -d postgres

setup:
@go install github.com/air-verse/[email protected] && \
go install github.com/sqlc-dev/sqlc/cmd/[email protected] && \
go install github.com/pressly/goose/v3/cmd/[email protected]

init-dev-db:
@docker run --name nokap-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DATABASE=postgres -p 5432:5432 -d postgres:$(POSTGRESQL_VERSION) && \
timeout 90s bash -c "until docker exec nokap-postgres pg_isready ; do sleep 5 ; done" && echo "Postgres is ready! Run migrations with 'make up'"
@docker run --name spur-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DATABASE=postgres -p 5432:5432 -d postgres:$(POSTGRESQL_VERSION) && \
timeout 90s bash -c "until docker exec spur-postgres pg_isready ; do sleep 5 ; done" && echo "Postgres is ready! Run migrations with 'make up'"
start-dev-db:
@docker start nokap-postgres && \
@docker start spur-postgres && \
timeout 90s bash -c \
"until docker exec nokap-postgres pg_isready ; do sleep 5 ; done" && \
"until docker exec spur-postgres pg_isready ; do sleep 5 ; done" && \
echo "Postgres is ready! Run migrations with 'make up'"
stop-dev-db:
@docker stop nokap-postgres
@docker stop spur-postgres
check-dev-db:
@docker exec nokap-postgres pg_isready
@docker exec spur-postgres pg_isready
clean-dev-db:
@docker stop nokap-postgres && docker rm nokap-postgres
@docker stop spur-postgres && docker rm spur-postgres
health-dev-db:
@echo "Checking server health..."
@curl -s localhost:8080/api/v1/health | jq || echo "Failed to connect to health endpoint"
query:
@docker exec nokap-postgres psql -U postgres -d postgres -c "$(filter-out $@,$(MAKECMDGOALS))"
@docker exec spur-postgres psql -U postgres -d postgres -c "$(filter-out $@,$(MAKECMDGOALS))"
# Prevent make from treating the query string as a target
%:
@:
Expand Down

0 comments on commit 2ea37cf

Please sign in to comment.