X-Git-Url: https://git.hcoop.net/hcoop/zz_old/ikiwiki/blobdiff_plain/e1cd5a4cbe84bbd75f840bbd53756547296b29f9..ee25310d72cb6678ce011cda7a23477b88d86d20:/DaemonAdmin/PostgreSQL.mdwn diff --git a/DaemonAdmin/PostgreSQL.mdwn b/DaemonAdmin/PostgreSQL.mdwn new file mode 100755 index 0000000..ac7f528 --- /dev/null +++ b/DaemonAdmin/PostgreSQL.mdwn @@ -0,0 +1,20 @@ +See MySQL for list of things that have to be done for any database +(both MySQL and Postgres). + += Postgres-specific setup = + + 1. $dir = /afs/hcoop.net/common/databases/USERNAME/postgres + +If $dir does NOT exist: + + 1. sudo -u postgres psql -c "CREATE USER '''USERNAME'''" template1 + 1. mkdir -p $dir + 1. chown postgres:postgres "$dir" + 1. fs setacl -dir $dir -acl postgres write + 1. fs setacl -dir $dir -acl databases none # (keep out other databases, just in case) + 1. fs setacl -dir $dir -acl system:backup rl # (should be inherited from parent dir) + 1. sudo -u postgres psql -c "CREATE TABLESPACE user_'''USERNAME''' OWNER '''USERNAME''' LOCATION '$dir'" template1 + +When it does, go directly to database creation step: + + 1. sudo -u postgres createdb -O '''USERNAME''' -D user_'''USERNAME''' '''DBNAME'''