Skip to content

Heimdall Heroku Documentation

George M. Dias edited this page Jul 25, 2024 · 4 revisions

Heimdall Heroku Database Maintenances

Heimdall is hosted in Keroku, there are two instances, one for staging, and another for production. Both instances use the Heroku Postgres add-on where Heimdall Server stores its content. If there is a need to do any database maintenances, it can be accomplished locally using the appropriate Heroku Postgres credentials.

Database Exceeds Size Limit

If Heroku notifies that the database size limit (based on the PLAN being used - we are using essential-0, it has a limit of 1GB ) is or has been exceeded, follow these procedures to reduce its size.

NOTES:
PGBackups stores backups in a compressed binary format. The backups include commands to recreate indexes instead of storing the indexes themselves.
The backups are store in Heroku Datastores for the database. The mitre-heimdall datastore is located here
Reset Database - resets the database to its originally-provisioned state, deleting all data inside it. This action may require that the session table be created manually, see How to Create the session Table

Connect to Heroku via Heroku CLI

If operating within a restrictive network environment an organization chain certificate may be needed. After obtaining the necessary certificate create an environment variable called NODE_EXTRA_CA_CERTS and set it to point to the certificate

Test the connection by using the CLI: heroku login

For additional information see Quick Start: Heroku Connect CLI

How to get Heimdall Heroku Postgres Credentials

To retrieve the database credentials install The Heroku CLI, and use the heroku CLI to retrieve the connection information for both Heimdall instances (staging and production).

To get the credential for the staging instance use: heroku pg:credentials:url DATABASE -a mitre-heimdall-staging

To get the credential for the production instances use: heroku pg:credentials:url DATABASE -a mitre-heimdall

See Connecting to Heroku Postgres for additional information

Use pgAdmin4 to Connect to Heimdall Heroku Postgres Instances

The pgAdmin4 from PostgreSQL Tools can be use to establish a connection to the Heimdall Heroku Database. Use the output of the heroku pg:credentials:url CLI command to obtain the necessary information to add a server to pgAdmin4.

Follow the instruction below to setup a connection to a Heroku Postgres.

image

image

image

image

How to Create the session Table

To manually create the session table connect to the database using pgAdmin4 open a Query Tool panel and invoke this SQL command:

CREATE TABLE public."session"( sid character varying(255) NOT NULL, sess json NOT NULL, expire timestamp with time zone NOT NULL, CONSTRAINT session_pkey PRIMARY KEY(sid) );

Clone this wiki locally