PORT
variable to change according to process.argv
.user
and password
attributes.postgres
also gets created _in ubuntu. _Postgres SQL server system has a system of users and logins for the server itself. By default the configuration expects that this is one-to-one with the Ubuntu system users as well; i.e., if a user inside the Postgres system exists and wants to use the database, it is expected by default that there is also an Ubuntu user of the same name.psql
as the (Postgres server) default postgres
user.postgres
user. Record the password so that we can assign it to an environment variable later.psql
and restart Postgres to ensure the password change gets propagated for new connections.postgres
user.cd
into the repo folder.sudo su - postgres
changes the user and therefore changes the directory. Note the directory with your repository code and run the SQL to create your tables.-d
stands for database. -f
stands for file path. In the following code, we assume we have a file init_tables.sql
that contains all the queries we need to set up our database schema. If we don't have this file already, create one locally, test it, commit, and push it to GitHub before pulling it from our EC2 machine.psql
.ubuntu
user.DB_PASSWORD
and ENV
environment variables for our Postgres connection configs. Replace <MY_SECRET_PASSWORD>
with the DB password we set above.psql
, and restart the server.