1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-23 00:01:09 +00:00
ibis/scripts/start_dev_db.sh

26 lines
645 B
Bash
Raw Normal View History

2023-12-01 11:11:19 +00:00
#!/bin/bash
2024-02-08 16:04:56 +00:00
set -ex
2023-12-01 11:11:19 +00:00
2024-02-08 16:04:56 +00:00
export PGHOST="$1"
2023-12-01 11:11:19 +00:00
export PGDATA="$1/dev_pgdata"
2024-01-03 12:29:25 +00:00
# If cluster exists, stop the backend
2023-12-01 11:11:19 +00:00
if [ -d $PGDATA ]
then
2024-01-03 12:29:25 +00:00
# Prevent `stop` from failing if backend already stopped
2023-12-19 14:32:14 +00:00
#pg_ctl restart > /dev/null
2023-12-01 11:11:19 +00:00
pg_ctl stop
fi
# Create cluster
initdb --username=postgres --auth=trust --no-instructions
touch "$PGHOST/.s.PGSQL.5432"
2023-12-01 11:11:19 +00:00
2024-01-03 12:29:25 +00:00
# Start backend that only listens to socket in current directory
2023-12-01 11:11:19 +00:00
pg_ctl start --options="-c listen_addresses= -c unix_socket_directories=$PGHOST"
# Setup database
2024-02-07 15:54:43 +00:00
psql -c "CREATE USER ibis WITH PASSWORD 'password' SUPERUSER;" -U postgres
psql -c "CREATE DATABASE ibis WITH OWNER ibis;" -U postgres