17 lines
615 B
Bash
Executable file
17 lines
615 B
Bash
Executable file
#!/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
|
|
cd ${GOPATH}/src/git.minhas.io/asara/sudoscientist-go-backend
|
|
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
|