Heimdall Heroku Documentation - mitre/heimdall2 GitHub Wiki
Heimdall is hosted in Heroku, there are two instances, one for staging, and another for production. Both instances use the Heroku Postgres add-on where Heimdall Server stores its contents. If there is a need to do any database maintenances, it can be accomplished locally using the appropriate Heroku Postgres credentials.
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 storage) is or has been exceeded, follow these procedures to reduce its size.
- Backup the Database
- Delete data from the database as needed - Use pgAdmin4 to Connect to Heimdall Heroku Postgres Instances or
- Reset the Database
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 thesession
Table
Credentials for Heroku-Postgres can be retrieved as follows:
- From the Heroku Hosting Site
- Using the Heroku CLI
Connect to the Heroku hosting site, navigate to the appropriate project, select the appropriate deployed instance (e.g., staging or prod), on the provided dashboard select (click) on the Heroku-Postgres link ( ) to open the Datastore dashboard. On the Datastore dashboard select the settings link and click on the View Credentials button
The provided values from the following fields are used to establish a connection to the database: Host
, Database
, User
, Port
, Password
See Use pgAdmin4 to Connect to Heimdall Heroku Postgres Instances for establishing a connection to the database.
To retrieve the database credentials we need to install The Heroku CLI and Connect to Heroku via Heroku CLI.
Next use the Heroku CLI to retrieve the connection information for a hosting Heroku-Postgres database.
To get the credential for the mitre-heimdall
staging instance use:
heroku pg:credentials:url DATABASE -a mitre-heimdall-staging
To get the credential for the mitre-staging
production instance use:
heroku pg:credentials:url DATABASE -a mitre-heimdall
See Connecting to Heroku Postgres for additional information
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
Connect to the Heroku hosting site, navigate to the appropriate project, select the appropriate deployed instance (e.g., staging or prod), on the provided dashboard select (click) on the Heroku-Postgres link ( ) to open the Datastore dashboard. On the Datastore dashboard select the settings link and click on the Reset Database button.
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) );
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.