Le vendredi 03 mai 2013 à 15:38 +0100, Daniel P. Berrange a écrit :
> On Fri, May 03, 2013 at 04:32:45PM +0200, Michael Scherer wrote:
> > This permit to create a templated unit inside the sandbox,
> > using the sandbox name as a variable and so running the same
> > unit with a different configuration without too much hassle.
> >
> > For example, someone could have several different configuration of
> > website in /etc/nginx/websites.d/ and have each of them started in
> > a different sandbox, with a sample templated unit using the sandbox
> > name as a option to read the proper configuration file directly.
>
> Can you expand on this a little showing example unit file contents
> and how you'd invoke virt-sandbox-service with it.
You mean in the commit log, or on the list ?
Basically, what i am doing is the following :
Here is the unit file ( copy from nginx, as I cannot include it sine
ExecStart cannot be replaced ) :
[Unit]
Description=Test of a specific nginx running in lxc
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
PIDFile=/run/nginx.%i.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.%i.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.%i.conf
Type=forking
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
And to run it :
# virt-sandbox-service create -u nginx_lxc@
test.example.org --package
nginx
So this create a container using /etc/nginx.test.example.org.conf as a
configuration file, with the unit being linked and properly templated
(
http://0pointer.de/blog/projects/instances.html ).
If that's enough explanation, I will write something in the commit log,
and also add some documentation as I totally forgot about it.