-
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.
Moving Docker compose and makefile additions into this codebase (#55)
- Loading branch information
1 parent
724fe91
commit ea27a93
Showing
4 changed files
with
55 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
|
||
.env | ||
*.dump | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
DB_SERVICE = db # Name of the PostgreSQL service in docker-compose | ||
DUMP_FILE = /app/phinvads.dump # Name of your SQL dump file (within db container) | ||
|
||
start: | ||
@echo "Starting database container..." | ||
docker compose up -d | ||
|
||
stop: | ||
@echo "Stopping database container..." | ||
docker compose down | ||
|
||
load: | ||
@echo "Inserting data from $(DUMP_FILE) into $(DB_NAME)..." | ||
docker compose exec -T $(DB_SERVICE) pg_restore -U $(DB_USER) -x --no-owner -d $(DB_NAME) $(DUMP_FILE) | ||
|
||
refresh: | ||
@echo "Running database refresh..." | ||
docker compose exec -T $(DB_SERVICE) psql -U $(DB_USER) -c "DROP DATABASE IF EXISTS $(DB_NAME) WITH (FORCE)" | ||
docker compose exec -T $(DB_SERVICE) psql -U $(DB_USER) -c 'CREATE DATABASE $(DB_NAME)' | ||
$(MAKE) load |