Managing Containers

This section covers various Serviced container topics.

How to Customize and Commit a Container

To customize a container and make those changes permanent:

[zenoss@cc]: serviced service shell -i -s mychange zope bash

[root@ZOPE]: su - zenoss
[zenoss@ZOPE]: [make your change change changes in the shell]
[zenoss@ZOPE]:  exit
[root@ZOPE]:  exit

[zenoss@cc]: serviced snapshot commit mychange
[zenoss@cc]: serviced service restart ...

For example: To add PyYAML to the zope containers:

[zenoss@cc]: serviced service shell -i -s mychange zope bash

[root@ZOPE]: su - zenoss
[zenoss@ZOPE]: easy_install pyyaml
[zenoss@ZOPE]: zendmd

   In [1]: import yaml
     => (if no errors, its installed correctly)

[zenoss@ZOPE]: exit
[root@ZOPE]:  exit

[zenoss@cc]: serviced snapshot commit mychange
[zenoss@cc]: serviced service restart ...

To customize a remote container you need to provice the full path to the container instance:

serviced service shell -i -s solutions_xxx \
   golfballs/Zenoss.resmgr/Zenoss/Collection/localhost/GOLF1/zenpython \
   bash

To reconnect to your container after you exit, you need to start it:

docker start solutions_xxx
docker attach solutions_xxx

Installing Linked Zenpack that needs Maven, Java, etc…

ZenPacks that need maven offer a slight problem, because you need to install Maven and Java (OpenSDK) to get them installed in link-mode. There is also a minor package dependency problem in zenoss-centos-deps.

They can be installed in the following way in a container:

[zenoss@cc]:serviced service attach zenhub

[root@Zenhub]: yum remove zenoss-centos-deps
[root@Zenhub]: yum install maven
[root@Zenhub]: su - zenoss

[zenoss@Zenhub]: zenpack --link --install /z/ZenPacks.zenoss.XYZ
... exit out of the containers ...
[zenoss@cc]: serviced service restart zenoss.core

Installing ZenETL as a Linked ZP in a ZSD Installation

This requires some care because you have to ensure the zen*etl tools get installed into the Zope image. This normally does not happen because in a link install, the normal tools don’t get copied to /opt/zenoss/bin.

  • First compile the ZP with mvn support externally. Copy the ZP in place.

  • Edit GNUMakefile and comment out the mvn commands so the container doesn barf.

  • Execute:

    serviced service shell -i -s mychange --mount /z,/z zope su - zenoss
    
    [zenoss@612b45db88f8]: cd /z/ZenPacks.zenoss.ZenETL/ZenPacks/zenoss/ZenETL
    [zenoss@612b45db88f8]: cp daemons/\*.py /opt/zenoss/bin/
    [zenoss@612b45db88f8]: cp cp zen\*etl.py /opt/zenoss/
    [zenoss@612b45db88f8]: exit
    
  • Grab the container number from the shell’s prompt, say: 612b45db88f8

  • cleanup:

    serviced service commit 612b45db88f8
    docker rm mychange