Install OpenResty Edge Offline

1. Architecture

OpenResty Edge contains three main roles (OpenResty Edge Admin, OpenResty Edge Log Server, OpenResty Edge Node), and the relationship between the three components is as follows:

  • OpenResty Edge Admin: Edge Admin for short, used to control and manage the OpenResty Edge Node.
  • OpenResty Edge Log Server: short for Log Server, Used for metrics, log storage and viewing.
  • OpenResty Edge Node: Edge Node for short, is the gateway server that carries user traffic.

In addition, there are two data storage roles.

  • OpenResty Edge Admin Database: Edge Admin Database for short, is the database used by Edge Admin to persist the Edge Node’s configuration.
  • OpenResty Edge Log Server Database: Log Server Database for short, is the database used by Log Server to persist Edge Node’s metrics and log data.

2. Deployment recommendation

A formal environment installation of OpenResty Edge requires at least three machines, with Edge Admin, Log Server, and Edge Node components installed.

If you are deploying a test environment, Edge Admin and Log Server can also be installed on the same machine.

For gateway clusters with a scale of about 10 nodes, we recommend the following:

  • Edge Admin: A machine with at least a 4-core processor, 16G RAM and a 200G SSD hard drive.

  • Log Server: A machine with at least a 4-core processor, 16G RAM and a 200G SSD hard drive.

  • Edge Node: relatively flexible, depending on business volume, roughly 1 core with 2G memory; the larger, the better. For example, 8 cores, 16 GB of memory, and a 200G hard drive.

For the environment with more than 10 nodes, you need to upgrade the configuration according to the actual scenario, and for larger clusters, you can also deploy Edge Admin Database and Log Server Database to separate machines, as shown in the following figure.

3. Installation

We will need to access the following public network addresses. If your network has a firewall, you need to add proper rules to white list them.

openresty.com 443
openresty.org 443
pkg.openresty.com 443
api.openresty.com 443

3.1 Get offline package

Please use your email to log in to the OpenResty Download Center and download the following files:

  • OpenResty-Edge-Offline-VERSION.tar.gz
  • openresty-edge-VERSION.tar.gz
tar xf OpenResty-Edge-Offline-VERSION.tar.gz
tar xf openresty-edge-VERSION.tar.gz

OpenResty-Edge-Offline-VERSION.tar.gz will contain the following files:

  • openresty-postgresql12.tar.gz
  • openresty-postgresql.tar.gz, use only when upgrading
  • openresty-edge-admin.tar.gz
  • openresty-edge-node.tar.gz
  • openresty-edge-log-server.tar.gz
  • update-admin-db-VERSION.sh, use only when upgrading
  • update-log-server-db-VERSION.sh, use only when upgrading
  • init-admin-db.sh, use only during installation
  • init-log-server-db.sh, use only during installation

openresty-edge-VERSION.tar.gz will contain the following files:

  • openresty-edge-config-VERSION.deb:configuration packages used by systems such as Ubuntu, Debian.
  • openresty-edge-config-VERSION.rpm:configuration packages used by systems such as Redhat, Fedora.

3.2 Database installation and initialization

listening port 5432.

  • Install and initialize Edge Admin DB:

    # Transfer openresty-postgresql12.tar.gz to the target machine
    tar xf openresty-postgresql12.tar.gz
    cd openresty-postgresql12
    
    # Copy openresty-edge-config to current directory
    # cp /PATH/openresty-edge-config-* ./
    
    # Install
    sudo bash install.sh
    
    # Initialize
    /bin/bash init-admin-db.sh
    
  • Install and initialize Log Server DB: If you are building a production environment, we recommend installing Edge Admin DB and Log Server DB on separate machines.

    # Transfer openresty-postgresql12.tar.gz to the target machine
    tar xf openresty-postgresql12.tar.gz
    cd openresty-postgresql12
    
    # Copy openresty-edge-config to current directory
    # cp /PATH/openresty-edge-config-* ./
    
    # Install
    sudo bash install.sh
    
    # Initialize
    /bin/bash init-log-server-db.sh
    

