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.

Important: Maintenance mode is designed for short-term site maintenance; it is not meant for long-term usage. While a site is in maintenance mode, the database is not updated with new content from API Manager.

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):
    apic identity-providers:list --scope provider --server platform_api_host_name --fields title,realm
    For example,
    apic 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
    The title value should enable you to determine which identity provider to use; you can then copy the corresponding --realm parameter directly from the displayed realm 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 is default-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:
    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
    Where:
    • 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 to system.maintenance_mode.
    • --input_format is the input format of the value of the state key. Must be set to integer for configuring the maintenance mode.
    • --state_value is the value to assign to the state key (required). Set to 1 to enable maintenance mode.
    For example, to enable maintenance mode for a Developer Portal in the myOrg organization, and in the dev 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:
    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
    Where:
    • 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 to system.maintenance_mode.
    • --input_format is the input format of the value of the state key. Must be set to integer for configuring the maintenance mode.
    • --state_value is the value to assign to the state key (required). Set to 0 to disable maintenance mode.
    For example, to disable maintenance mode for a Developer Portal in the myOrg organization, and in the dev 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.