Skip to main content
Version: 5.5

Docker Compose Example of Redundancy and Failover with Nginx

Docker Compose Example of Redundancy and Failover with Nginx​

The Nginx configurations described on the page Redundancy and Failover with Nginx can be used in Docker Compose to create an OPC Router redundancy pair with failover.

The files used for this project can be found on the page HTTP(s) failover concepts for REST, OPC UA servers, and WebManagement in the OPC Router .

docker-compose.yaml
services:
nginx_plus:
# Nginx Plus
image: private-registry.nginx.com/nginx-plus/base:<Tag>
# Alternatively, Nginx
# image: nginx:latest
restart: always
networks:
- opcrouter-net
ports:
- "5080:80"

environment:
# Required only for Nginx Plus
- NGINX_LICENSE_JWT=<nginx-license-jwt>
volumes:
# Make nginx.conf available in the container
- ./nginx.conf:/etc/nginx/nginx.conf:ro

opcrouter-primary:
image: opcrouter/service:latest
restart: always
networks:
- opcrouter-net
ports:
- "5085:8080"
environment:
- OR_I_ACCEPT_EULA=true
- INITIAL_USERNAME=admin
- INITIAL_PASSWORD=SuperSecret123
- OR_REDUNDANCY_MODE=primary
- OR_REDUNDANCY_LOCAL_MANAGEMENT_ADDRESS=http://opcrouter-primary:8080
- OR_REDUNDANCY_SHARED_KEY=LUyLxk4kZdvYW9kM6ZSBWbBatdj9RGow9Bp
- OR_IMPORT_SOURCE=/inray/REST_Primary.rpe
volumes:
# Making the Project Available in a Container
- ../REST_Primary.rpe:/inray/REST_Primary.rpe

opcrouter-secondary:
image: opcrouter/service:latest
restart: always
networks:
- opcrouter-net
ports:
- "5086:8080"
environment:
- OR_I_ACCEPT_EULA=true
- INITIAL_USERNAME=admin
- INITIAL_PASSWORD=SuperSecret123
- OR_REDUNDANCY_MODE=secondary
- OR_REDUNDANCY_SHARED_KEY=LUyLxk4kZdvYW9kM6ZSBWbBatdj9RGow9Bp
- OR_REDUNDANCY_ADDRESS=http://opcrouter-primary:8080
- OR_REDUNDANCY_LOCAL_MANAGEMENT_ADDRESS=http://opcrouter-secondary:8080
- OR_REDUNDANCY_PRIMARY_TIMEOUT=30
- OR_REDUNDANCY_SECONDARY_HEARTBEAT_INTERVAL=10
- OR_IMPORT_SOURCE=/inray/REST_Secondary.rpe
volumes:
# Making the Project Available in a Container
- ../REST_Secondary.rpe:/inray/REST_Secondary.rpe

networks:
opcrouter-net: