Skip to content

Database Setup

Spotlight edited this page Aug 9, 2022 · 4 revisions

Setting up PostgreSQL

This page aims to set up the PostgreSQL database needed for room-server. The database is used so we can dynamically add data to room-server rather than editing a file ourself.

Installing PostgreSQL

Installing PostgreSQL depends on your system. If you do not have a package manager installed, you will need to download PostgreSQL here. Despite this, it is highly advised that you install PostgreSQL via a package manager.

Windows (using winget)

winget install PostgreSQL.PostgreSQL

macOS (using brew)

brew install postgresql

On Linux based distributions, install via your system's package manager.

Creating the database

Once PostgreSQL is finished downloading, you will need to create the database.

If you installed via a package manager on either macOS or a linux based distribution, open the command line of your choice and run the below. It should be noted that in some cases you may need to run these commands with sudo.

psql -c "CREATE USER username WITH PASSWORD 'password';"

psql -c "CREATE DATABASE database_name OWNER owner;"

On Windows you will need to run the above, but first you will need to find the psql binary installed to your system. In the above commands, replace psql with the path to your psql binary.

What's next?

After all the above is complete, you will need to edit line 5 in config-example.py with your database credentials and name. Then you will need to rename config-example.py to config.py.

db_url = "postgresql://username:password@localhost/database_name"

Database setup is complete!

Clone this wiki locally