This repository has been archived on 2023-07-09. You can view files and clone it, but cannot push or open issues or pull requests.
sudoscientist-go-backend/db_reset.sh

17 lines
615 B
Bash
Raw Normal View History

2019-04-14 03:38:51 +00:00
#!/bin/bash
docker stop sudosci-db
docker rm sudosci-db
export DB_ADMIN_PW=test
docker run --name sudosci-db -e POSTGRES_PASWORD=${DB_ADMIN_PW} -d postgres
2019-05-27 18:25:36 +00:00
cd ${GOPATH}/src/git.minhas.io/asara/sudoscientist-go-backend
2019-04-14 03:38:51 +00:00
for i in settings/*; do source $i; done
export DB_HOST=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" sudosci-db)
# instance takes a while to setup and configure postgis
sleep 10
psql -d postgres -U postgres -h ${DB_HOST} << EOF
CREATE DATABASE ${DB_NAME};
CREATE USER ${DB_USER} WITH ENCRYPTED PASSWORD '${DB_PW}';
GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};
EOF
echo Done