Skip to content

Install the gateway on your own server (Enterprise)

Enterprise only. This page is about the Portward gateway that a company runs in its own cloud. If Portward runs it for you, on the web, this page doesn’t apply: see the page for Portward on the web.

This guide is for the person who runs servers at your company. It runs the Portward gateway with Docker Compose on a Linux machine in your own network, and takes about 30 minutes. On AWS, Azure or Google Cloud, a template sets up the same gateway for you. See Pick a cloud.

Start with steps 1 to 3 of Get started. When you finish them, you have your license key (pwlic_…) and your gateway’s address.

  • A small Linux server with Docker, in the network that can reach your databases. 1 CPU and 1 GB of memory is enough to start. A cloud VM is fine.
  • An address for the gateway. By default it is https://<name>.gw.portward.ai, which reaches the server through the Portward relay with no inbound ports. You can also use a name of your own, such as portward.yourcompany.com. In that case ports 80 and 443 must be open to the internet, because Claude and ChatGPT connect from their own servers. The rest of this guide uses portward.yourcompany.com as your address.
  • Your company directory. This can be Microsoft Entra, Okta, Google Workspace, or any OpenID Connect directory. If you don’t have one, a sign-in provider such as WorkOS AuthKit works instead (step 1b).
  • Read-only logins for the databases you’ll connect. Portward refuses a login that can write.

1. Set up sign-in with your directory (10 minutes)

Section titled “1. Set up sign-in with your directory (10 minutes)”

Register one app for the gateway in your directory, with the redirect address https://portward.yourcompany.com/auth/callback. Sign-in setup has the steps for Entra, Okta and Google. Keep the app’s issuer, client id and secret, and the admin group’s id or name. You need them in step 2.

1b. Or with WorkOS, without a directory (5 minutes)

Section titled “1b. Or with WorkOS, without a directory (5 minutes)”

Set up WorkOS AuthKit as Sign-in setup describes. Keep your AuthKit domain for step 2.

Run one gateway per license key. Don’t start a second install folder with the same key.

On the server, create an empty folder and go into it. Give it a name that no other install on the server uses. Docker Compose names the containers and volumes after the folder, so two installs in folders with the same name would share them. Put your license key in a variable so you don’t type it into a command line. Then use it to sign in to Portward’s image registry and run the installer. If you use Okta, read “With Okta” below first.

Terminal window
read -rs PORTWARD_LICENSE && export PORTWARD_LICENSE # paste the key, then Enter
printf %s "$PORTWARD_LICENSE" | docker login registry.portward.ai -u portward --password-stdin
docker run --rm -e PORTWARD_LICENSE --user "$(id -u):$(id -g)" -v "$PWD:/install" -w /install \
registry.portward.ai/portward/gateway:1.1.1 init --directory <issuer> --client-id <client id> --admin-group "<group>"

With WorkOS, use --issuer https://your-team.authkit.app in place of --directory, --client-id and --admin-group.

