%3 ::nx::Object ::nx::Object ::acs::Container ::acs::Container active_p init mapping ::acs::Container->::nx::Object

Class ::acs::Container

::acs::Container[i] create ...

This class captures the information whether or not OpenACS is running inside a container. This is important since the container provide container-internal and external IP addresses. The internal IP addresses are e.g. needed when running a regression test inside a container, while the external address is needed for e.g. redirects. In the case of Docker, the networking information can be collected in a container setup script with the following command. curl -s --unix-socket /var/run/docker.sock # -o /scripts/docker.config # http://localhost/containers/${HOSTNAME}/json The docker API/pipe requires ROOT permissions for accessing the socket (or the full docker setup with the "docker" user). To keep the docker container small, we follow the approach with the root privilege, but this has to be done in a setup script before NaviServer switches to the non-privileged user. A sample setup script will be made available together with the openacs docker container. In general, one can extend this class to handle as well other container mechanisms via subclassing and determining the kind of container during startup. So far, there is only Docker support. Create the container object e.g. as ::acs::Container create acs::container
Defined in packages/acs-tcl/tcl/acs-container-procs.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nx::Object[i]
::nx::Class create ::acs::Container \
     -superclass ::nx::Object

Methods (to be applied on instances)

  • active_p (scripted, public)

     <instance of acs::Container[i]> active_p

    Check, if we are running inside a Docker container

    Testcases:
    No testcase defined.
    return [info exists :containerMapping]
  • mapping (scripted, public)

     <instance of acs::Container[i]> mapping

    Return the container mapping

    Testcases:
    No testcase defined.
    expr {[:active_p] ? ${:containerMapping} : ""}