Deploying Vagga Containers¶
Vagga is a common way to develop applications for later deployment using lithos. Also vagga is a common way to prepare a container image for use with lithos.
Usually vagga does it’s best to make containers as close to production as possible. Still vagga tries to make good trade-off to make it’s easier to use for development, so there are few small quircks that you may or may not notice when deploying.
Here is a boring list, later sections describe some things in more detail:
- Unsurprisingly
/workdirectory is absent in production container. Usually this means three things:- Your sources must be copied/installed into container (e.g. using Copy)
- There is no current working directory, unless you specify it explicitly
current directory is root
/ - You can’t write into working directory or
/work/somewhere
- All directories are read-only by default. Basic consequences are:
- There is no writable
/tmpunless you specify one. This also means there is no default for temporary dir, you have to chose whether this is an in-memoryTmpfsor on-diskPersistent. - There is no
/dev/shmby default. This is just anothertmpfsvolume in every system nowadays, so just measure how much you need and mount aTmpfs. Be aware that each container even on same machine get’s it’s own instance. - We can’t even overwrite
/etc/resolv.confand/etc/hosts, see below.
- There is no writable
- There are few environment variables that vagga sets in container by default:
TERM– is propagated from external environment. For daemons it should never matter. Forinteractivecommands it may matter.PATH– in vagga is set to hard-coded value. There is no default value in lithos. If your program runs any binaries (and usually lots of them do, even if you don’t expect), you want to setPATH.- Various
*_proxyvariables are propagated. They are almost never useful for daemons. But are written here for completeness.
- In vagga we don’t update
/etc/resolv.confand/etc/hosts, but in lithos we have such mechanism. The mechanism is following:- In container you make the symlinks
/etc/resolv.conf -> /state/resolv.conf,/etc/hosts -> /state/hosts - The
/statedirectory is mounted asStatedir - Lithos automatically puts
resolv.confandhostsinto statedir when container is created (respectingresolv-confandhosts-file) - Then files can be updated by updating files
in
/var/run/lithos/state/<sandbox>/<process>/
- In container you make the symlinks
- Because by default neither vagga nor lithos have network isolation, some
things that are accessible in the dev system may not be accessible in the
server system. This includes both, services on
localhostas well as in abstract unix socket namespace. Known examples are:- Dbus: for example if
DBUS_SESSION_BUS_ADDRESSstarts withunix:abstract= - Xorg: X Window System, the thing you configure with
DISPLAY - nscd: name service cache daemon (this thing may resolve DNS names even if TCP/IP network is absent for your container)
- systemd-resolved: listens at
127.0.0.53:53as well as on dbus
- Dbus: for example if