Deploying EdgeDB to a Bare Metal Server

In this guide we show how to deploy EdgeDB to bare metal using your system’s package manager and systemd.

Install the EdgeDB Package

The steps for installing the EdgeDB package will be slightly different depending on your Linux distribution. Once you have the package installed you can jump to Enable a systemd unit.

Debian/Ubuntu LTS

Import the EdgeDB packaging key.

  1. $
  1. sudo mkdir -p /usr/local/share/keyrings && \
  2. sudo curl --proto '=https' --tlsv1.2 -sSf \
  3. -o /usr/local/share/keyrings/edgedb-keyring.gpg \
  4. https://packages.edgedb.com/keys/edgedb-keyring.gpg

Add the EdgeDB package repository.

  1. $
  1. echo deb [signed-by=/usr/local/share/keyrings/edgedb-keyring.gpg] \
  2. https://packages.edgedb.com/apt \
  3. $(grep "VERSION_CODENAME=" /etc/os-release | cut -d= -f2) main \
  4. | sudo tee /etc/apt/sources.list.d/edgedb.list

Install the EdgeDB package.

  1. $
  1. sudo apt-get update && sudo apt-get install edgedb-2

CentOS/RHEL 7/8

Add the EdgeDB package repository.

  1. $
  1. sudo curl --proto '=https' --tlsv1.2 -sSfL \
  2. https://packages.edgedb.com/rpm/edgedb-rhel.repo \
  3. > /etc/yum.repos.d/edgedb.repo

Install the EdgeDB package.

  1. $
  1. sudo yum install edgedb-2

Enable a systemd unit

The EdgeDB package comes bundled with a systemd unit that is disabled by default. You can start the server by enabling the unit.

  1. $
  1. sudo systemctl enable --now edgedb-server-2

This will start the server on port 5656, and the data directory will be /var/lib/edgedb/1/data. You can edit the unit to specify server arguments via the environment. The variables are largely the same as those documented for Docker.

Set a Password

There is no default password. Set a password by connecting from localhost.

  1. $
  1. echo -n "> " && read -s PASSWORD
  1. $
  1. sudo edgedb --port 5656 --tls-security insecure --admin query \
  2. "ALTER ROLE edgedb SET password := '$PASSWORD'"

The server listens on localhost by default. Changing this looks like this.

  1. $
  1. edgedb --port 5656 --tls-security insecure --password query \
  2. "CONFIGURE INSTANCE SET listen_addresses := {'0.0.0.0'};"

The listen port can be changed from the default 5656 if your deployment scenario requires a different value.

  1. $
  1. edgedb --port 5656 --tls-security insecure --password query \
  2. "CONFIGURE INSTANCE SET listen_port := 1234;"

You may need to restart the server after changing the listen port or addresses.

  1. $
  1. sudo systemctl restart edgedb-server-2

Linking a Bare Metal Instance

The following is an example of linking a bare metal instance that is running on localhost.

  1. $
  1. edgedb instance link \
  2. --host localhost \
  3. --port 5656 \
  4. --user edgedb \
  5. --database edgedb \
  6. --trust-tls-cert \
  7. bare_metal_instance

This allows connecting to the instance with it’s name.

  1. $
  1. edgedb -I bare_metal_instance

Upgrading EdgeDB

When you want to upgrade to the newest point release upgrade the package and restart the edgedb-server-2 unit.

Debian/Ubuntu LTS

  1. $
  1. sudo apt-get update && sudo apt-get install --only-upgrade edgedb-2
  1. $
  1. sudo systemctl restart edgedb-server-2

CentOS/RHEL 7/8

  1. $
  1. sudo yum update edgedb-2
  1. $
  1. sudo systemctl restart edgedb-server-2