Downgrade OpenResty Edge

1. Downgrade Admin

# downgrade Admin
curl -O https://openresty.com/client/oredge/downgrade-edge-admin.sh
sudo /bin/bash -x downgrade-edge-admin.sh OLD_PACKAGE_VERSION
# E.g: sudo /bin/bash -x downgrade-edge-admin.sh 1.1.0-0

2. Downgrade Admin database

# Transfer the script to the machine where the Admin database is located
bash downgrade-admin-db-VERSION.sh

# Example:bash downgrade-admin-db-217-180.sh

3. 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

4. Downgrade Node

Downgrade 1~2 Nodes first, and then downgrade all 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 Node you want to downgrade offline.

      • 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:

    curl -O https://openresty.com/client/oredge/downgrade-edge-node.sh
    sudo /bin/bash -x downgrade-edge-node.sh OLD_PACKAGE_VERSION
    
    # E.g: sudo /bin/bash -x downgrade-edge-node.sh 1.1.0-0
    

5. Downgrade Log Server

# downgrade Log Server
curl -O https://openresty.com/client/oredge/downgrade-edge-log-server.sh
sudo /bin/bash -x downgrade-edge-log-server.sh OLD_PACKAGE_VERSION
# E.g: sudo /bin/bash -x downgrade-edge-log-server.sh 1.1.0-1

6. 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.