Skip to main content

Set up PostgreSQL database

Rell requires PostgreSQL 11. The IDE can work without it but can't run a node. A console or a remote postchain app can run without a database.

The default database configuration for Rell is:

  • database: postchain
  • user: postchain
  • password: postchain

Ubuntu (Debian)

Install PostgreSQL:

sudo apt-get install postgresql

Prepare a PostgreSQL database:

sudo -u postgres psql -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8' ENCODING 'UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

MacOS

Install Homebrew: Homebrew installation guide

Install PostgreSQL:

brew install postgresql
brew services start postgresql
createuser -s postgres

Prepare a PostgreSQL database:

psql -U postgres -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' ENCODING 'UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

If you get an error saying that peer authentication failed, you need to change the authentication method from peer to md5. You can change it in the pg_hba.conf file of your psql database.

Docker

Install Docker: Docker Installation Guide.

Prepare a PostgreSQL database:

docker run --name postchain -e POSTGRES_INITDB_ARGS="--lc-collate=C.UTF-8 --lc-ctype=C.UTF-8 --encoding=UTF-8" -e POSTGRES_USER=postchain -e POSTGRES_PASSWORD=postchain -p 5432:5432 -d postgres

Awesome! Now you have a PostgreSQL database setup and are ready to move on to the next step. Now, you can create a simple Hello World dapp using one of the available tools in the Build and run Hello World dapp section.