3.3 Edge Admin Web installation

Listening ports 443 and 12345. (443 provides management background, 12345 is used to communicate with Edge Node)

  • Installation:

    # Transfer openresty-edge-admin.tar.gz to the target machine
    tar xf openresty-edge-admin.tar.gz
    cd openresty-edge-admin
    
    # Copy openresty-edge-config to current directory
    # cp /PATH/openresty-edge-config-* ./
    
    # Install
    sudo bash install.sh
    
  • Put the certificate and private key here (you can skip it if you don’t have one)

    /usr/local/oredge-admin/conf/ssl/ssl.crt
    /usr/local/oredge-admin/conf/ssl/ssl.key
    
  • Modify configuration: (If Database, Edge Admin, Log-Server use the same machine, you can use the default configuration)

    1.Database address

    2.Log-Server address

    # This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line
    sudo vim /usr/local/oredge-admin/conf/config.ini
    
  • Reload Edge Admin

    sudo systemctl reload oredge-admin
    

Now Edge Admin should be able to be used normally (we only opened HTTPS): https://your-admin.com/

  • login username: admin

  • Get login password: (please change the password after successful login)

    grep -rs "password :" init-admin-db.sh
    

3.4 double admin-web (Optional)

If you want to improve the availability of admin-web, deploying two admin-web service as master-master may be a good choice.

  • Follow step 3 above to install another admin-web.

  • Modify the configuration

    # This file will not be automatically overwritten by subsequent upgrades, so be careful not to leave spaces at the beginning of lines
    sudo vim /usr/local/oredge-admin/conf/config.ini
    

    You need to modify the host field under the clone_admin section, use the another admin-web service address as the configure value.

    After the changes, reload the admin-web service. The two admin-web services are in master-master mode now.

3.5 Log-Server Installation

Listening ports 8089 and 12346. (8089 is used to communicate, 12346 is used to communicate with Edge Node)

  • Installation:

    # Transfer openresty-edge-log-server.tar.gz to the target machine
    tar xf openresty-edge-log-server.tar.gz
    cd openresty-edge-log-server
    
    # Copy openresty-edge-config to current directory
    # cp /PATH/openresty-edge-config-* ./
    
    # Install
    sudo bash install.sh
    
  • Modify configuration: (If Database, Edge Admin, Log-Server use the same machine, you can use the default configuration)

    1.Database address

    2.Edge Admin address

    # This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line
    sudo vim /usr/local/oredge-log-server/conf/config.ini
    
  • Reload Log Server

    sudo systemctl reload oredge-log-server
    
  • At this time, you should be able to get the logs under [Control Panel] - [Logs] in Edge Admin.

3.6 Edge Node Installation

  • Installation:

    # Transfer openresty-edge-node.tar.gz to the target machine
    tar xf openresty-edge-node.tar.gz
    cd openresty-edge-node
    
    # Copy openresty-edge-config to current directory
    # cp /PATH/openresty-edge-config-* ./
    
    # Install
    sudo bash install.sh
    
  • Modify configuration:

    1.Edge Admin address

    2.Log-Server address

    # This file will not be automatically overwritten by subsequent upgrades, please be careful not to leave a space at the beginning of the line
    sudo vim /usr/local/oredge-node/conf/config.ini
    

You can configure the host2 field under the admin section if you configured the master-master mode admin-web service. Edge Node will use host and host2 randomly (regardless of configuration order) and will switch to the other admin-web service automatically when one admin-web is down.

  • Reload Edge Node:

    sudo systemctl reload oredge-node
    

So far, the full set of OpenResty Edge has been built.

4. Database Backup and High Availability

We provide two ways to make sure data security. We strongly recommend using both methods to make sure data security.

Database Backup

Database High Availability

5. Start the OpenResty Edge service

We provide online documents, and related blog posts and corresponding video tutorials.

If you have any questions, please contact us.