Skip to main content

Database Setup

ServerRawler stores all collected server data in a PostgreSQL database. This guide will walk you through setting up your database and configuring ServerRawler to connect to it.

tip

If you prefer to run ServerRawler without a database, you can skip this section and use the --no-database argument.

Why PostgreSQL?

PostgreSQL is a powerful, open-source relational database system that offers robust performance, scalability, and advanced features. It is well-suited for handling the large volumes of data generated by ServerRawler's scanning operations.

info

If you already have a PostgreSQL database set up and just need to configure ServerRawler to connect to it, jump to step 4.

1. Installing PostgreSQL

The official PostgreSQL website provides already an easy to follow installation guide for all major operating systems: See here

2. Correct UTF-8 Encoding

ServerRawler requires the database to use UTF-8 encoding to properly read error messages and other text data.
If your PostgreSQL database is not configured to use UTF-8 encoding, you may encounter issues with ServerRawler not working correctly and not providing understandable error messages.

Important

If your PostgreSQL database is not configured to use UTF-8 encoding, ServerRawler will not work correctly and don't give you any understandable error message.

To do this you will need to replace the lc_messages setting in your postgresql.conf file with the following line:

postgresql.conf
lc_messages = 'en_US.UTF-8'

3. Create the Database and User

You can typically create a user and database using the psql command-line tool. We will create a user named serverrawler_usr with the passowrd your_strong_password and a database named serverrawler_db in this example.

tip

Make sure to replace the username, password, and database name with your own secure values in and remember them (or save them) for the next step when configuring ServerRawler.

# Connect with psql console to PostgreSQL as a superuser (usually postgres)
psql -U postgres

# Create a dedicated user for ServerRawler (replace with your desired username and password)
CREATE USER "serverrawler_usr" WITH PASSWORD 'your_strong_password';

# Create the database
CREATE DATABASE "serverrawler_db" OWNER "serverrawler_usr";

# Grant all privileges on the database to the new user
GRANT ALL PRIVILEGES ON DATABASE "serverrawler_db" TO "serverrawler_usr";

# Exit psql console
\q

4. Configure ServerRawler for Database Connection

The next step is now, to edit the database.toml file. Use the Database Configuration Guide to set up your database connection details.