How to enable and disable maintenance mode on your Developer Portal
You can use the Portal commands in the toolkit CLI to enable and disable maintenance mode on your Developer Portal site.
Before you begin
To complete this Portal CLI scenario, you must have a Developer Portal
enabled. You must also have administrator access to this site, and the permission
settings:manage
, to complete this scenario. The tutorial Creating the Portal explains how to enable the
portal if you haven't enabled it already.
For more information about using the toolkit CLI with the Developer Portal, see Getting started with the Portal CLI commands.
About this scenario
In this scenario, you use the toolkit CLI to enable, and then disable, maintenance mode on your Developer Portal site.
Log in to the management server as a Provider organization by using the toolkit CLI
- Log in to the toolkit CLI as a Provider org:
apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_password
You can determine which identity provider to use in the--realm
parameter by entering the following command to see a list of all available identity providers (you do not need to be logged in to use this command):
For example,apic identity-providers:list --scope provider --server platform_api_host_name --fields title,realm
Theapic identity-providers:list --scope provider --server platform_api_host_name --fields title,realm total_results: 2 results: - title: API Manager User Registry realm: provider/default-idp-2 - title: Corporate LDAP user registry realm: provider/corporate-ldap
title
value should enable you to determine which identity provider to use; you can then copy the corresponding--realm
parameter directly from the displayedrealm
value. For any identity providers that were created by your administrator after API Connect was installed, the names will have been determined at creation time. The default API Manager Local User Registry for login as a member of a provider organization isdefault-idp-2
.For full details of the
apic login
command, see Logging in to a management server.
Use the toolkit CLI to enable maintenance mode
- Run the following command to enable maintenance mode on your Developer Portal:
Where:apic --mode portaladmin drupal-state:set --server management_server --org orgid/name --catalog catalogid/name --state_key system.maintenance_mode --input_format integer --state_value 1
management_server
is the endpoint URL of your management server (required).catalogid/name
is the ID or name of the catalog that your site belongs to (required).orgid/name
is the ID or name of the provider organization that the catalog belongs to (required).--state_key
is the name of the state key (required). Must be set tosystem.maintenance_mode
.--input_format
is the input format of the value of the state key. Must be set tointeger
for configuring the maintenance mode.--state_value
is the value to assign to the state key (required). Set to1
to enable maintenance mode.
For example, to enable maintenance mode for a Developer Portal in themyOrg
organization, and in thedev
catalog:apic --mode portaladmin drupal-state:set --server my.management.server.com --org myOrg --catalog dev --state_key system.maintenance_mode --input_format integer --state_value 1 Successfully set state system.maintenance_mode to the value of 1.
The Developer Portal site is now inaccessible to everyone apart from an administrator. All other users who enter the site URL will see a maintenance message set by the administrator.
Use the toolkit CLI to disable maintenance mode
- Run the following command to disable maintenance mode on your Developer Portal:
Where:apic --mode portaladmin drupal-state:set --server management_server --org orgid/name --catalog catalogid/name --state_key system.maintenance_mode --input_format integer --state_value 0
management_server
is the endpoint URL of your management server (required).catalogid/name
is the ID or name of the catalog that your site belongs to (required).orgid/name
is the ID or name of the provider organization that the catalog belongs to (required).--state_key
is the name of the state key (required). Must be set tosystem.maintenance_mode
.--input_format
is the input format of the value of the state key. Must be set tointeger
for configuring the maintenance mode.--state_value
is the value to assign to the state key (required). Set to0
to disable maintenance mode.
For example, to disable maintenance mode for a Developer Portal in themyOrg
organization, and in thedev
catalog:apic --mode portaladmin drupal-state:set --server my.management.server.com --org myOrg --catalog dev --state_key system.maintenance_mode --input_format integer --state_value 0 Successfully set state system.maintenance_mode to the value of 0.
Your Developer Portal site is now accessible to everyone again.
What you did in this scenario
In this scenario, you used the toolkit CLI to put your Developer Portal site into maintenance mode, and to turn maintenance mode off again.