21 lines
498 B
Bash
Executable File
21 lines
498 B
Bash
Executable File
#!/bin/sh -ex
|
|
|
|
# This should only be run once, to create the database + users.
|
|
chown postgres:postgres /var/lib/postgresql
|
|
su postgres -c '/usr/lib/postgresql/10/bin/initdb'
|
|
|
|
echo "Starting postgresql"
|
|
pg_ctlcluster 10 main start
|
|
|
|
|
|
echo
|
|
echo "Creating 'mydata' user"
|
|
su postgres -c 'createuser mydata -dPERS'
|
|
|
|
echo
|
|
echo "Creating 'opendata' user"
|
|
su postgres -c 'createuser opendata -dPERS'
|
|
|
|
su postgres -c 'createdb -E UTF8 -O mydata mydata'
|
|
su postgres -c 'createdb -E UTF8 -O opendata opendata'
|