PostgreSQL Database Backend
A PostgreSQL databse is utilized to prevent duplicate DSP transactions by creating, getting, and updating service events as needed. An external database can be set by ensuring the node_env variable in the config.toml file is set to production. The database settings may be specified with the url variable, e.g., postgres://user:[email protected]:5432/dbname.
config.toml:
[database]
# url syntax: postgres://user:[email protected]:5432/dbname, only necessary for production
url = "postgres://user:[email protected]:5432/dbname"
# production (uses above database_url for database)
node_env = "production"wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-12 postgresql-client-12Setup database and user
sudo su - postgres
psql
CREATE DATABASE dsp;
CREATE USER dsp WITH ENCRYPTED PASSWORD 'Put-Some-Strong-Password-Here';
GRANT ALL PRIVILEGES ON DATABASE dsp to dsp;Create vRAM IPFS Tables
Install Go and prereqs
Note if you are setting up the PostgreSQL server for vRAM where other users were previously using that service, you will need to see the replay contract section to replay all staked contracts to populate the DB with their data. Otherwise the db will not be able to fetch that info.
Run PostgreSQL server for IPFS
Systemd service
Run which go to see where your install location is, if it is not /usr/local/go/bin/go, update the ExecStart below with your path.
Last updated
Was this helpful?