安装 OpenResty Edge Admin 的容器

1. 准备

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

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

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-admin:22.6.1

3. 启动容器

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

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

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

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

#
# NOTICE: please feel free to edit these configurations if necessary.
#
# Both [postgresql] section and [log_server] 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_admin and the user: or_edge_admin
# please contact us when you want to change them.


[log_server]

# log server host, default:
host = "127.0.0.1"


[clone_admin]

# Another admin server host when you have deployed two admin servers.
# It is optional, please ignore it when you only deployed one admin.
# host = ""

# The role for the current edge-admin, it can be "main", "staging" or "normal"(default).
# The main edge-admin will send the release events to staging edge-admin,
# so that the staging edge-admin will release the related configurations to gray gateway nodes.
# It's only useful during edge-admin gray upgrade.
# role = "normal"

  • 配置 SSL 证书及秘钥(可选)

复制证书及秘钥到 custom 目录中,名称分别为 ssl.keyssl.crt

  • 启动容器

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

docker run -d -p 443:443 -p 12345:12345 --name openresty-edge-admin -v /root/custom/:/usr/local/oredge-admin/custom/ DOCKER_IMAGE

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

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