Skip to main content

Promoting gateway configuration from staging to production

Copy a Route and its Upstream from Staging to Production, read what the copy changes before it is written, and find the copy in the target's audit log.

By Akif F. Güven Operations

What you will have at the end

The Route payments-api and the Upstream it sends traffic to, copied from the Staging Environment to Production without retyping anything, with the secrets left behind on purpose. You will have read what each copy changes before it was written, and found the copies in Production’s audit log with the Environment they came from.

Prerequisites

  • Two Environments, and a role that may manage Routes and Upstreams in the target. The dialog lists only the targets your role allows.
  • The Route in the source Environment. If it refers to an Upstream, Service or Consumer, those are copied first.

Step 1: open the dialog

Open the Route or Upstream in the source Environment and choose Copy to environment… from its menu. Choose the target, and the dialog reads the target before anything is written. What will change lists what it found:

  • Missing dependencies. Objects the copy refers to that do not exist in the target yet. A Route whose Upstream is not there is named like this, and the engine refuses the Route until the Upstream is copied first.
  • Secrets. Copied only while Copy secrets too is selected. Left unselected, every secret of the object is listed as dropped, by its path, with the note that it has to be set again in the target.
  • What will change. If the object already exists in the target, the copy replaces it, and the lines it adds and removes are listed with a count.

The Copy to environment dialog for the orders-api Route with Production as the target and Copy secrets too unselected: What will change lists the Redis password of limit-count as dropped and names the Upstream that does not exist in Production, to be copied first or the engine refuses the Route The dialog on a Route whose Upstream is not in the target yet, and whose one secret stays behind. Nothing was written; copy the Upstream first.

Step 2: copy the Upstream, then the Route

Open in Production takes you to a new-object page in the target, filled with the copy. A banner says where it came from and what was dropped, the id is kept so that the copy replaces an existing object rather than creating a second one, and nothing is written until you select Create. The page below is the Upstream payments-backend on its way to Production; the Route follows the same way once the Upstream exists there.

The New upstream page in Production, filled from the copy: a banner reading Copied from Staging with the source id, the id kept from the copy, and the JSON of the Upstream ready to create The copy is a draft in the target. Change the id to create a second object; keep it to replace the one that is there.

Step 3: copy a change to an object that already exists

Edit the Route in Staging and open the dialog again. Now the Route exists in Production, so the dialog says the copy replaces it and shows the lines that differ; with Copy secrets too unselected, the three secrets of this Route are listed as dropped above the diff.

The Copy to environment dialog for the payments-api Route with Production as the target: Copy secrets too unselected, three secrets listed as dropped with their paths, the note that the Route already exists in Production, and the diff summary +2 −6 with the changed description line The second copy of the same Route: the secrets stay behind, the Route exists in Production already, and the description line is the change. The diff scrolls for the lines below the summary.

What the audit log keeps

The create in the target is an audit record of the target Environment, and its details carry copied_from with the source Environment and object. The record below is from the first copy of this Route, made with Copy secrets too selected; that is why the three masked paths appear as changed, with their values masked in the record.

The Details section of the Production audit record for the copied Route: changed_masked_paths listing the three secrets, and copied_from staging/routes/00000000000000010151 The record in Production says where the Route came from. The source Environment’s log keeps the original changes.

Protected Environments

In a protected Environment, destructive actions ask for the resource name before they run; the Environments page marks such an Environment as Protected. The copy itself is a change like any other: it passes the role check in the target and is recorded in the target’s audit log.

What to do next

Written by
Akif F. Güven
Engineer, G8
Was this helpful?
Next step

See G8 in a demo

We’ll show you the console with APIs and AI traffic like yours, and answer the questions these articles leave open.

  1. 01Demo
  2. 02Proof of conceptOn Docker for a quick start, or on the infrastructure you plan to run G8 on.
  3. 03LicenseWe prepare a quote for your edition and nodes, and you receive a signed license file.