# Cluster

For clusters with a scale of about 10 nodes, we could install Edge Admin and the Edge Log Server to be deployed on the same machine to lower the costs. If the scale becomes larger in the future, they can be deployed separately.

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

# Architecture

It contains three main roles (Node, Admin, Log-Server) and the architecture of the three is shown in the figure:

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

# Installation

Note: The following documents/information need to be prepared before installation.

  • init_admin_db_[% version-number %].sh
  • init_log_server_db_[% version-number %].sh
  • openresty-edge-config-[% version-number %].rpm or openresty-edge-config-[% version-number %].deb

# 1. 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

# 2. Database installation and initialization

listening port 5432.

  • Copy openresty-edge-config to the current directory

  • Download the installation script:

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

    If you get a message like the following:

    curl: command not found
    

    It is possible that curl is not installed on the system or that the system shell program does not contain a search path for curl.

    You can use absolute paths to retry.

    /usr/bin/curl -O https://openresty.com/client/oredge/install-edge-postgresql.sh
    

    Your system's path may be different, contact your webmaster or use a command such as which bash to check the path to correct the situation.

  • Execute the installation script:

    sudo /bin/bash -x install-edge-postgresql.sh
    
  • Database initialization:

    # Replace [% version-number %] with the actual version number
    /bin/bash init_admin_db_[% version-number %].sh
    
    # Replace [% version-number %] with the actual version number
    /bin/bash init_log_server_db_[% version-number %].sh
    

# 3. Admin Web Installation

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

  • Copy openresty-edge-config to the current directory

  • Download the installation script:

    curl -O https://openresty.com/client/oredge/install-edge-admin.sh
    
  • Execute the installation script:

    sudo /bin/bash -x install-edge-admin.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, 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 Admin

    sudo systemctl reload oredge-admin
    

At this point 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_[% version-number %].sh
    

# 3.1 double admin-web

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.

# 4. Log-Server Installation

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

  • Copy openresty-edge-config to the current directory

  • Download the installation script:

    curl -O https://openresty.com/client/oredge/install-edge-log-server.sh
    
  • Execute the installation script:

    sudo /bin/bash -x install-edge-log-server.sh
    
  • Modify configuration: (If Database, Admin, Log-Server use the same machine, you can use the default configuration)

    1.Database address

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

# 5. Edge Node Installation

  • Copy openresty-edge-config to the current directory

  • Download the installation script:

    curl -O https://openresty.com/client/oredge/install-edge-node.sh
    
  • Execute the installation script:

    sudo /bin/bash -x install-edge-node.sh
    
  • Modify configuration:

    1.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. 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 Node:

    sudo systemctl reload oredge-node
    

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

# Start the OpenResty Edge service

We provide online documentations:

https://doc.openresty.com/en/edge-admin/01-get-started/get-started.html

In addition we have provided videos:

https://blog.openresty.com/en/tags/openresty-edge/

https://www.youtube.com/channel/UCXVmwF-UCScv2ftsGoMqxhw

If you have any questions, please contact us.