Docker Compose example for Redundancy failover with Nginx
The Nginx configurations described on page Redundancy failover with Nginx can be used in Docker Composer to create an OPC router redundancy pair with failover.
The files that are used as a project can be found on the HTTP(s) failover concepts for REST, OPC UA Server & WebManagement in the OPC Router page.
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:
# Only required 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:
# Make project available in the 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:
# Make project available in the container
- ./REST_Secondary.rpe:/inray/REST_Secondary.rpe
networks:
opcrouter-net: