Skip to main content
Version: 5.4

Docker Compose example for redundancy failover with Nginx

The Nginx configurations described on the page [.](./ "mention") can be used in Docker Composer to create an OPC Router redundancy pair with failover.

The files used as a project can be found on the page [..](../ "mention").

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:
- &quot;5080:80&quot;

environment:
# Only required for Nginx Plus
- NGINX_LICENSE_JWT=<nginx lizenz="" 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:
- &quot;5085:8080&quot;
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 container
- ../REST_Primary.rpe:/inray/REST_Primary.rpe

opcrouter-secondary:
image: opcrouter/service:latest
restart: always
networks:
- opcrouter-net
ports:
- &quot;5086:8080&quot;
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 container
- ../REST_Secondary.rpe:/inray/REST_Secondary.rpe

networks:
opcrouter-net: