Mercurial > sat_docs
view docker/prosody/scripts/container_server @ 116:d0a5db5b9bdf
docker: fixed bad stopping:
- use exec when it was missing, so the TERM signal is properly catched, and containers can be stopped instead of being killed after 10s
- for a unknown reason, exec and su don't handle correctly "$@" with Docker in base.scripts/sat. It's working as expected when launched from withing a running container, but not when launched with "docker run", so a workaround is used with trap and wait
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 04 Mar 2016 23:31:26 +0100 |
parents | 14b29b9e06bb |
children |
line wrap: on
line source
#!/usr/bin/env python2 # this script allow to call prosodyctl and get configuration variables from linked containers import subprocess, SimpleXMLRPCServer, os def prosodyctl(command, profile, pwd): process = subprocess.Popen(["/usr/bin/prosodyctl", command, profile], stdin=subprocess.PIPE) if pwd: process.communicate("%s\n%s" % (pwd,pwd)) return process.wait() def getenv(variable): assert variable in ("SAT_PUBSUB_SECRET", "SAT_SALUT_SECRET", "DOMAIN") return os.getenv(variable) server = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", 9999)) server.register_function(prosodyctl, "prosodyctl") server.register_function(getenv, "getenv") server.serve_forever()