mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-23 20:27:42 +00:00
32 lines
651 B
Bash
Executable file
32 lines
651 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
brew bundle check >/dev/null 2>&1 || {
|
|
echo "==> Installing Homebrew dependencies..."
|
|
brew bundle
|
|
}
|
|
|
|
[ -d "tmp/postgresql" ] || {
|
|
echo "===> Setting up database..."
|
|
initdb -D tmp/postgresql -U apollo
|
|
postgres -D tmp/postgresql &
|
|
|
|
echo "===> Waiting for Postgres to finish starting up..."
|
|
while ! nc -z localhost 5432; do
|
|
sleep 0.1 # wait for 1/10 of the second before check again
|
|
done
|
|
|
|
createdb apollo -U apollo
|
|
|
|
script/migrate
|
|
|
|
kill -INT `head -n1 tmp/postgresql/postmaster.pid`
|
|
}
|
|
|
|
go mod verify >/dev/null 2>&1 || {
|
|
echo "==> Installing Go dependencies..."
|
|
go mod download
|
|
}
|