How to deal with VM configuration during service deployement

Hi,

I’d like to deploy service with inter-dependencies between VMs. Especilly, we have 1 vm that need to be deployed first and act as a proxy/reverse proxy to the other VMs. Let’s call it the “gateway”. So the other VMs have this “gateway” as their parent node. Everything is fine and the gateway is deployed first. But I also need to have in the vm-context all the IP of the other VMs. I’m getting the service json from onegate, but other VMs not deployed yet are missing (make sense since they are not instantiated yet). How do you deal with such situation?

Hi Madko,

have you ever thought about testing tools like consul? This can easily be used to deal with dynamic environments, servers becoming member of a cluster etc. by reacting on events. So you dont need to poll onegate (which for other things is very good).
Take a look at https://consul.io/ - it might help to fulfil your requirements
Best, M

Thank you Michael, I will look at consul. Is it something similar to puppet?

Hi Madko,
nope, consul is practically a kind of service directory. You install consul on each of your servers and they find each other “gossiping” in the network - e.g. a new VM starts and consul as well it creates “I am here” events which the other servers can use to start certain actions (think of a load balancer automatically adding new servers to its backend servers).
Consul provides a lot more of functionality and I suppose it may fit your needs - which indeed needs some evaluation.
Best, M

1 Like

Even though I do like the consul idea (I’d like to take a look at it soon), I think the problem would still be the same? If I understand the problem correctly, the problem is that in the gateway you need to know what the IPs of the nodes are going to be before they come up?

I can only think of two options.

  • You can define a specific address range that will be completely used up when all the nodes are up. The network template can be passed along in the gateway’s context, so you can know which IPs will come up beforehand. Something like:
CONTEXT = [
    NODES_NET = "$NETWORK[TEMPLATE, NETWORK=\"nodes_net\"],
    ...
]

Then you need to extract that template (in base64) and process it when deploying the gateway.

  • Or you can simply keep polling OneGate and create a script that dynamically enrolls these VMs and reconfigures the gateway as they come up.
1 Like

I’m still looking at consul but their documentation is very light. It seems it could be a very good tool indeed, but not only related to opennebula. Thank you Michael for this tip.

@jmelis thank you! I’m following the onegate polling lead. My gateway will configure itself and then send the READY=YES key to oneGate when it’s ready to forward trafic. Therefor other VMs will start their deployement. On the gateway a script will keep polling the onegate till I have the information I need about my other VMs. It works well.

Btw I can’t find any documentation about the state values on the role section in the json service file I get from OneGate. State varies from 0 to 2 I guess. May be 0 means not deployed yet, 1 is deploying, and 2 is running. I should open another thread for that.

This thread is solved thanks :sunglasses:

Yes, that information is missing from the docs. You can find it in the code:

Cheers

1 Like

wow thank you dmolina that’s perfect