Downgrading OpenResty Edge

1. Preparation

Please choose the appropriate preparation steps based on your installation method:

Online Installation

Directly download openresty-edge-installer.sh:

curl -O https://openresty.com/client/oredge/openresty-edge-installer.sh

Bundle Package Installation

  1. Obtain openresty-edge-bundle-VERSION.tar.gz from the download center
  2. Upload the file to the target server
  3. Extract the file:
tar -xvf openresty-edge-bundle-VERSION.tar.gz
cd openresty-edge-bundle-VERSION

2. Downgrading Edge Admin

  • Execute the installation script

    sudo /bin/bash openresty-edge-installer.sh
    
  • Select the Downgrade operation

    [1] Install
    [2] Upgrade
    [3] Downgrade
    [4] Uninstall
    [5] Self Check
    [6] Get Default Info
    What would you like to do? 3
    You chose: Downgrade.
    
  • Select the component to downgrade: Edge Admin

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 1
    You chose: Edge Admin.
    
  • Enter the path of the historical record generated during the upgrade:

    Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
    
  • Enter the path of the old version’s bundle package (only for the bundle package installation method):

    Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
    

    This step is used to locate the old version of the OpenResty Edge bundle package.

  • After a successful downgrade, you will see the following prompt:

    Great! Downgrade openresty-edge-admin successfully."
    

2. Downgrading Edge Admin Database

  • The operation steps are similar, but choose Edge Admin DB as the component to downgrade

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 2
    You chose: Edge Admin DB.
    
  • Enter the current version number (only for the online installation method)

    Which version are you currently on? (like 24.3) 24.3
    

    This version number is used to download the corresponding database downgrade script.

  • After a successful downgrade, you will see the following prompt:

    Great! update admin database successfully.
    

3. Rebuilding

  • The operation steps are similar, but choose Rebuild as the component to downgrade

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 3
    You chose: Rebuild.
    
  • First, rebuild a few low-traffic non-wildcard HTTP applications, then compile a few high-traffic non-wildcard HTTP applications

    Do you want to rebuild one application for test? [Y/N]:  y
    Please input the application id: 1
    rebuild application 1
    
  • Continue rebuilding according to the prompts

    Do you want to rebuild gateway? [Y/N]:  y
    rebuild gateway
    recompiled gateway successfully
    
    Do you want to rebuild global-action? [Y/N]:  y
    rebuild global-action
    recompile global action successfully
    
    Do you want to rebuild global? [Y/N]:  y
    rebuild global
    recompile global successfully
    
    Do you want to rebuild upgrade config? [Y/N]:  y
    rebuild upgrade config
    recompile upgrade configurations successfully
    
    Do you want to rebuild all wilecard apps? [Y/N]:  y
    rebuild all wilecard apps
    
    Do you want to rebuild all apps? [Y/N]:  y
    Do you want to compile concurrently? [Y/N]:  n
    rebuild all apps
    
    Do you want to rebuild all http_proxy apps? [Y/N]:  y
    rebuild all http_proxy apps
    
    Do you want to rebuild all socks5_apps? [Y/N]:  y
    rebuild all sock5_proxy apps
    
    Do you want to rebuild waf? [Y/N]:  y
    rebuild waf
    recompiled all of the WAF rule sets successfully.
    
    Do you want to rebuild dns? [Y/N]:  y
    rebuild dns
    recompile dns successfully.
    
    rebuild done!
    

If all services usually work, the upgrade is complete!

If there are numerous HTTP/HTTPS applications, the compilation time for this step may be lengthy:

Do you want to rebuild all apps? [Y/N]:  y

In this case, you can choose concurrent compilation, which will launch 4 processes to compile simultaneously:

Do you want to compile concurrently? [Y/N]:  y

For further speed improvement, you can modify the installer to specify a higher concurrency (not exceeding 8), for example:

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

4. Downgrading Edge Node

Usually, after completing the above operations, your service should have returned to normal, and the subsequent steps can be omitted. This is because the new version of Edge Node is typically compatible with the old version of Edge Admin.

4.1 Migrating Traffic (Optional)

To minimize the impact on business, it is recommended that traffic from the Edge Node be migrated to other working Edge Nodes before downgrading it. Although this step is optional, it is strongly recommended to do this on the few Edge Nodes that are degraded first:

  • Migrate traffic
  • Upgrade
  • Verify

After confirming everything is in order, upgrade the remaining Edge Nodes. During the downgrade process, closely monitor error logs.

If you are using OpenResty Edge’s DNS to control traffic, please follow these steps to take the Edge Node that is about to be upgraded offline:

  • Log in to the OpenResty Edge Console
  • Go to the [Gateway Cluster] page
  • [Edit] the cluster where the node is located
  • Change the node [Status] to [DNS off, Cluster Cache off]
  • Save the changes

Wait for the node’s traffic to drop to extremely low or no traffic. You can confirm this by checking the access logs:

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

4.2 Downgrading

  • The operation steps are similar, but choose Edge Node as the component to downgrade

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 4
    You chose: Edge Node.
    
  • Enter the path of the historical record generated during the upgrade:

    Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
    
  • Enter the path of the old version’s bundle package (only for the bundle package installation method)

    Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
    
  • After a successful downgrade, you will see the following prompt:

    Great! Downgrade openresty-edge-node successfully.
    

5. Downgrading Log Server

  • The operation steps are similar, but choose Log Server as the component to downgrade

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 5
    You chose: Log Server.
    
  • Enter the path of the historical record generated during the upgrade:

    Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
    
  • Enter the path of the old version’s bundle package (only for the bundle package installation method)

    Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
    
  • After a successful downgrade, you will see the following prompt:

    Great! Downgrade openresty-edge-log-server successfully.
    

6. Downgrading Log Server Database

  • The operation steps are similar, but choose Log Server DB as the component to downgrade

    [1] Edge Admin
    [2] Edge Admin Database
    [3] Rebuild
    [4] Edge Node
    [5] Edge Log Server
    [6] Edge Log Server Database
    Which component would you like to downgrade? 6
    You chose: Log Server DB.
    
  • Enter the current version number (only for the online installation method)

    Which version are you currently on? (like 24.3) 24.3
    
  • After a successful downgrade, you will see the following prompt:

    Great! downgrade log-server database successfully.
    

If you encounter any issues, please don’t hesitate to contact us!