HA for Apigee DevPortal

Apigee doesn’t support HA out of box for the Devportal but we can set it up in such a way that it is High Available.

Here are the steps:

1. Install Devportal and postgres following the below steps on the first node:

A. Pre-requisites:
  1. Specifications: 2 cores, 1 GB RAM, 10 GB storage
  2. Operating System: Red Hat Enterprise Linux, CentOS, and Oracle Linux
  3. Network Interfaces: http or https port should be open so that the installer downloads resources from the web if it’s an external internet installation similarly open the necessary ports for the offline install.
  4. SMTP: Edge requires that you configure an SMTP server to send email messages from the portal. Therefore, you must ensure that the Drupal can access the necessary port on the SMTP server. For non-TLS SMTP, the port number is typically 25. For TLS-enabled SMTP, it is often 465, but check with your SMTP provider.
  5. Make sure Edge Management server is accessible from the node. It can be either 8080 or 8443.
  6. If the pre-7.0 versions of PHP exists installation fails so uninstall the packages php, php-cli, php-common, php-gd, php-mbstring, php-mysql, php-pdo, php-pear, php-pecl-apc, php-process, php-xml prior to the installation
B. Installation Process:
  1. Download the bootstrap file from the
    curl https://software.apigee.com/bootstrap_.sh -o /tmp/apigee/bootstrap_.sh
  2. Execute the bash script:
    bash /tmp/apigee/bootstrap_.sh apigeeuser=uName apigeepassword=pWord
  3. Install the apigee-setup:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup install
  4. Using the apigee setup install the profiles: pdb(postgresDB) and dp(devportal) as following:
    /opt/apigee/apigee-setup/bin/setup.sh -p -f
  5. We need the Response file to install the profiles:
    IP1=””
    HOSTIP=”$(hostname -i)”
    PG_NAME=”devportal”
    PG_USER=””
    PG_PWD=””
    PG_HOST=”$IP1″
    DEFAULT_DB=”postgres”
    MP_POD=”gateway”
    REGION=”dc-1″
    DRUPAL_PG_USER=”drupaladmin”
    DRUPAL_PG_PASS=”portalSecret”
    DEVPORTAL_ADMIN_FIRSTNAME=”firstName”
    DEVPORTAL_ADMIN_LASTNAME=”lastName”
    DEVPORTAL_ADMIN_USERNAME=”userName”
    DEVPORTAL_ADMIN_PWD=”pWord”
    DEVPORTAL_ADMIN_EMAIL=”foo@bar.com
    EDGE_ORG=”edgeOrgName”
    MGMT_URL=”http://$IP1:8080/v1
    DEVADMIN_USER=”orgAdmin@myCorp.com
    DEVADMIN_PWD=”pWord”
    SMTPHOST=”smtp.gmail.com
    SMTPSSL=”n”
    SMTPPORT=”25″
    SMTPUSER=”your@email.com
    SMTPPASSWORD=”yourEmailPassword”
  6. Use the same Response File for both of the profiles and install postgres followed by the devportal.
  7. To receive notifications of Drupal updates, ensure that the Drupal Update manager module is enabled. From the Drupal menu, select Modules and scroll down to the Update manager module. If it is not enabled, enable it.
  8. Once enabled, you can see the available updates by using the Reports > Available Updates menu item. You can also use the following Drush command:
    /opt/apigee/apigee-drupal/drush pm-info update
  9. Smart Docs is already installed when you run the test scripts creating the validate org. apart from that you need to enable smart docs on the devportal manually.
  10. To access Devportal use the following:
    http://:8079

2. On the second node follow the same process for prerequisites and installation up to 1.B.4 then for the installation of devportal follow the below process:

A. Installation of Second devportal:
  1. Use the below Response file on the second node to install DP:
    IP1=””
    IP2=””
    HOSTIP=”$(hostname -i)”
    PG_NAME=”devportal”
    PG_USER=””
    PG_PWD=””
    PG_HOST=”$IP2″
    DEFAULT_DB=”postgres”
    MP_POD=”gateway”
    REGION=”dc-1″
    DRUPAL_PG_USER=”drupaladmin”
    DRUPAL_PG_PASS=”portalSecret”
    DEVPORTAL_ADMIN_FIRSTNAME=”firstName”
    DEVPORTAL_ADMIN_LASTNAME=”lastName”
    DEVPORTAL_ADMIN_USERNAME=”userName”
    DEVPORTAL_ADMIN_PWD=”pWord”
    DEVPORTAL_ADMIN_EMAIL=”foo@bar.com
    EDGE_ORG=”edgeOrgName”
    MGMT_URL=”http://$IP1:8080/v1
    DEVADMIN_USER=”orgAdmin@myCorp.com
    DEVADMIN_PWD=”pWord”
    SMTPHOST=”smtp.gmail.com
    SMTPSSL=”n”
    SMTPPORT=”25″
    SMTPUSER=”your@email.com” SMTPPASSWORD=”yourEmailPassword”
  2. In the above Response file we are installing DP directing it to the PostgresDB of the first node.
  3. For the installation of pdb use the below response file:IP1=””
    IP2=””
    HOSTIP=”$(hostname -i)”
    MP_POD=”gateway”
    REGION=”dc-1″
    PG_MASTER=”$IP2”
    PG_STANDBY=”$IP1”
    PG_PWD=”postgres”
  4. The first node PG is always installed as master we are installing the second node PG as standby to the first node.
B. Postgres Failover:

So, when the PG fails on the devportal we have to manually run the below steps to make the PG as master:
a. Stop the postgres master if it’s still running:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
b. Invoke the following command on the standby node:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql promote-standby-to-master IPorDNSofOldMaster
c. Create file /opt/apigee/customer/application/drupal-devportal.properties and add the following entries on both the devportal nodes:
conf_dbhost=”IP of promoted postgres”
d. Restart the apigee-drupal-devportal on both the devportal nodes
apigee-service apigee-drupal-devportal restart
e. This process can be automated using ansible scripts for auto-healing.

3. Post-installation:

A. Mounting a file system:

Installing devportal for HA we need to make sure that the file system is mounted so both the devportal are sharing the same file system for images, smart docs JSON files putting them in Sync.

B. Couple of pointers:
  1. Use the below to mount the file system:
    https://www.tecmint.com/how-to-setup-nfs-server-in-linux/
  2. Direct the file location to the mounted filesystem on devportal by making the following entry:
    Location:
    /opt/apigee/apigee-drupal-devportal/source/conf/apigee-drupal-devportal-nginx.conf
    Directive
    location ~ ^/gfs/ {
    try_files $uri /index.php?$query_string;
    }
  3. Restart the apigee-drupal-devportal.

Read More: Why Digital Transformation is a Must for Enterprises?

Leave a Reply