Lpar2rrd/Stor2rrd as docker using the same port

In the past I installed lpar2rrd and stor2rrd on the same linux OS using "legacy" method - installing rpm, configuring apache etc.


Recently I started lpar2rrd instance as a docker, I forwarded 80 port on host to 80 port on lpar2rrd container. It works fine.


But when I want to use stor2rrd on the same host, 80 port is already in use, therefore I cannot folow "legacy" approach where both applications are simply accessible from the same IP/Port - but suing different url /lpar2rrd and /stor2rrd.


I know I can start stor2rrd container with forwarding different port, but then I need to request extra port to be opened on firewall. Is there a better way of starting both lpar/stor as docker using the same port (80 in my case)?


Thanks!

Comments

  • Hello,

    I think the best solution for you will be some proxy server (container) running on port 80/443 and routing traffic between LPAR/STOR containers.

    I'll do some testing and prepare brief howto for you.

  • Hello,

    • Create docker-compose.yml like this:
    version: "3.7"
    services:
     caddy:
      image: caddy:latest
      restart: unless-stopped
      container_name: caddy
      ports:
       - "80:80"
       - "443:443"
      volumes:
       - ./Caddyfile:/etc/caddy/Caddyfile
    
     lpar2rrd:
      image: xorux/lpar2rrd
      restart: unless-stopped
      container_name: LPAR2RRD
      ports:
       - "8162:8162"
      volumes:
       - lpar2rrd:/home/lpar2rrd
    
     stor2rrd:
      image: xorux/stor2rrd
      restart: unless-stopped
      container_name: STOR2RRD
      volumes:
       - stor2rrd:/home/stor2rrd
    
    volumes:
     lpar2rrd:
     stor2rrd:
    

    Adjust ports, volumes, names etc. to fit your environment

    • In the same dir create Caddyfile like this:
    {
            auto_https off
    }
     
    localhost:80 {
            handle_path /lpar2rrd-cgi/* {
                    rewrite * /lpar2rrd-cgi/{path}
                    reverse_proxy lpar2rrd:80
            }
            handle_path /lpar2rrd/* {
                    reverse_proxy lpar2rrd:80
            }
            handle_path /stor2rrd-cgi/* {
                    rewrite * /stor2rrd-cgi/{path}
                    reverse_proxy stor2rrd:80
            }
            handle_path /stor2rrd/* {
                    reverse_proxy stor2rrd:80
            }
    }
    

    When you start all services with docker-compose up -d, you can find both apps running on the same host at following urls:

    http://your_hostname/lpar2rrd/

    http://your_hostname/stor2rrd/

Sign In or Register to comment.