安裝 OpenResty Edge Admin 的容器
1. 準備
安裝前需要準備以下檔案/資訊:
- 配置包:
openresty-edge-VERSION.tar.gz
,請到下載中心下載。 - 您的 PostgreSQL 資料庫的 IP、埠和密碼,對應下文中的
DB_HOST
、DB_PORT
和DB_PASSWORD
。 - 映象地址,對應下文中的
DOCKER_IMAGE
。 - 映象賬號及密碼,對應下文的
REGISTRY_USERNAME
和REGISTRY_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.gz
到custom/
生成 Edge Admin 的配置檔案:
custom/config.ini
請把 DB_HOST
、DB_PORT
和 DB_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.key
和 ssl.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 已經安裝完成。