sonata-nfv / son-emu

Attention! Legacy! This repo will be replaced with https://github.com/containernet/vim-emu
https://github.com/containernet/vim-emu
Apache License 2.0
36 stars 32 forks source link

starting son-emu from docker-compose #155

Closed stevenvanrossem closed 8 years ago

stevenvanrossem commented 8 years ago

When starting son-emu with a topology file from docker-compose, it does not wait at the net.CLI() because a container cannot be started in interactive mode using docker-compose. One solution is to modify the topology file, like this example: https://github.com/sonata-nfv/son-emu/blob/master/src/emuvim/examples/son-monitor_test_topo.py

Instead of the starting the CLI, a wait loop is started to keep son-emu running. The SIGINT and SIGTERM signals are trapped to gracefully shutdown son-emu when the container is stopped via the docker engine.

This should also not break starting the topology outside a docker container using python So this could serve as a more general template for constructing topology files.

mpeuster commented 8 years ago

Good solution. We should document this as an alternative way of defining topologies. However, the user looses the interactive CLI to interact with the VNFs in this case, right?

stevenvanrossem commented 8 years ago

yes because docker-compose does not allow to start docker containers in interactive mode (docker -it option). Interaction should all go via the REST api, or eg. by logging into the VNF via ssh or docker exec

mpeuster commented 8 years ago

sure. so we should support both use cases. In the normal one, e.g., in the emulator demo, the interactive CLI will play a central role to show how easy you can manipulate internals of your chains.

For the monitoring demo, we will go for the compose solution, I think?

stevenvanrossem commented 8 years ago

After some searching it does seem possible to start a container in interactive mode via docker-compose: https://github.com/docker/compose/issues/423 So this means that the cli of son-emu can also be used when it is started by docker-compose with options: stdin_open: true tty: true