Note that we cannot simply ignore EPIPE in the node programs.
Doing so results in no logs anymore :-( This is supposedly
fixed in systemd 228.
Fixes#550
On Unix, child processes are not killed when parent dies.
Each process is part of a process group (pgid). When pgid == pid,
it is the process group leader.
node creates child processes with the parent as the group leader
(detached = false).
You can send a signal to entire group using kill(-pgid), as in,
negative value in argument. Systemd can be made to do this by
setting the KillMode=control-group.
Unrelated: Process groups reside inside session groups. Each session
group has a controlling terminal. Only one process in the session
group has access to the terminal. Process group is basically like
a bash pipeline. A session group is the entire login session with only
one process having terminal access at a time.
Fixes#543
Normally, logrotate is run as a daily cron job. It will not modify a log
multiple times in one day unless the criterion for that log is based on
the log's size and logrotate is being run multiple times each day, or
unless the -f or --force option is used.
This cleans up tmp and logrotates /var/log every 12 hours.
Note that this janitor is separate from the box janitor because they
run as different users.
Fixes#503
Docker generates an apparmor profile on the fly under /etc/apparmor.d/docker.
This profile gets overwritten on every docker daemon start.
This profile allows processes to ptrace themselves. This is required by
circus (python process manager) for reasons unknown to me. It floods the logs
with
audit[7623]: <audit-1400> apparmor="DENIED" operation="ptrace" profile="docker-default" pid=7623 comm="python3.4" requested_mask="trace" denied_mask="trace" peer="docker-default"
This is easily tested using:
docker run -it cloudron/base:0.3.3 /bin/bash
a) now do ps
b) journalctl should show error log as above
docker run --security-opt=apparmor:docker-cloudron-app -it cloudron/base:0.3.3 /bin/bash
a) now do ps
b) no error!
Note that despite this, the process may not have ability to ptrace since it does not
have CAP_PTRACE. Also, security-opt is the profile name (inside the apparmor config file)
and not the filename.
References:
https://groups.google.com/forum/#!topic/docker-user/xvxpaceTCywhttps://github.com/docker/docker/issues/7276https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1320869
This is an infra update because we need to recreate containers to get the right profile.
Fixes#492
We used to run this as a separate process but no amount of node/v8 tweaking
makes them run as standalone with 50M RSS.
Three solutions were considered for the memory issue:
1. Use systemd timer. apphealthtask needs to run quiet frequently (10 sec)
for the ui to get the app health update immediately after install.
2. Merge into box server (this commit)
3. Increase memory to 80M. This seems to make apphealthtask run as-is.