Guide to Containerized Deployment of OpenResty Edge
This guide provides a detailed walkthrough of the complete process for deploying OpenResty Edge in a containerized environment. This deployment method is suitable for quick testing and is not recommended for production environments.
Note: For production environment deployments, we recommend referring to Installing OpenResty Edge or the Kubernetes Deployment Guide.
Deployment Preparation
Environment Planning
- Assign IP addresses for each component (the following example values are for reference only, please adjust according to your actual situation):
Component Name | Environment Variable Name | Example IP |
---|---|---|
OpenResty Edge Admin Database | OREDGE_ADMIN_DB_HOST | 172.17.0.2 |
OpenResty Edge Log Database | OREDGE_LOG_SERVER_DB_HOST | 172.17.0.3 |
OpenResty Edge Log Service | OREDGE_LOG_SERVER_HOST | 172.17.0.4 |
OpenResty Edge Admin Console | OREDGE_ADMIN_HOST | 172.17.0.5 |
OpenResty Edge Node | OREDGE_NODE_HOST | 172.17.0.6 |
- Specify a root directory for storing configurations and data for all components, represented by the environment variable
OREDGE_DATA_ROOT
, for example: /data/oredge.
Resource Acquisition
Obtain the following information from the delivery email:
- Image version
OREDGE_IMAGE_VERSION
, for example:24.9.21-1
- Image repository access credentials
OREDGE_REGISTRY_USERNAME
andOREDGE_REGISTRY_PASSWORD
- Image version
Download the latest configuration package from the OpenResty Download Center: openresty-edge-
.tar.gz
Environment Variable Configuration (Optional but Recommended)
To simplify subsequent operations, it is recommended to configure the following environment variables (please adjust values according to your actual situation):
export OREDGE_IMAGE_VERSION=24.9.21-1
export OREDGE_ADMIN_DB_HOST=172.17.0.2
export OREDGE_LOG_SERVER_DB_HOST=172.17.0.3
export OREDGE_LOG_SERVER_HOST=172.17.0.4
export OREDGE_ADMIN_HOST=172.17.0.5
export OREDGE_NODE_HOST=172.17.0.6
export OREDGE_DATA_ROOT=/data/oredge
export OREDGE_REGISTRY_USERNAME=oredge-registry-username
Image Download
Execute the following commands to download the required Docker images:
# Log in to the image repository
docker login --username $OREDGE_REGISTRY_USERNAME registry.openresty.com
# OpenResty Edge Admin Database image
docker pull registry.openresty.com/edge/rocky/8/openresty-edge-admin-db:$OREDGE_IMAGE_VERSION
# OpenResty Edge Log Server Database image
docker pull registry.openresty.com/edge/rocky/8/openresty-edge-log-server-db:$OREDGE_IMAGE_VERSION
# OpenResty Edge Log Server image
docker pull registry.openresty.com/edge/rocky/8/openresty-edge-log-server:$OREDGE_IMAGE_VERSION
# OpenResty Edge Admin image
docker pull registry.openresty.com/edge/rocky/8/openresty-edge-admin:$OREDGE_IMAGE_VERSION
# OpenResty Edge Node image
docker pull registry.openresty.com/edge/rocky/8/openresty-edge-node:$OREDGE_IMAGE_VERSION
Component Deployment Process
1. Deploy Edge Admin Database
This is the core database for OpenResty Edge, storing configuration and management information:
# Create data directory
mkdir -p $OREDGE_DATA_ROOT/admin-db/
# Extract configuration package and obtain initialization credentials
tar xf openresty-edge-*.tar.gz && cd openresty-edge-*/
export DEFAULT_EDGE_PWD=$(grep -rs 'DEFAULT_EDGE_PWD=' | head -n 1 | awk -F"'" '{print $2}')
export DEFAULT_EDGE_ENC_PWD=$(grep -rs 'DEFAULT_EDGE_ENC_PWD=' | head -n 1 | awk -F"'" '{print $2}')
cd -
# Start container
docker run -d --name openresty-edge-admin-database \
--ip $OREDGE_ADMIN_DB_HOST \
-e POSTGRES_DB=or_edge_admin \
-e POSTGRES_USER=or_edge_admin \
-e PGUSER=or_edge_admin \
-e POSTGRES_HOST_AUTH_METHOD=trust \
-e POSTGRES_CONF_ENABLE_TIMESCALE=true \
-e EDGE_ADMIN_INIT_PASSWORD="$DEFAULT_EDGE_PWD" \
-e EDGE_ADMIN_INIT_ENCODED_PASSWORD="$DEFAULT_EDGE_ENC_PWD" \
-v $OREDGE_DATA_ROOT/admin-db:/var/postgres12/ \
registry.openresty.com/edge/rocky/8/openresty-edge-admin-db:$OREDGE_IMAGE_VERSION
2. Deploy Edge Log Server Database
This database is used to store logs and monitoring data:
# Create data directory
mkdir -p $OREDGE_DATA_ROOT/log-server-db
# Start container
docker run -d --name openresty-edge-log-server-database \
--ip $OREDGE_LOG_SERVER_DB_HOST \
-e 'POSTGRES_DB=or_edge_log_server' \
-e 'POSTGRES_USER=or_edge_log_server' \
-e 'PGUSER=or_edge_log_server' \
-e 'POSTGRES_HOST_AUTH_METHOD=trust' \
-e 'POSTGRES_CONF_ENABLE_TIMESCALE=true' \
-v $OREDGE_DATA_ROOT/log-server-db:/var/postgres12/ \
registry.openresty.com/edge/rocky/8/openresty-edge-log-server-db:$OREDGE_IMAGE_VERSION
3. Deploy Edge Log Server Service
The Log Server is responsible for collecting and processing logs:
# Create configuration directory
mkdir -p $OREDGE_DATA_ROOT/log-server/custom
# Copy configuration package to custom directory
cp openresty-edge-*.tar.gz $OREDGE_DATA_ROOT/log-server/custom/
# Generate configuration file
cat > $OREDGE_DATA_ROOT/log-server/custom/config.ini <<EOF
[postgresql]
host = "$OREDGE_LOG_SERVER_DB_HOST"
EOF
# Start container
docker run -d --name openresty-edge-log-server \
--ip $OREDGE_LOG_SERVER_HOST \
-v $OREDGE_DATA_ROOT/log-server/custom/:/usr/local/oredge-log-server/custom/ \
registry.openresty.com/edge/rocky/8/openresty-edge-log-server:$OREDGE_IMAGE_VERSION
4. Deploy Edge Admin Console
The Admin Console provides a web interface for managing OpenResty Edge:
# Create configuration directory
mkdir -p $OREDGE_DATA_ROOT/admin/custom
# Copy configuration package to custom directory
cp openresty-edge-*.tar.gz $OREDGE_DATA_ROOT/admin/custom/
# Generate configuration file
cat > $OREDGE_DATA_ROOT/admin/custom/config.ini <<EOF
[postgresql]
host = "$OREDGE_ADMIN_DB_HOST"
[log_server]
host = "$OREDGE_LOG_SERVER_HOST"
EOF
# Place SSL certificate (optional)
# cp ssl.key ssl.crt $OREDGE_DATA_ROOT/admin/custom/
# Start container, adjust mapped ports if there's a conflict
docker run -d -p 443:443 --name openresty-edge-admin \
--ip $OREDGE_ADMIN_HOST \
-v $OREDGE_DATA_ROOT/admin/custom:/usr/local/oredge-admin/custom/ \
registry.openresty.com/edge/rocky/8/openresty-edge-admin:$OREDGE_IMAGE_VERSION
5. Deploy Edge Node
The Edge Node is the component that actually handles traffic:
mkdir -p $OREDGE_DATA_ROOT/node/{custom,data}
# Copy configuration package to custom directory
cp openresty-edge-*.tar.gz $OREDGE_DATA_ROOT/node/custom/
# Generate configuration file
cat > $OREDGE_DATA_ROOT/node/custom/config.ini <<EOF
[admin]
host = "$OREDGE_ADMIN_HOST"
port = 12345
[log_server]
endpoints = "https://$OREDGE_LOG_SERVER_HOST:12346"
EOF
# Start container, adjust mapped ports if there's a conflict
docker run -d -p 80:80 -p 443:443 --name openresty-edge-node \
--ip $OREDGE_NODE_HOST \
-v $OREDGE_DATA_ROOT/node/custom:/usr/local/oredge-node/custom \
-v $OREDGE_DATA_ROOT/node/data:/usr/local/oredge-node/data \
registry.openresty.com/edge/rocky/8/openresty-edge-node:$OREDGE_IMAGE_VERSION
Obtain Edge Admin Console Access Credentials
Execute the following command to get the initial login information:
cd openresty-edge-*/
bash openresty-edge-installer.sh -a get -c default-info
cd -
Usage Guide
- Access the Edge Admin console using a browser:
https://<OREDGE_ADMIN_HOST>
- After logging in, navigate to the [Gateway Clusters] page and process the join requests for newly deployed nodes
- Additional resources:
If you encounter any issues during deployment or use, please don’t hesitate to contact us.