Install OpenResty Edge

1. Architecture

OpenResty Edge contains three main roles (Node, Admin, Log-Server), and the architecture of the three is as follows:

  • Node: A specific gateway.
  • Admin: Used to manage Node.
  • Log-Server: Used to store and view logs.

2. Cluster

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

  • Admin and Admin DB are deployed on the same machine.
  • Log Server and Log-Server DB are deployed on the same machine.

If the scale becomes larger in the future, they can be deployed separately.

In addition, for data security, we recommend starting a slave of the other DB on each machine:

  • A slave of the Log Server DB on the Admin DB machine.
  • A slave of Admin DB on the Log Server DB machine.

Edge Admin and Edge Log Server: Using a machine with 4 cores, 16G memory, and a 200G SSD hard disk is recommended. Edge Node: Depends on the volume of business. It is roughly 1 CPU core with 2g memory, such as 8c16g, 200G hard disk.

3. Installation

  • openresty-edge-VERSION.tar.gz

3.1 Set the firewall whitelist

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.2 Admin DB Installation

Listening port 5432.

  • Copy openresty-edge-VERSION.tar.gz to the current directory

  • Decompress

tar -xvf openresty-edge-VERSION.tar.gz
  • Run the installer
cd openresty-edge-VERSION
sudo /bin/bash openresty-edge-installer.sh
  • Enter the action you want to perform Install
What would you like to do?
[1] Install
[2] Upgrade
[3] Downgrade
[4] Uninstall
1
What you choose is: Install.
  • Enter the version you want to install (The latest version information can be obtained from Changelog)
Which version would you like to install? (like 22.6.1)
22.6.1
  • Enter the component you want to install Admin DB
Which component would you like to install?
[1] Admin DB
[2] Log Server DB
[3] Admin
[4] Log Server
[5] Node
1
What you choose is: Admin DB.
  • If successful, the following prompt will be displayed at the end
Great! Init admin database successfully.

3.3 Log Server DB Installation

We recommend installing Admin DB and Log Server DB on separate machines if you are building a production environment.

  • The procedure is the same, with the component Log Server DB selected for the upgrade
Which component would you like to install?
[1] Admin DB
[2] Log Server DB
[3] Admin
[4] Log Server
[5] Node
2
What you choose is: Log Server DB.
  • If successful, the following prompt will be displayed at the end
Great! Init log server database successfully.

3.4 Admin Web Installation

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

  • The procedure is the same, with the component Admin selected for the upgrade
Which component would you like to install?
[1] Admin DB
[2] Log Server DB
[3] Admin
[4] Log Server
[5] Node
3
What you choose is: Admin.
  • Put the certificate and private key here (you can skip it if you don’t have one)
[+] Do you want to configure ssl certificate and private key? [y/N] y
 [-] Please enter the path of ssl certificate file (like /usr/local/ssl.crt): /usr/local/ssl.crt
 [-] Please enter the path of ssl key file (like /usr/local/ssl.key): /usr/local/ssl.key
  • Configure DB and Log-Server Addresses:(If Database, Admin, and Log-Server use the same machine, you can use the default configuration)
[+] Do you want to configure pg and log server address (/usr/local/oredge-admin/conf/config.ini)? [y/N] y
 [-] Please enter the address of pg server (if pg server and admin use the same machine, no need to input.):
 [-] Please enter the address of log server (if log server and admin use the same machine, no need to input.): 54.112.79.32
  • If successful, the following prompt will be displayed at the end
Install Edge admin successfully! login username: admin , password: xxxxxxxxxxx .

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

  • login username: admin

  • Get login password: (After installing Admin successfully, you are already prompted)

    grep -rs "password :" init_admin_db_VERSION.sh
    

3.5 double admin-web (Optional)

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

  • Follow step 3.4 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 and use another admin-web service address as the configured value in both of the admin-web servers.

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

3.6 Log-Server Installation

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

  • The procedure is the same, with the component Log Server selected for the upgrade
Which component would you like to install?
[1] Admin DB
[2] Log Server DB
[3] Admin
[4] Log Server
[5] Node
4
What you choose is: Log Server.
  • Configure DB and Admin addresses:(If Database, Admin, and Log-Server use the same machine, you can use the default configuration)
[+] Do you want to configure pg and admin address (/usr/local/oredge-log-server/conf/config.ini)? [y/N] y
 [-] Please enter the address of pg server (if pg server and log server use the same machine, no need to input.):
 [-] Please enter the address of admin server (if admin and log server use the same machine, no need to input.): 45.121.32.78
  • If successful, the following prompt will be displayed at the end
Install Edge Log Server successfully!
  • At this time, you should be able to get the logs under [Control Panel] - [Logs] in Admin.

3.7 Node Installation

  • The procedure is the same, with the component Node selected for the upgrade
Which component would you like to install?
[1] Admin DB
[2] Log Server DB
[3] Admin
[4] Log Server
[5] Node
5
What you choose is: Node.
  • Configure Admin and Log-Server addresses:
[+] Do you want to configure admin and log server address (/usr/local/oredge-node/conf/config.ini)? [y/N] y
 [-] Please enter the address of admin server (if admin server and node server use the same machine, no need to input.):
 [-] Please enter the address of log server (if log server and Node use the same machine, no need to input.): 54.212.32.78
  • If successful, the following prompt will be displayed at the end
Install Edge Node successfully!

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

So far, the complete 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 get in touch with us.