mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
build(docker): the image is Ubuntu 26.04 with supervisord in place of phusion's runit
phusion/baseimage brought sshd, syslog-ng, my_init and runit's per service scripts, and an nginx log forwarder tailing a file. The image is now ubuntu:26.04 with Ubuntu's supervisor: conf/docker holds the start script (settings, secret key, ownership, migrations as www-data), one supervisord.conf for the six processes, nginx's config with errors to docker logs, the backup's cron line and the health check. A stop signals every process at once, so the worker keeps its 60 s drain within the 95 s grace. The same volumes and container name work as before; README runs commands with exec -u www-data in place of /sbin/setuser. The image goes from 805 MB to 642 MB.
This commit is contained in:
parent
a76f42aa5a
commit
1fd5fe0d42
21 changed files with 218 additions and 203 deletions
|
|
@ -12,14 +12,13 @@ BASE = Path(settings.BASE_DIR)
|
|||
|
||||
class WorkerInstallTestCase(SimpleTestCase):
|
||||
def test_docker(self):
|
||||
dockerfile = (BASE / "Dockerfile").read_text()
|
||||
self.assertIn("conf/runit/webvirtcloud-worker.sh", dockerfile)
|
||||
self.assertIn("/etc/service/webvirtcloud-worker/run", dockerfile)
|
||||
script = (BASE / "conf/runit/webvirtcloud-worker.sh").read_text()
|
||||
for text in ("/sbin/setuser www-data", "manage.py run_worker",
|
||||
"WEBVIRTCLOUD_LOG_FILE=/srv/webvirtcloud/data/webvirtcloud-worker.log"):
|
||||
self.assertIn(text, script)
|
||||
self.assertIn("ENV KILL_PROCESS_TIMEOUT=80", dockerfile)
|
||||
conf = (BASE / "conf/docker/supervisord.conf").read_text()
|
||||
worker = conf[conf.index("[program:worker]"):].split("\n\n")[0]
|
||||
for text in ("user=www-data", "manage.py run_worker",
|
||||
'WEBVIRTCLOUD_LOG_FILE="/srv/webvirtcloud/data/webvirtcloud-worker.log"', "stopwaitsecs=80"):
|
||||
self.assertIn(text, worker)
|
||||
# a stop signals every program at once: the worker's drain is not behind the others' stops
|
||||
self.assertRegex(conf, r"programs=.*\bworker\b")
|
||||
compose = (BASE / "docker-compose.yml").read_text()
|
||||
self.assertRegex(compose, r"stop_grace_period:\s*9\ds")
|
||||
# the worker's host identity lives in the data volume, not in a fixed hostname
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue