安装 OpenResty Edge Log Server 的容器

1. 准备

安装前需要准备以下文件/信息:

  • 配置包:openresty-edge-VERSION.tar.gz,请到下载中心下载。
  • 您的 Edge Admin 的 IP,对应下文中的 ADMIN_HOST
  • 您的 PostgreSQL 数据库的 IP、端口和密码,对应下文中的 DB_HOSTDB_PORTDB_PASSWORD
  • 镜像地址,对应下文中的 DOCKER_IMAGE
  • 镜像账号及密码,对应下文的 REGISTRY_USERNAMEREGISTRY_PASSWORD

2. 下载镜像

  • 登录 Registry
sudo docker login --username=REGISTRY_USERNAME registry.openresty.com
# 输入密码:REGISTRY_PASSWORD
  • 下载镜像
docker pull DOCKER_IMAGE

# example
docker pull registry.openresty.com/edge/ubuntu/20.04/openresty-edge-log-server:22.6.1

3. 启动容器

  • 新建挂载到容器中的文件夹: custom/

  • 拷贝 openresty-edge-VERSION.tar.gzcustom/

  • 生成 Edge Log Server 的配置文件:custom/config.ini

请把 DB_HOSTDB_PORTDB_PASSWORD 替换成实际的内容。

#
# NOTICE: please feel free to edit these configurations if necessary.
#
# Both [postgresql] section and [admin] section need to be configured below.
#

[postgresql]

# the host to connect to, default:
host = "DB_HOST"

# the port to connect to, default:
port = "DB_PORT"

# password for authentication, default:
password = 'DB_PASSWORD'

# enable ssl, default:
ssl = false

# abort the connection if the server does not support SSL connections, default:
ssl_required = false


# NOTICE: we hard code the database: or_edge_log_server and the user: or_edge_log_server
# please contact us when you want to change them.


[admin]

# admin host, default:
host = "ADMIN_HOST"

  • 启动容器

假设 custom/ 的绝对路径是 /root/custom/

docker run -d -p 12346:12346 --name openresty-edge-log-server -v /root/custom/:/usr/local/oredge-log-server/custom/ DOCKER_IMAGE

# 示例:
docker run -d -p 12346:12346 --name openresty-edge-log-server -v /root/custom/:/usr/local/oredge-log-server/custom/ registry.openresty.com/edge/ubuntu/20.04/openresty-edge-log-server:22.6.1
  • 如果出现问题,可以使用以下命令停止并删除容器:
docker stop openresty-edge-log-server
docker rm openresty-edge-log-server

至此 OpenResty Edge Admin 已经安装完成。