Downgrade OpenResty Edge by bundle package

1. prepare the old bundle package

If you don’t have the old bundle package named openresty-edge-bundle-VERSION.tar.gz, please login and download it at OpenResty Download Center using your email address.

tar xf openresty-edge-bundle-VERSION.tar.gz
# Example: tar xf openresty-edge-bundle-23.12.1-rhel-8.tar.gz

Usually the bundle package will contain the following files or directories:

  • openresty-postgresql12: the directory containing the installation package for the OpenResty Edge database component.
  • openresty-edge-admin: the directory containing the installation package for the OpenResty Edge Admin component.
  • openresty-edge-node: the directory containing the installation package for the OpenResty Edge Node component.
  • openresty-edge-log-server: the directory containing the installation package for the OpenResty Edge Log Server component.
  • update-admin-db-VERSION.sh, use only when upgrading
  • update-log-server-db-VERSION.sh, use only when upgrading
  • init_admin_db_VERSION.sh, use only during installation
  • init_log_server_db_VERSION.sh, use only during installation

2. Downgrade Edge Admin

# Download the downgrade script
curl -O https://openresty.com/client/oredge/downgrade-edge-admin-bundle.sh

# Place the script in the directory of the old Edge Admin bundle installation package
cp downgrade-edge-admin-bundle.sh <old-packages-dir>

# Run the downgrade script
sudo bash downgrade-edge-admin-bundle.sh

# check
sudo rpm -qa | grep edge
# or
sudo dpkg -l | grep edge

3. Downgrade Edge Admin database

# Transfer the script to the machine where the Edge Admin database is located
# Example:bash downgrade-admin-db-217-180.sh
bash downgrade-admin-db-VERSION.sh

4. Recompile

Please recompile the application in the following order:

  1. Recompile a few applications that do not contain wildcard domains with less traffic first
  2. Recompile several high-traffic applications that do not contain wildcard domains
  3. Recompile all wildcard applications
  4. Recompile all applications
  5. Recompile global rules
cd /usr/local/oredge-admin/
# recompile the specified application (replace APP-ID with application ID)
sudo bash utils/recompile-apps.sh http APP-ID
# recompile all applications
sudo bash utils/recompile-apps.sh wildcard-http
sudo bash utils/recompile-apps.sh http
sudo bash utils/recompile-apps.sh http_proxy
sudo bash utils/recompile-apps.sh socks5_proxy
# recompile global rules
sudo bash utils/recompile-apps.sh global
# recompile waf rules
sudo bash utils/recompile-apps.sh waf
# recompile DNS applications
sudo bash utils/recompile-apps.sh dns
# recompile global actions
sudo bash utils/recompile-apps.sh global-action
# recompile gateway (may trigger OpenResty Edge Node reload)
sudo bash utils/recompile-apps.sh gateway

If the whole system behave normally, the downgrade is complete!

this step may take longer to compile when there are many HTTP/HTTPS applications.

sudo /bin/bash utils/recompile-apps.sh http

We recommend using another tool for concurrent compilation then. The following command will start 4 processes to compile.

sudo /bin/bash utils/parallel-recompile.sh

If it is not fast enough, you can also specify a larger concurrency, but not larger than 8, e.g.

sudo /bin/bash utils/parallel-recompile.sh 8

5. Downgrade Edge Node

Downgrade 1~2 Edge Nodes first, and then downgrade all Edge Node after there are no problems, please pay attention to the error log during the downgrade.

  • Cut away traffic. If you are using Edge’s DNS, follow these steps; otherwise, proceed as you see fit.

    • Take the Edge Node you want to downgrade bundle.

      • Enter the [Gateway Clusters].
      • [Edit] The cluster where the node is located.
      • Modify the node’s [status] to [Disable DNS, disable caching cluster].
      • [Save]
    • Wait for the node to no longer have traffic. You could confirm by checking the access log:

      tail -f /usr/local/oredge-node/logs/access.log
      

      This process requires waiting for DNS to expire, which can be time-consuming.

  • Downgrade:

    # Download the downgrade script
    curl -O https://openresty.com/client/oredge/downgrade-edge-node-bundle.sh
    
    # Place the script in the directory of the old Edge Node bundle installation package
    cp downgrade-edge-node-bundle.sh <old-packages-dir>
    
    # Run the downgrade script
    sudo bash downgrade-edge-node-bundle.sh
    

6. Downgrade Log Server

# Download the downgrade script
curl -O https://openresty.com/client/oredge/downgrade-edge-log-server-bundle.sh

# Place the script in the directory of the old Edge Log Server bundle installation package
cp downgrade-edge-log-server-bundle.sh <old-packages-dir>

# Run the downgrade script
sudo bash downgrade-edge-log-server-bundle.sh

7. Downgrade Log Server Database

# Transfer the script to the machine where the Log Server database is located
bash downgrade-log-server-db-VERSION.sh

# Example:bash downgrade-log-server-db-49-41.sh

If you have any questions, please contact us.