-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change make file docker container name
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
%: | ||
@: | ||
|