This guide explains how to configure a VT Docs server installed on an AWS EC2 instance can be configured to use AWS RDS as a database.
Note: This guide assumes you running VT Docs on either RHEL or AWS Linux and you are running VT Docs 3.4.2 or greater.
Install on RDS
For this, you will need a Postgresql 12 RDS instance setup. It should be a part of the same security group that the EC2 VT Docs instance is a member of so they can communicate via port 5432.
The RDS instance should have the following parameter set:
When creating the Postgresql RDS instance you will be asked to provide a master username and password for the database
By default the master username is ‘postgres’. In the instructions below replace <master user> with the Postgres master username.
Creating the VT Docs user and Schema
The first step to complete is to create the VT Docs user and database in Postgres. Once that is complete we can bootstrap the database with an empty VT Docs schema.
Creating the VT Docs database and user
Download the sql file listed below to create VT Docs user and database structure on your external PostgreSQL:
On your EC2 instance, use psql to run the file 'createDocsDB.sql' as the master user. In the example below we are using the default master user “postgres”.
This will create a database called “vtdocs” with a database user called “vtdocs”. You must specify a password you wish to use for this database user.
mkdir vtsetuptmp cd vtsetuptmp curl https://visiblethread.s3.amazonaws.com/public/download/createDocsDB.sql > createDocsDB.sql psql -h <postgresql RDS endpoint name> -p 5432 -d postgres -U <master user> -f createDocsDB.sql -v pwd="'a secure password'"
Create the empty VT Docs Schema
Download the SQL file from here:
Run the attached file 'vtdocs-tables.sql' as the vtdocs user (you will be prompted for a password. Enter the password you specified above). The exact format for connecting with a psql client will depend on your system. An example is listed below:
curl https://visiblethread.s3.amazonaws.com/public/download/vtdocs-tables.sql > vtdocs-tables.sql psql -h <postgresql RDS endpoint name> -p 5432 -U vtdocs -f vtdocs-tables.sql
Modify the VT Docs application config to point to your Database server
On your EC2 instance that is running VT Docs, navigate to the following folder:
Open the ‘context.xml’ file for editing:
sudo pico context.xml
Update the line that contains url="jdbc:postgresql://127.0.0.1:5432/visiblethread" with url="jdbc:postgresql://<rds-endpoint-address>:5432/vtdocs"
Update the line that contains username="visiblethread" with username="vtdocs"
Update password="password" with the password you have specified for the vtdocs user above.
Save and exit pico with ctrl + o, enter then ctrl + x, enter.
Restart the VT Docs services:
sudo service visiblethread-docs restart
When complete, restart the Apache service
sudo systemctl restart httpd