In the near future we will be releasing an update that requires operators to add a database on the gateway computer.
Currently, the handbook only covers the setup of the node database. We will be revising the handbook once the update has been released but in the meantime, I wanted to get a head start so operators have time to setup the gateway database and get help if they run into any problems.
There are two hardware configurations listed in the hand handbook:
- Two Computers: The node and gateway processes are run on different computers.
- One Computer: The node and gateway processes are run on the same computer.
If you run the node and gateway software on one computer, please refer to Adding the Gateway Database (One Computer)
This post is for operators who run the node and gateway software on separate computers. All of the following will be performed on the the gateway computer.
Install PostgreSQL and its dependencies.
$ sudo apt install -y postgresql-client postgresql postgresql-contrib
Once the installation is complete, enable the PostgreSQL service.
$ sudo update-rc.d postgresql enable
Next, start the service.
$ sudo service postgresql start
Create a database user with the username
cmix, which is used to access the database.
$ sudo -u postgres createuser --createdb --pwprompt cmix
You will be asked to set a password for the cmix user. Create a long and secure password and note, once the update has been released you will need this password for the gateway.yaml file that will be included in the future update.
Enter password for new role: Enter it again:
Create the required database with the name
$ sudo -u postgres createdb -O cmix cmix_gateway
Login to the user postgres, which was automatically created to run the PostgreSQL database server.
$ sudo su postgres
Run the command psql to start the interactive PostgreSQL session.
NOTE: The command prompt has changed from $ to # .
Just as you don’t type the $, don’t type the #.
Once at the postgres prompt, enter in
\lto get a list of databases.
The database has been set up correctly if the newly created database cmix_gateway with the owner cmix exists.
List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+----------+----------+-------------+-------------+----------------------- cmix_gateway | cmix | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres
To quit psql, enter
Exit from the postgres use account
Modify the gateway.yaml file.
$ nano /opt/xxnetwork/gateway.yaml
Add the following code to the bottom of the gateway.yaml file.
# Database connection information dbUsername: "cmix" dbPassword: "PASSWORD" dbName: "cmix_gateway" dbAddress: "0.0.0.0:5432"
- Save and exit nano by pressing Ctrl+s then Ctrl+x
If you need any help, please feel free to DM me on the xx network Discord channel. My ID is Keith aka LordVetinari#9085 It might take me a few hours to get back to you as I am on Korean Standard Time.
Don’t panic, take a step back from the computer and I’ll be with you ASAP.
Thanks for running a node!