Configure the Kong Gateway datastore on Linux

Uses: Kong Gateway
Related Documentation
Incompatible with
konnect
Minimum Version
Kong Gateway - 3.4
TL;DR

After installing the database, configure kong.conf to connect to PostgreSQL, run kong migrations bootstrap to initialize the schema, then start Kong Gateway.

Prerequisites

Configure PostgreSQL

  1. Switch to the default PostgreSQL user:

     sudo -i -u postgres
    
    Copied to clipboard!
  2. Start the PostgreSQL shell:

     psql 
    
    Copied to clipboard!
  3. Create a kong user and password:

     CREATE USER kong WITH PASSWORD 'super_secret';
    
    Copied to clipboard!
  4. Create a database titled kong and assign the user as an owner:

     CREATE DATABASE kong OWNER kong;
    
    Copied to clipboard!
  5. Exit PostgreSQL, and exit the PostgreSQL shell:

     exit
    
    Copied to clipboard!

Run a Kong Gateway database migration

kong migrations is used to configure the database for the first time. Running bootstrap forces Kong Gateway to bootstrap the database set up in the previous step and run all of the migrations:

kong migrations bootstrap
Copied to clipboard!

This command must be run as the root user.

Validate

You can validate that the datastore was configured correctly by starting Kong Gateway.

  1. Start Kong Gateway:

     kong start
    
    Copied to clipboard!
  2. Verify the installation:

     curl -i http://localhost:8001
    
    Copied to clipboard!

    If you receive a 200 status code, Kong Gateway was configured correctly.

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!