nifectl bg Command Reference
Manage blue-green deployments.
Overview​
The bg commands manage blue-green deployments. An app has two colour slots, blue and green, and only one of them serves live traffic. Redeploy with --deployment_strategy blue-green, check which colour is live with bg status, and move traffic to the other colour with bg switch.
Subcommands​
| Subcommand | Description |
|---|---|
bg switch | Switch live traffic to the specified color slot |
bg status | Show the current blue-green deployment status |
bg rollback | Roll back to the previously active color slot |
nifectl bg <subcommand> [flags]
Options​
-a, --app string App name to operate on (env: NIFE_APP)
-c, --config string Path to an app config file or directory containing one (env: NIFE_APP_CONFIG)
-h, --help Help for bg
Global Options​
-t, --access-token string Nife API Access Token
-j, --json JSON output format
-V, --verbose Verbose / debug output
bg switch​
Switch live traffic to the specified color slot.
Move production traffic from the currently active color to the target color. The target environment is validated before the switch (use --no-validate to skip). Auto-rollback is enabled by default if errors are detected after the switch.
nifectl bg switch <blue|green> [flags]
Options:
-a, --app string App name to operate on (env: NIFE_APP)
-c, --config string Path to an app config file or directory containing one (env: NIFE_APP_CONFIG)
--no-validate Skip pre-switch health validation of the target slot
--no-auto-rollback Disable automatic rollback if errors are detected post-switch
--monitor-seconds int Seconds to monitor after switch before declaring it stable (default 300)
Examples:
nifectl bg switch green -a myapp
nifectl bg switch blue -a myapp --no-validate
bg status​
Show the current blue-green deployment status.
Display which color slot is currently active, the image running in each slot, pod counts, and health for the app's blue-green deployment.
nifectl bg status [flags]
Options:
-a, --app string App name to operate on (env: NIFE_APP)
-c, --config string Path to an app config file or directory containing one (env: NIFE_APP_CONFIG)
bg rollback​
Roll back to the previously active color slot.
Switch traffic back to whichever color was active before the last 'bg switch', without needing to specify the color explicitly.
nifectl bg rollback [flags]
Options:
-a, --app string App name to operate on (env: NIFE_APP)
-c, --config string Path to an app config file or directory containing one (env: NIFE_APP_CONFIG)
Best Practices​
- Run
nifectl bg statusbefore switching to see which colour is live and how healthy each side is. - Leave validation and auto-rollback on (the default):
bg switchchecks the target first and rolls back if errors appear after the switch. --monitor-secondssets how long the new colour is watched after the switch (default 300).nifectl bg rollbackgoes back to the previously live colour without you naming it.
See Also​
nifectl canary– Roll out to a share of pods firstnifectl abtest– Run two versions side by sidenifectl releases– Release history and rollbacknifectl– The Nife CLI home command
Summary​
Nifectl Bg gives blue-green deployments a safe, checked switch with automatic rollback.