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.
What you need
Section titled “What you need”- 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 asportward.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 usesportward.yourcompany.comas 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.
2. Create the install files (2 minutes)
Section titled “2. Create the install files (2 minutes)”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.
read -rs PORTWARD_LICENSE && export PORTWARD_LICENSE # paste the key, then Enterprintf %s "$PORTWARD_LICENSE" | docker login registry.portward.ai -u portward --password-stdindocker 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:
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 .envThe 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.
| File | What it is |
|---|---|
portward.toml | The gateway’s settings. You’ll edit admin_subjects and setup_hosts here. |
.env | The 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.yaml | The gateway, plus Caddy, which gets and renews the HTTPS certificate automatically. |
Caddyfile | Caddy’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.
3. Start it (5 minutes)
Section titled “3. Start it (5 minutes)”- If you use your own address, point
portward.yourcompany.comat the server with a DNS A record, and open ports 80 and 443. With the relay, skip this step. docker compose up -ddocker 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.
4. Make yourself the admin (3 minutes)
Section titled “4. Make yourself the admin (3 minutes)”- 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. - Members of the group you gave as
--admin-groupbecome 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 withdocker compose logs gateway | grep "admin connector refused". - Without an admin group, put that id in
admin_subjectsinportward.toml. Then rundocker compose restart gatewayand connect again.
5. Connect your data (10 minutes)
Section titled “5. Connect your data (10 minutes)”- In
portward.toml, list insetup_hoststhe database hosts that admins may connect. For example, use["db.internal.yourcompany.com"], or"*.yourcompany.internal"for a whole domain. Then rundocker 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 aswg.123456789012.us-east-1.redshift-serverless.amazonaws.com) and to a Databricks workspace (such asdbc-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.
- Set up the connection from the admin connector and choose what the AI may see. See Get started, step 8.
6. Give your team access
Section titled “6. Give your team access”-
In
portward.toml, say who may use the data connector. Then rundocker compose restart gateway.- With Entra or Okta, by group. Keep
users = []and list the groups inuser_groups. Don’t remove theusersline. Without it, everyone your directory lets in can ask.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.users = []user_groups = ["Portward Users"] - With Google Workspace or WorkOS, by email.
A whole domain needs a verified email in the sign-in token. Google Workspace sends one. In WorkOS, addusers = ["@yourcompany.com"] # everyone whose verified email is at yourcompany.com# users = ["user_01ABC", "dana@yourcompany.com"] # or people one by one
emailandemail_verifiedto the access token’s JWT template. Otherwise, list people by id.
With
usersanduser_groupsboth empty, only admins can ask. This is enough for a first test. In 1.1.0, theusersline in doctor’s output counts only theusersentries, not the groups. The log names anyone the gateway refuses. Find them withdocker compose logs gateway | grep "data connector refused". - With Entra or Okta, by group. Keep
-
Everyone adds the data connector,
https://portward.yourcompany.com/mcp. See Get started, step 9.
Running it
Section titled “Running it”- Updates, backups and automatic updates. See Update and back up.
Keep
.envseparate 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 verifyconfirms 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.
If something’s wrong
Section titled “If something’s wrong”doctor says | Fix |
|---|---|
| no valid HTTPS certificate yet | DNS doesn’t point at the server yet, or ports 80/443 are closed. docker compose logs https shows Caddy’s attempts. |
| didn’t answer | The containers aren’t running (docker compose ps), or a firewall blocks the server. |
| discovery … doesn’t name | public_url in portward.toml doesn’t match the address people use. |
| sign-in provider didn’t answer | The directory address (with WorkOS, issuer) in portward.toml is wrong, or the server can’t reach the internet. |
| nobody is an admin yet | Step 4. |
| anyone … signs in can use the data connector | Add 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.