With Okta, init in 1.1.0 refuses Okta’s org server (https://<your org>.okta.com) with “doesn’t publish a plain https jwks_uri”. Give it https://<your org>.okta.com/oauth2/default as <issuer> instead. Then open portward.toml in a text editor. Under [auth], set directory to Okta’s org server, the same way Sign-in setup uses it. Add a scopes line right below it, because Okta sends groups only when asked for them. Leave the comment lines as they are:

directory = "https://<your org>.okta.com"
scopes = ["groups"]

With a directory, the app’s secret goes in .env, on the empty PORTWARD_DIRECTORY_SECRET= line that init wrote. To put it there without typing it into a command line, run:

Terminal window
read -rs SECRET # paste the app's client secret, then Enter
(umask 077; grep -v '^PORTWARD_DIRECTORY_SECRET=' .env > .env.new && \
printf 'PORTWARD_DIRECTORY_SECRET=%s\n' "$SECRET" >> .env.new) && mv .env.new .env

The installer writes the files below. It also writes relay.toml and relay.env for the relay client. relay.env holds your license key and only the owner can read it. To use your own address instead of the relay, add --domain portward.yourcompany.com. You then point that name at the server and open ports 80 and 443 in step 3.

The installer ends with a short list of next steps, and steps 3 to 6 below follow that list. With a directory, the 1.1.0 list says “add both addresses above” but doesn’t list them. They are the admin connector (step 4) and the data connector (step 6). Where the list or portward.toml names docs/sign-in.md or docs/install.md, it means Sign-in setup and this page.

FileWhat it is
portward.tomlThe gateway’s settings. You’ll edit admin_subjects and setup_hosts here.
.envThe gateway key, and with a directory the app’s secret. Back it up and keep it secret. Saved connections can’t be opened without the key.
compose.yamlThe gateway, plus Caddy, which gets and renews the HTTPS certificate automatically.
CaddyfileCaddy’s one-line setting for your address.

No inbound ports: the Portward relay (the default)

Section titled “No inbound ports: the Portward relay (the default)”

With the relay, skip the DNS and firewall steps below. The gateway connects out on port 443 and opens nothing inbound. The relay passes your traffic through without decrypting it, and the certificate stays on your server. To put in a new license key later, see Replace a license key.

  1. If you use your own address, point portward.yourcompany.com at the server with a DNS A record, and open ports 80 and 443. With the relay, skip this step.
  2. docker compose up -d
  3. docker compose exec gateway portward --config /config/portward.toml doctor

doctor checks what Claude and ChatGPT need, from outside the server. It checks the HTTPS certificate, the sign-in provider, sign-in for both connectors, and the records. For each problem it tells you what to fix.

  1. Add the admin connector, https://portward.yourcompany.com/admin/mcp, in Claude or ChatGPT and sign in. Get started, step 7 shows where to add it.
  2. Members of the group you gave as --admin-group become admins as soon as they sign in. Without an admin group, as with WorkOS, the gateway refuses your first sign-in because no one is an admin yet. The log names your sign-in id. Find it with docker compose logs gateway | grep "admin connector refused".
  3. Without an admin group, put that id in admin_subjects in portward.toml. Then run docker compose restart gateway and connect again.
  1. In portward.toml, list in setup_hosts the database hosts that admins may connect. For example, use ["db.internal.yourcompany.com"], or "*.yourcompany.internal" for a whole domain. Then run docker compose restart gateway.
    • Object stores on their cloud’s own endpoint (S3, Azure Blob, Cloud Storage), BigQuery, Microsoft 365 and Google Drive need no entry.
    • Snowflake needs its account’s host, such as youraccount.snowflakecomputing.com.
    • A host on a domain that other customers share needs its exact name, never a wildcard. This applies to an RDS or Redshift endpoint (*.amazonaws.com, such as wg.123456789012.us-east-1.redshift-serverless.amazonaws.com) and to a Databricks workspace (such as dbc-1234abcd-5678.cloud.databricks.com).
    • Redshift IAM sign-in without an access key uses the gateway’s own AWS role. This is off until you set PORTWARD_REDSHIFT_GATEWAY_ROLE=1.
  2. Set up the connection from the admin connector and choose what the AI may see. See Get started, step 8.
  1. In portward.toml, say who may use the data connector. Then run docker compose restart gateway.

    • With Entra or Okta, by group. Keep users = [] and list the groups in user_groups. Don’t remove the users line. Without it, everyone your directory lets in can ask.
      users = []
      user_groups = ["Portward Users"]
      Entra sends group Object IDs and Okta sends group names. The group must be assigned to the sign-in app. With Okta, it must also pass the groups claim filter (Sign-in setup, step 3). Entra doesn’t mark emails as verified, so an email domain doesn’t work there.
    • With Google Workspace or WorkOS, by email.
      users = ["@yourcompany.com"] # everyone whose verified email is at yourcompany.com
      # users = ["user_01ABC", "dana@yourcompany.com"] # or people one by one
      A whole domain needs a verified email in the sign-in token. Google Workspace sends one. In WorkOS, add email and email_verified to the access token’s JWT template. Otherwise, list people by id.

    With users and user_groups both empty, only admins can ask. This is enough for a first test. In 1.1.0, the users line in doctor’s output counts only the users entries, not the groups. The log names anyone the gateway refuses. Find them with docker compose logs gateway | grep "data connector refused".

  2. Everyone adds the data connector, https://portward.yourcompany.com/mcp. See Get started, step 9.

  • Updates, backups and automatic updates. See Update and back up. Keep .env separate from the data. It holds the gateway key, which backups need but don’t contain.
  • Check the records. docker compose exec gateway portward --config /config/portward.toml records verify confirms that no answer record, reveal (a Show of a hidden value) or setup change was altered or removed.
  • Logs. Run docker compose logs gateway. Logs name people by their sign-in id and never contain row values.
  • After docker compose restart gateway, the address returns 502 for about 2 seconds, until the gateway is up again.
doctor saysFix
no valid HTTPS certificate yetDNS doesn’t point at the server yet, or ports 80/443 are closed. docker compose logs https shows Caddy’s attempts.
didn’t answerThe containers aren’t running (docker compose ps), or a firewall blocks the server.
discovery … doesn’t namepublic_url in portward.toml doesn’t match the address people use.
sign-in provider didn’t answerThe directory address (with WorkOS, issuer) in portward.toml is wrong, or the server can’t reach the internet.
nobody is an admin yetStep 4.
anyone … signs in can use the data connectorAdd users = [...] under [auth] (step 6).

If you use WorkOS and Claude can’t connect even though doctor passes, check WorkOS’s Resource Indicators. Both connector addresses must be there exactly, with https:// and no trailing slash.