Postgres

Assuming you don't have a separate database server, you'll need to install Postgres. For the rest of this chapter, operate as root, switching as necessary.

Exit from the web user, switch to root, and install Postgres.

exit
sudo -i
apt install postgresql

Switch to the postgres user. Create a web database user with a password and permission to create databases. Then switch back to root. Don't forget to record the database user password somewhere secure. You'll need it later when you configure your Phoenix prod config.

su postgres
createuser --pwprompt --createdb web
exit

Postgres Ident Auth

Calling the db user "web" makes it easy to access when we are logged into the server as the web user. Postgres uses Ident Authentication, and will grant access if the system username and db username match.

Try out that Ident Auth: Switch to the web user and create a database for your Phoenix project. Replace "myapp" with your project's name. Notice you will not be prompted for a password.

su web
createdb myapp_prod
exit

results matching ""

    No results matching ""