-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to recreate docker postgres database
- Loading branch information
Showing
1 changed file
with
18 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# docker run -p 8000:8000 dwmkerr/dynamodb | ||
|
||
SCHEMA="pact_broker" | ||
set +e | ||
export PACT_BROKER_DATABASE_HOST="127.0.0.1" | ||
psql postgres -h $PACT_BROKER_DATABASE_HOST -U postgres -c "DROP DATABASE ${SCHEMA};" | ||
psql postgres -h $PACT_BROKER_DATABASE_HOST -U postgres -c "CREATE DATABASE ${SCHEMA};" | ||
psql postgres -h $PACT_BROKER_DATABASE_HOST -U postgres -c "CREATE USER pact_broker WITH PASSWORD 'pact_broker'" | ||
psql postgres -h $PACT_BROKER_DATABASE_HOST -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${SCHEMA} to pact_broker;" | ||
psql postgres -h $PACT_BROKER_DATABASE_HOST -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${SCHEMA} TO pact_broker;" | ||
echo "" | ||
echo "run the following command to set your environment variables:" | ||
echo "export PACT_BROKER_DATABASE_USERNAME=pact_broker" | ||
echo "export PACT_BROKER_DATABASE_PASSWORD=pact_broker" | ||
echo "export PACT_BROKER_DATABASE_NAME=${SCHEMA}" | ||
echo "export PACT_BROKER_DATABASE_HOST=${ip}" | ||
echo "To test:" | ||
echo "psql -h \$PACT_BROKER_DATABASE_HOST -d \$PACT_BROKER_DATABASE_NAME -U \$PACT_BROKER_DATABASE_USERNAME" |