# 1. Upgrade OpenResty Edge Node

Upgrade 1 Nodes first, and then upgrade all Node after there are no problems, please pay attention to the error log during the upgrade.

  • check and record the software version before the upgrade
// centos/redhat/fedora
rpm -q openresty-edge-node-prod

// debian/ubuntu
dpkg -l | grep openresty-edge-node-prod
  • Take the Node you want to upgrade 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
  • Download upgrade script
# centos
curl -O https://openresty.com/client/centos/upgrade-edge-node-prod.sh

# redhat
curl -O https://openresty.com/client/rhel/upgrade-edge-node-prod.sh

# fedora
curl -O https://openresty.com/client/fedora/upgrade-edge-node-prod.sh

# ubuntu
curl -O https://openresty.com/client/ubuntu/upgrade-edge-node-prod.sh

# debian
curl -O https://openresty.com/client/debian/upgrade-edge-node-prod.sh
  • Upgrade:
sudo bash -x upgrade-edge-node-prod.sh
  • If you encounter any error, you can rollback:

    • Downgrade software:
    // centos/redhat/fedora
    sudo yum downgrade -y openresty-edge-node-prod-[% package-version-number %].noarch
    
    // debian/ubuntu
    sudo apt-get install openresty-edge-node-prod=[% package-version-number %]
    
    • Restore old service:
    sudo systemctl start upgrade-oredge-node
    

# 2. Upgrade OpenResty Edge Log Server

  • Upgrade postgresql timescaledb(we need to perform this step if our Log Server version <= 0.0.1.88

    • Install postgresql timescaledb:

      # centos/redhat/fedora
      sudo yum install -y openresty-postgresql-timescaledb
        
      # debian/ubuntu
      sudo apt install -y openresty-postgresql-timescaledb
      
    • Configure postgresql timescaledb:

      If your version of PostgreSQL is 9: (rpm -q openresty-postgresql)

      // The path of postgresql.conf is modified according to the actual, the following is the default path
      (sudo grep -vF "shared_preload_libraries = 'timescaledb'" /var/postgres/data/postgresql.conf; echo "shared_preload_libraries = 'timescaledb'") | sudo tee /var/postgres/data/postgresql.conf
      sudo /etc/init.d/openresty-postgresql restart
      

      If your version of PostgreSQL is 12:(rpm -q openresty-postgresql12)

      // The path of postgresql.conf is modified according to the actual, the following is the default path
      (sudo grep -vF "shared_preload_libraries = 'timescaledb'" /var/postgres12/data/postgresql.conf; echo "shared_preload_libraries = 'timescaledb'") | sudo tee /var/postgres12/data/postgresql.conf
      sudo /etc/init.d/openresty-postgresql12 restart
      
  • Upgrade database

bash update-log-server-db-[% date %]-[% start-version %]-[% end-version %].sh
  • Download upgrade script
// centos
curl -O https://openresty.com/client/centos/upgrade-edge-log-server-prod.sh

// redhat
curl -O https://openresty.com/client/rhel/upgrade-edge-log-server-prod.sh

// fedora
curl -O https://openresty.com/client/fedora/upgrade-edge-log-server-prod.sh

// ubuntu
curl -O https://openresty.com/client/ubuntu/upgrade-edge-log-server-prod.sh

// debian
curl -O https://openresty.com/client/debian/upgrade-edge-log-server-prod.sh
  • Upgrade log server
sudo bash -x upgrade-edge-log-server-prod.sh

If you encounter any error, you can rollback:

  • Downgrade software:
// centos/redhat/fedora
sudo yum downgrade -y openresty-edge-log-server-prod-[% package-version-number %].noarch

// debian/ubuntu
sudo apt-get install openresty-edge-log-server-prod=[% package-version-number %]
  • Restore old service:
sudo systemctl start upgrade-oredge-log-server

# 3. Upgrade OpenResty Edge Admin

  • Upgrade waf database (we need to perform this step if our Admin version <= 0.3.16.65
// If the file is missing, please contact us
bash update-admin-db-waf.sh
  • Upgrade database
bash update-admin-db-[% date %]-[% start-version %]-[% end-version %].sh
  • Download upgrade script
// centos
curl -O https://openresty.com/client/centos/upgrade-edge-admin-prod.sh

// redhat
curl -O https://openresty.com/client/rhel/upgrade-edge-admin-prod.sh

// fedora
curl -O https://openresty.com/client/fedora/upgrade-edge-admin-prod.sh

// ubuntu
curl -O https://openresty.com/client/ubuntu/upgrade-edge-admin-prod.sh

// debian
curl -O https://openresty.com/client/debian/upgrade-edge-admin-prod.sh
  • Upgrade admin
sudo bash -x upgrade-edge-admin-prod.sh

If you encounter any error, you can rollback:

  • Downgrade software:
// centos/redhat/fedora
sudo yum downgrade -y openresty-edge-admin-prod-[% package-version-number %].noarch

// debian/ubuntu
sudo apt-get install openresty-edge-admin-prod=[% package-version-number %]
  • Restore old service:
sudo systemctl start upgrade-oredge-admin

# 4. recompile

  1. It is recommended to recompile the application in the following order:

    1. Recompile a few applications with less traffic first 2) Recompile several high-traffic applications 3) Recompile all applications 4) 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 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 you have any questions, please contact us.