Service Virtualization

  • 1.  Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 04, 2017 06:18 PM

    I have a problem when I want to execute the docker run command to start a VSE container. I tried the example in the documentation. What I noticed is that I needed to supply the ip address of the container as part of the name argument

    (so: -n tcp://ipaddress_container:2013/VSE). When I do not supply this argument or use some rubbish input I get errors like below. I used : -n tcp://bla:2013/MyVSE  here.

     

    java.rmi.RemoteException: JMS Messaging problem with ServerRequestHandler for tcp://bla:2013/MyVSE Could not connect to broker URL: tcp://bla:2013?wireFormat.maxInactivityDuration=0. Reason: java.net.UnknownHostException: bla; nested exception is: com.itko.jms.JMSException: Could not connect to broker URL: tcp://bla:2013?wireFormat.maxInactivityDuration=0. Reason: java.net.UnknownHostException: bla

     

    So it looks like I can only start a VSE docker container with a fixed ip address. I do not know what ip address will be asiigned dynamically before actually starting the container. Or is there another way?

     

    (And why is it saying it cannot connect to broker URL because this has nothing to do with a broker but a VSE?)

     

    Cheers

    Izaak



  • 2.  Re: Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 05, 2017 10:48 AM

    Now I see what is happening. When I start the VSE docker container and I do not supply a name (no -n argument) the VSE assumes a name based upon the hostname (if any, otherwise the ip address), the port and the default name VSE. Well it finds a hostname because that is assigned automatically by docker to the container and is some random sequence of numbers and characters (so the name ends up being something like tcp://aaef43487dc:2013/VSE). But this hostname is not known by the registry. So when it tries to connect it failes. This looks like something pretty fundamental. So did somebody else encounter this problem and was the resolution? Or am I doing wrong myself?



  • 3.  Re: Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 05, 2017 11:13 AM

    I am not looking for a solution with 'fixed' ip addresses. In most of the samples I see a fixed ip being used for starting up a VSE container but that is not what I want. So that would be something like I have an empty docker network (no assigned ip's) so the first component I start, the EDB, has an ip number ending with .01, the Registry I start afterwards will have an ip address ending with 02. If I now startup a VSE container I can use an ip ending with 03. Perhaps we need a VSE argument saying it should not take the hostname by default but force it to use the ip address.  I am open to other solutions. 



  • 4.  Re: Can I start a VSE docker container with a dynamically assigned ip address?
    Best Answer

    Posted Aug 06, 2017 11:18 PM

    Is it possible for you to use some sort of shell script to start the servers and pass the server name as a parameter.  You might orchestrate from Jenkins and set variables according to the provisioned server name(s).  The following is not a complete script. Added as a sample to give an idea of how you might make the start-up more variable driven.  Please excuse syntax issues.

     

    # add script to create docker container and bootstrap docker

    # additional user setup if required

    export DASHBOARD_HOSTNAME="EntDashboard.server.com"

    export HOSTNAME="${HOSTNAME}.yourServer.com"

    :

    # add logic to create external directories for hotdeploy and projects directories

    :

    sudo docker pull docker.artifactory.yourServer.com/devtest/portal-base

    sudo docker pull docker.artifactory.yourServer.com/devtest/registry-broker-base

    sudo docker pull docker.artifactory.yourServer.com/devtest/servers-base

    :

    sudo docker run -d -v /opt/hotDeploy:/opt/devtest/hotDeploy -v /opt/Projects:/opt/devtest/Projects --restart=always --name Registry -p 2010:2010 -p 1505:1505 -p 1528:1528 -e LISA_MORE_VM_PROPS="-Ddevtest.enterprisedashboard.host=${DASHBOARD_HOSTNAME} -Ddevtest.enterprisedashboard.port=1506" docker.artifactory.yourServer.com/devtest/registry-broker-base opt/devtest/bin/Registry -n tcp://${HOSTNAME}:2010/Registry

    :

    sudo docker run -d -v /opt/hotDeploy:/opt/devtest/hotDeploy --restart=always --name VSE -p 2013:2013 -p 8000-8100:8000-8100 docker.artifactory.yourServer.com/devtest/servers-base opt/devtest/bin/VirtualServiceEnvironment -n tcp://${HOSTNAME}:2013/VSE -m tcp://${HOSTNAME}:2010/Registry

    :

    Repeat for other DevTest Servers

    :

    Expose the Docker UI

    sudo docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker



  • 5.  Re: Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 07, 2017 03:52 AM

    Hi Joel, thank you for your answer. I am happy with your quick respond!

    Perhaps you could explain it a little bit more as I am not an expert in networking.  What you suggest, correct me if I am wrong, is to create a number of DNS entries for  DevTest components. That might be a little complicated because I am not running a DNS server locally. I wanted to create a demo on my laptop (first I am trying via Virtualbox because I am not running Linux natively). When you are using a DNS that would mean you must run the docker containers in that network and not in a by docker created bridged network. If you would do that the docker containers are assigned ip address from within that subnet (172.17.0.0/16 in my case).

     

    So what docker network setup do I need to use DNS names. How do I do that locally on a virtual machine running docker on my laptop?



  • 6.  Re: Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 07, 2017 08:54 AM

    I am sorry, but I have not tried this using VirtualBox so I am not going to be much help. Perhaps, someone can provide some ideas.

    The example script pertains to Linux VMs provisioned into the enterprise; hence the use of DNS and/or known IPs. 



  • 7.  Re: Can I start a VSE docker container with a dynamically assigned ip address?

    Posted Aug 07, 2017 09:46 AM

    No problemo 

     

    Yes I am running docker inside a debian vm. I use the default setup so docker is using bridged mode. I use the images as they are created with gradle from the /docker folder in the DevTest installation. I use the the CLI command from the samples in the documentation: 

     

    docker run -d –-name VSE -p 2013:2013 devtest/servers-base /opt/devtest/bin/VirtualServiceEnvironment
    -n tcp://10.141.66.40:2013/VSE -m tcp://10.141.66.40:2010/Registry

     

    In bold the ip address of the container itself.