Installation

This document describe how to install openresty-xray-cli.

1. Requirements

We need to access the following domains through the internet. If your network has a firewall, please check your settings.

openresty.com 443
saas.openresty.com 443

2. Install orxray agent

  • Login to your OpenResty XRay console.

  • Click the Add new target machine button.

  • Follow the guide to install the orxray agent.

3. Get API token

  • Visit your OpenResty XRay console page.

  • Click on your username in the top right corner and select Personal API tokens in the drop-down menu.

Screenshot

  • Expand the form by clicking on Generate new token, input the token name and the expiration time, and then click the Generate token button.

Screenshot

  • Please save the token, since the token is shown only once.

4. Install openresty-xray-cli

If your operating system is RHEL, CentOS, use the command below:

yum install -y openresty-xray-cli

For Fedora:

dnf install -y openresty-xray-cli

For Ubuntu or Debian:

apt install -y openresty-xray-cli

5. Set the config file

Execute the following command:

$ orxray --help

error: api_token is not found in config file '/root/.orxray/config'.

Goto https://xxx.xx.xx/security/access-tokens for api_token
Please input api_token:

Please goto https://xxx.xx.xx/security/access-tokens to get your API token and enter your api_token after the command prompt.

Try to execute the command below:

$ run-y -e '_probe _oneshot { printf("Hello,world\n"); }' -q

Hello,world

Check your configuration file:

$ cat ~/.orxray/config

[console]
host=xxx.xxx.xxx
port=443
verify_ssl=true
scheme=https
timeout=10
api_token=xxxxxxxxxxxxxxxxxxxxx
default_agent=53

Note: You can find that default_agent is automatically set to the agent id of current machine, and you can change it yourself later.