A dedicated PostgreSQL instance or DBAAS is recommended for production use. You will need the connection settings for the next step. Some DBAAS services require you to create databases in their GUI. If this is the case, create an empty database. We'll script the table creation in the next step.
helpy_production
Connect and set up the database
To configure your PostgreSQL database connection, you will need to set a handful of environment variables on your app instance(s). To further improve resilience, consider clustering your database with at least one slave configured as a hot standby, in case of failure of the primary node. Note: if you set up a local database with the default username and password, you can skip this configuration for now.
sudo helpy config:set HELPY_POSTGRES_DB=helpy_production
sudo helpy config:set HELPY_POSTGRES_USER=postgres_db_user
sudo helpy config:set HELPY_POSTGRES_PASSWORD=postgres_db_pw
sudo helpy config:set HELPY_POSTGRES_HOST=postgres_db_host
sudo helpy config:set HELPY_POSTGRES_PORT=postgres_db_port
After configuring the remote database server, you should restart the Helpy service:
sudo helpy restart
Next, create a database user, and set the password for the user. Make note of the username and password if you change them.
sudo -u postgres createuser -s helpy
sudo -u postgres psql -U postgres -d postgres -c "alter user helpy with password 'helpy';"
Create an empty Helpy database with the following. We will script the table setup in a later step.
sudo -u postgres createdb helpy_production
Once the database configuration is set, you may need to create the empty database if you didn't in a previous step
sudo helpy run rake db:create
Once you have created the database, set up the database tables from scratch:
sudo helpy run rake db:setup