Update Edge to 18.05.01 using Ops Manager

Edge for Private Cloud v4.18.05

Apigee Edge Installer for Pivotal Cloud Foundry v18.05.01 corresponds to Apigee Edge for Private Cloud v4.18.05.01

Prerequisites

Before you can install Edge, you must first meet the following prerequisites.

Ops Manager 2.1 or 2.2

Ensure that you are using Pivotal Cloud Foundry Operations Manager version 2.1 or 2.2.

If you are currently running Edge for Pivotal Cloud Foundry version 4.17.09 and Pivotal Ops Manager version 1.0 or 1.1, you must first upgrade Pivotal Ops Manager to version 2.1 or 2.2 before performing the update described in this topic.

Updating Apigee Installer for PCF v4.17.09 to v18.05.01

The following instructions include changes between v18.05.01 and v4.17.09, such as a Postgres version update from 9.4 to 9.6.

Before performaing an upgrade, always back up your database so that you can restore it if needed. Backups are outside the scope of BOSH release and should be done separately.

Following are the steps for the upgrade process:

  1. Upgrade to the v18.05.01 tile using the Ops Manager.
  2. The upgrade will likely fail at the ‘upgrade Postgres step.’
  3. SSH to both Postgres master and standby and stop the monit services.

    sudo su -
    monit stop apigee-postgresql
    monit stop edge-postgres-server
    
  4. Stop Edge qpid servers. Qpid should not be pushing any data to Postgres during the update.

    /opt/apigee/bin/apigee-service/apigee-all stop
    
  5. Promote standby to master.

    1. SSH to the Postgres standby machine. To check if it's standby, run the following command.

      sudo /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-standby
      
    2. Promote the current standby to master.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql promote-standby-to-master <ip address of old master>
      /opt/apigee/apigee-service/bin/apigee-all restart
      
    3. Check whether it is promoted to master by running the following command.

      sudo /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master
      
    4. Set replication on the new master.

      Edit /var/vcap/jobs/edge-postgres-server/config/silent.conf and change the following.

      PG_MASTER=IPorDNSofNewMaster
      PG_STANDBY=IPorDNSofOldMaster
      

      Run the following command to set replication.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-master -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      

      Verify the host replication is added by checking /opt/apigee/apigee-postgresql/conf/pg_hba.conf.

  6. Update apigee-postgresql on the new master.

    1. On the new master node, make a note of the values from /etc/yum/vars/apigeerepohost, /etc/yum/vars/apigeeuser, and /etc/yum/vars/apigeepassword.

      You will need them in the next step.

    2. Run the following command to bootstrap v18.05.

      curl http://user:password@repohost:3939/bootstrap_4.18.05.sh -o /tmp/bootstrap_4.18.05.sh
      bash /tmp/bootstrap_4.18.05.sh apigeerepohost=repohost:3939 apigeeuser=user apigeepassword=password apigeeprotocol=http://
      /opt/apigee/apigee-service/bin/apigee-service apigee-setup update
      
    3. Stop edge-postgres in the new master.

      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
      
    4. Check that edge-postgres and apigee-postgresql are already stopped in the old master.

    5. Run upgrade on the new master.

      /opt/apigee/apigee-setup/bin/update.sh -c ps -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      

      The upgrade should be successful.

    6. Upgrade the database in the new master node.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql db_upgrade
      
  7. Upgrade apigee-postgresql on the old master.

    1. Stop apigee-postgresql on the old master by running the following command.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
      
    2. Edit /var/vcap/jobs/edge-postgres-server/config/silent.conf and change the following.

      PG_MASTER=IPorDNSofNewMaster
      PG_STANDBY=IPorDNSofOldMaster
      

      Run the following commands.

      mv /opt/apigee/data/apigee-postgresql/pgdata /opt/apigee/data/apigee-postgresql/pgdata_old
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-standby -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      
    3. Update apigee-postgresql.

      /opt/apigee/apigee-setup/bin/update.sh -c ps -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      
  8. Update Edge Components on the new master.

    1. Start Postgres on the new master.

      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
      
    2. Update Edge Components on the new master.

      /opt/apigee/apigee-setup/bin/update.sh -c edge -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      
  9. Update/Install Edge Components on the old master.

    1. Install the Edge Component on the old master.

      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server install
      
    2. Update the Edge Component on the old master.

      /opt/apigee/apigee-setup/bin/update.sh -c edge -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      
  10. Check that all the services are running in both master and node. At this point, you can log into Apigee’s analytics dashboard and see all the data.

  11. Reswap master and standby as described in the official documentation ( https://docs.apigee.com/private-cloud/v4.18.05/handling-postgressql-database-failover).

    1. On the current master node (N1), run the following command to stop apigee-postgresql.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
      
    2. On the current standby node (N2), invoke the following command to promote it to master.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql promote-standby-to-master IPorDNSofOldMaster(N1)
      
    3. On the new master (N2) node, edit /var/vcap/jobs/edge-postgres-server/config/silent.conf and change the following.

      PG_MASTER=IPorDNSofNewMaster(N2)
      PG_STANDBY=IPorDNSofOldMaster(N1)
      

      Then, run the following command.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-master -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      

      Verify the host replication is added by checking /opt/apigee/apigee-postgresql/conf/pg_hba.conf.

    4. On the old master node (N1), edit /var/vcap/jobs/edge-postgres-server/config/silent.conf and change the following.

      PG_MASTER=IPorDNSofNewMaster(N2)
      PG_STANDBY=IPorDNSofOldMaster(N1)
      
    5. On the old master node (N1), stop apigee-postgresql.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
      
    6. On the old master (N1), clean up the data.

      rm -rf /opt/apigee/data/apigee-postgresql/
      
    7. Make the old master (N1) as standby.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-standby -f /var/vcap/jobs/edge-postgres-server/config/silent.conf
      
    8. Check for master and standby in both machines on the new master (N2).

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master
      

      On the old master (N1), proceed with the following.

      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-standby
      
  12. Start qpid servers on the qpid nodes.

    /opt/apigee/apigee-service/bin/apigee-all restart
    
  13. Start the monit services on both master and standby.

    monit start apigee-postgresql
    monit start edge-postgres-server
    
  14. Rerun ‘Apply changes’ using the Ops Manager to finish validation and complete the setup.

  15. If the devportal setup still fails, SSH to the devportal box.

    1. Go to the /opt/apigee/data/apigee-lb/conf.d directory and unlink the wrong link. It may still be linked to v4.17.09 file, which no longer exists.

      unlink apigee-drupal-devportal-nginx.conf
      
    2. Link it to the correct location with the following command.

      ln -s /opt/apigee/apigee-drupal-devportal-4.18.05-0.0.274/conf/apigee-drupal-devportal-nginx.conf apigee-drupal-devportal-nginx.conf
      
    3. Restart Apigee services.

      /opt/apigee/apigee-service/bin/apigee-all restart
      
    4. Finish the upgrade by running the following command.

      /opt/apigee/apigee-setup/bin/update.sh -c dp -f/var/vcap/jobs/apigee-drupal-devportal/config/silent.conf