nifectl failover Command Reference
Serve an app from your own servers, with nife cloud as backup.
Overview​
Per-app failover: traffic goes to a primary backend (for example your own data centre) while it is healthy, switches to the backups when it fails its health checks, and comes back automatically when it recovers. By default the backup is the app's nife cloud deployment.
Subcommands​
| Subcommand | Description |
|---|---|
failover show | Show an app's failover setup and which backend is serving |
failover enable | Turn on failover, or change its settings |
failover disable | Turn off failover |
nifectl failover <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 failover
Global Options​
-t, --access-token string Nife API Access Token
-j, --json JSON output format
-V, --verbose Verbose / debug output
failover show​
Show an app's failover setup and which backend is serving.
Show the app's backends in priority order, their health, and which one is receiving traffic right now.
nifectl failover show [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)
Examples:
nifectl failover show -a myapp
failover enable​
Turn on failover, or change its settings.
Serve the app from a primary backend, for example your own data centre, and switch to the backups only while the primary fails its health checks. Traffic returns to the primary automatically when it recovers.
Without --backup, the app's current nife cloud deployment becomes the backup. Run it again to change the primary, backups, health-check path or threshold.
The primary must be reachable from the internet. Apps that store data need that data available on both the primary and the backup.
nifectl failover enable [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)
--primary string Backend that serves normally, e.g. http://203.0.113.10:8080 (required)
--backup strings Backend to use when the primary is down; repeat for more, in order (default: the app's nife cloud deployment)
--health-path string Path to probe, e.g. /health ("" resets to the default)
--threshold int Failed health checks in a row before switching, 1-10 (default 3)
Examples:
nifectl failover enable -a myapp --primary http://203.0.113.10:8080
nifectl failover enable -a myapp --primary https://dc.example.com \
--health-path /health --threshold 2
nifectl failover enable -a myapp --primary http://203.0.113.10:8080 \
--backup https://backup.example.net
nifectl failover enable -a myapp --primary http://203.0.113.10:8080 \
--health-path "" # reset to the default health-check path
failover disable​
Turn off failover.
Remove the primary backend and go back to the app's normal routing, so all traffic goes to the remaining backends (normally the nife cloud deployment).
nifectl failover disable [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)
-y, --yes Don't ask for confirmation
Examples:
nifectl failover disable -a myapp
Best Practices​
- Make sure the primary is reachable from the internet before you enable failover.
- Apps that store data need that data available on both the primary and the backup.
- Without
--backup, the app's nife cloud deployment is the backup. Repeat--backupto add more, in order. - Run
nifectl failover showto see which backend is serving traffic right now.
See Also​
nifectl status– Show application statusnifectl regions– Manage the regions an app runs innifectl– The Nife CLI home command
Summary​
Nifectl Failover keeps an app online when your own servers go down, and moves traffic back by itself when they recover.