Skip to content

Commit

Permalink
Fix PostgreSQL provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Jan 15, 2023
1 parent 3d68ee5 commit a60fd54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions recipe/provision/databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
desc('Provision PostgreSQL');
task('provision:postgresql', function () {
run('apt-get install -y postgresql postgresql-contrib', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive'], 'timeout' => 900]);
run('sudo -u postgres createuser {{db_user}}');
run('sudo -u postgres createdb {{db_name}}');
run("sudo -u postgres psql <<< $'CREATE DATABASE {{db_name}};'");
run("sudo -u postgres psql <<< $'CREATE USER {{db_user}} WITH ENCRYPTED PASSWORD \'%secret%\';'", ['secret' => get('db_password')]);
run("sudo -u postgres psql <<< $'GRANT ALL PRIVILEGES ON DATABASE {{db_name}} TO {{db_user}};'");
});

0 comments on commit a60fd54

Please sign in to comment.