A few years ago, I wrote a book about the BGP routing protocol, and I decided to create a way to run a "mini lab" so readers could try examples from the book for themselves. This is powered by virtual routers in Docker and managed with shell scripts, bash on the Mac/Linux side and PowerShell on the Windows side. Go here to take a look.
I now want to extend this tool to make it more flexible. I think a good way to do that is to load virtual network configurations into an SQLite database and then run the virtual machines based on the contents of the database. Looks like SQLite support in Python 3 is pretty straightforward, so that part shouldn't be too much trouble.
For another project I already rewrote some of those shell scripts in Python, and then I encountered numerous ways for Python to interact with Docker. I went for the simplest one: simply executing stuff on the command line. Does it make sense to use one of the more complex ways to talk to Docker from Python?
Right now the Docker containers running the virtual routers get some path mapped to their file system where they find their config files. I'm going to put these in the database, so I need some code to extract those files and update them in the database if they're changed. But a really great alternative would be if I could have Docker mount some part of the database in the container's file system. I have found several projects that let a Linux machine mount an SQLite database as a file system, so that would be a decent alternative, but only under Linux*. Can Docker itself do something like this? Or are some kind of plugins possible to add this functionality?
I sometimes need this system to interact with the web. I currently do that through PHP, but I found it impossible for the Apache demon to interact with Docker due to users/permissions. So I run a PHP script on the command line and have the web PHP and CLI PHP scripts talk to each other through a System V message queue. Is that something that Python can do without too much trouble?
* It's going to be fun trying to get all of this Python stuff to work under Windows!
I now want to extend this tool to make it more flexible. I think a good way to do that is to load virtual network configurations into an SQLite database and then run the virtual machines based on the contents of the database. Looks like SQLite support in Python 3 is pretty straightforward, so that part shouldn't be too much trouble.
For another project I already rewrote some of those shell scripts in Python, and then I encountered numerous ways for Python to interact with Docker. I went for the simplest one: simply executing stuff on the command line. Does it make sense to use one of the more complex ways to talk to Docker from Python?
Right now the Docker containers running the virtual routers get some path mapped to their file system where they find their config files. I'm going to put these in the database, so I need some code to extract those files and update them in the database if they're changed. But a really great alternative would be if I could have Docker mount some part of the database in the container's file system. I have found several projects that let a Linux machine mount an SQLite database as a file system, so that would be a decent alternative, but only under Linux*. Can Docker itself do something like this? Or are some kind of plugins possible to add this functionality?
I sometimes need this system to interact with the web. I currently do that through PHP, but I found it impossible for the Apache demon to interact with Docker due to users/permissions. So I run a PHP script on the command line and have the web PHP and CLI PHP scripts talk to each other through a System V message queue. Is that something that Python can do without too much trouble?
* It's going to be fun trying to get all of this Python stuff to work under Windows!