# Install OpenResty Edge Node

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

  • openresty-edge-config.*.rpm or openresty-edge-config.*.deb, like: openresty-edge-config-0.0.1-1.or.noarch.rpm
  • Your Admin's IP and port (corresponding to [% admin-ip %] and [% admin-port %] below)
  • Your Log Server's IP and port (corresponding to [% log-server-ip %] and [% log-server-port %] below)

# 1. Preparation

If your network has a firewall, you need to add the following whitelist.

```
openresty.com 443
openresty.org 443
pkg.openresty.com 443
[% admin-ip %] [% admin-port %]
[% log-server-ip %] [% log-server-port %]
```

# 2. Copy openresty-edge-config to the current directory

# 3. Download the installation script:

```bash
curl -O https://openresty.com/client/oredge/install-edge-node.sh
```

If you get a message like the following:

```bash
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-node.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.

# 4. Execute the installation script:

```bash
sudo /bin/bash -x install-edge-node.sh
```

It may take a few minutes to run next, so please be patient. Upon successful installation, you will see that the last line of output from this command is:

```
Great! OpenResty Edge Node installed successfully.
```

This script will automatically install the `openresty-edge-node` package and its dependencies, start the `oredge-node` service automatically, and set the oredge-node service to run automatically on boot.

The details can be found in the source code in the `install-edge-node.sh` file.

In addition, the oredge-node service is started by:

``` bash
sudo systemctl start oredge-node
```

Stop the service by:

``` bash
sudo systemctl stop oredge-node
```

Restart the service by:

``` bash
sudo systemctl start upgrade-oredge-node
```

The restart uses the binary upgrade method of nginx, so there is no down time.

# 5. Modify the edge-node configuration file /usr/local/oredge-node/conf/config.ini:

``` ini
#
# NOTICE: please feel free to edit these configurations if necessary.
#


[admin]

# admin server host, default:
host = "[% admin-ip %]"
port = "[% admin-port %]"


[log_cluster]

# log server host, default:
host = "[% log-server-ip %]"
port = "[% log-server-port %]"
```

After modifying the configuration file, execute the following restart service:

```
sudo systemctl start upgrade-oredge-node
```

# 6. Check the error log file for nginx on the node at /usr/local/oredge-node/logs/error.log:

``` bash
tail /usr/local/oredge-node/logs/error.log
```

If you see the last two error logs like the one below, it is perfectly normal because the newly deployed nodes need to be approved on the Admin site before they can be added to the gateway cluster.

``` bash
2017/05/25 22:19:43 [warn] 2550#2550: *4 [lua] init.lua:112:
init_worker(): node is not registered, contacting admin, context:
init_worker_by_lua*

2017/05/25 22:19:44 [warn] 2554#2554: *5 [lua] privileged.lua:190:
could not establish node identity: awaiting approval, context:
ngx.timer
```

This completes the installation of OpenResty Edge Node.

Now, you can use the installed Edge Node.

  1. Login to Admin website:

    URL: https://[% admin-host %]

    If you are trying Edge, the URL and account password for Admin will be sent with your trial email.

    For the trial version, admin is deployed on our machines, while for the future purchase of the full version, we will provide the installation package for self-deployment.

  2. After login, go to the gateway clusters tab, there you will see the join request from the newly deployed node.

    According to the information in the join request, confirm that it is your own node, and then click approve.

    The procedure of approval is to add a new node to a gateway cluster. So before you approve, you need to create a cluster on the GUI, and then you can choose when you approve.

After the edge node service is deployed according to the above documents, openresty edge is up and running.

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