Skip to content

Commit a60fd54

Browse files
committed
Fix PostgreSQL provisioning
1 parent 3d68ee5 commit a60fd54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

recipe/provision/databases.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
desc('Provision PostgreSQL');
5959
task('provision:postgresql', function () {
6060
run('apt-get install -y postgresql postgresql-contrib', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive'], 'timeout' => 900]);
61-
run('sudo -u postgres createuser {{db_user}}');
62-
run('sudo -u postgres createdb {{db_name}}');
61+
run("sudo -u postgres psql <<< $'CREATE DATABASE {{db_name}};'");
62+
run("sudo -u postgres psql <<< $'CREATE USER {{db_user}} WITH ENCRYPTED PASSWORD \'%secret%\';'", ['secret' => get('db_password')]);
63+
run("sudo -u postgres psql <<< $'GRANT ALL PRIVILEGES ON DATABASE {{db_name}} TO {{db_user}};'");
6364
});

0 commit comments

Comments
 (0)