Commit graph

72 commits

Author SHA1 Message Date
Kim Alvefur
87c60bc5d9 ng: Use console logs
This enables color if output is a terminal
2023-01-14 00:22:19 +01:00
Matthew Wild
d9e98d73cf ng: Ensure all environment variables have 'PROSODY_' prefix for consistency 2022-12-14 15:52:54 +00:00
Matthew Wild
76fa083967 ng: add config for prosody-trunk 2022-12-14 14:46:53 +00:00
Kim Alvefur
2f14fcaf8b ng: Add lua-readline so prosodyctl shell is nicer to use 2022-12-13 18:46:26 +01:00
Matthew Wild
25f7395352 ng: New experimental Dockerfile based on apt-installing prosody 2022-12-10 16:17:35 +00:00
Alexander Dahl
a5e773d9b6 Fix signal handling and allow graceful shutdown
Although cc88073a79 ("Fix signal handling") fixed the signal handling
and signals don't end up in `entrypoint.sh` anymore, there's still no
clean graceful shutdown. The reason is runuser. It runs as PID 1 and
prosody only runs as child process. A SIGTERM sent to runuser lets
runuser forward SIGTERM to the child process. However it does not wait,
but send SIGKILL right after it. (Confirmed by looking at runuser source
code in util-linux.)

The output on `docker stop [prosodycontainer]` is therefore:

    Session terminated, killing shell...mod_posix                                warn       Received SIGTERM
    portmanager                              info   Deactivated service 'c2s'
     ...killed.

The additional messages in between prosody log output come from runuser.
This is obviously no graceful shutdown.

Because prosody fordibs running as uid 0 (root) we have to run it as
unpriviledged user. The docker best practices recommend to use *gosu*
and gosu lists some alternatives.  Instead of installing gosu to the
image, we use *setpriv* from the already installed util-linux now. The
version in Debian buster, on which the prosody image is based currently,
is recent enough to already contain setpriv.

After that, prosody itself runs with PID 1, but as unpriviledged user
now, and the output of `docker stop` looks like this:

    mod_posix                                warn   Received SIGTERM
    portmanager                              info   Deactivated service 'c2s'
    general                                  info   Shutting down...
    general                                  info   Shutdown status: Cleaning up
    general                                  info   Shutdown complete

Link: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
Signed-off-by: Alexander Dahl <post@lespocky.de>
2021-03-27 16:58:09 +01:00
Alexander Dahl
83556a4c5a Revert "Use tini as PID 1 inside the container"
This reverts commit 31d6d84433.

While tini successfully forwards signals, this leads to `runuser`
killing prosody now. The container does terminate in 10 seconds, so
Docker is happy and you could argue that actually fixes #68, but it's no
graceful shutdown. The revert is done because it's easier to apply a
real fix without tini.
2021-03-27 16:58:09 +01:00
Kim Alvefur
52cd642d38 Remove inaccurate comment
It says "from debian" right beneath it!
2021-03-20 12:32:20 +01:00
Jonas Schäfer
31d6d84433 Use tini as PID 1 inside the container
tini [1] is a minimalistic PID 1 process. It correctly handles
the special jobs which PID 1 (or a reaper process in general)
needs to take care of in addition to correctly processing the
relevant signals.

Fixes #68.

   [1]: https://github.com/krallin/tini
2021-03-20 12:30:27 +01:00
selurvedu
d627c29eab Fix minor shellcheck warnings 2021-01-29 17:20:34 +01:00
selurvedu
0555dc16c9 Fix mod_posix error if prosody user ID was altered
This fixes the following mod_posix error:

Couldn't write pidfile at /var/run/prosody/prosody.pid;
/var/run/prosody/prosody.pid: Permission denied
2021-01-29 17:20:34 +01:00
Matthew Wild
3a21cd2c21
Merge pull request #65 from goffi-contrib/signal_fix
Fix signal handling
2020-10-12 06:55:37 +01:00
Jérôme Poisson
cc88073a79 Fix signal handling
This patch add `exec` to replace the shell running the `entrypoint.sh`
script by Prosody executable.

This allows Prosody to catch and handle correctly signals, notably
SIGTERM and SIGINT. Without it, Docker can't stop correctly the
container, resulting in a 10 s delay before it kills it.
2020-10-10 21:20:17 +02:00
Kim Alvefur
4878e32010 Remove our repo
Debian versions of dependencies should be fine now
2020-02-14 00:50:18 +01:00
Kim Alvefur
7a6b4df1a2 README: Update for base image update 2020-02-14 00:47:17 +01:00
Matthew Wild
90963038ee
Merge pull request #62 from prosody/dynamic-uid
Run with same UID as datadir owner
2020-02-13 11:18:06 +00:00
Kim Alvefur
95a9d24b76 Run with same UID as datadir owner
This should fix problems with owner/uid mismatch when an existing
prosody data directory is mounted into the container

Closes #39
2020-02-13 01:10:36 +01:00
Kim Alvefur
47d22ada68 Start prosody with the new flag to force foreground operation 2020-02-13 01:08:16 +01:00
Kim Alvefur
80c6ffc362 Install procps, dependency of recent packages 2020-02-12 19:55:34 +01:00
Kim Alvefur
f2c1afeabe Add libicu needed by trunk nightly builds (fixes #59) 2020-02-12 19:52:19 +01:00
Kim Alvefur
3a47a006bc Switch base image to Debian 10 (closes #61)
OpenSSL version with TLS 1.3 support
2020-02-12 19:32:28 +01:00
Kim Alvefur
e0c2334d2a
Merge pull request #56 from Zash/shellcheck
Quote variables in entrypoint.sh
2019-03-31 18:47:34 +02:00
Kim Alvefur
8c4170e7d9 entrypoint.sh: Quote variables [shellcheck] 2019-03-16 19:19:37 +01:00
Matthew Wild
1fa2fb60ce Ensure prosody package key is world-readable (so apt user can read it) 2019-01-14 12:19:03 +00:00
Matthew Wild
21b5e2d19b Create directory for pidfile (usually created by init script) 2019-01-14 11:43:13 +00:00
Matthew Wild
4de30316aa Add lua5.2 for compatibility with 0.11 packages 2019-01-14 11:42:51 +00:00
Matthew Wild
a60be883e9 Fix README to state new distribution base 2019-01-14 11:31:41 +00:00
Matthew Wild
72bf20f29f Update Dockerfile to Debian stretch 2019-01-14 11:28:19 +00:00
Matthew Wild
933be62950 README: Update to clarify intended usage of this repository 2018-04-26 18:24:58 +01:00
Kim Alvefur
b186acf8ff Remove redundant LuaExpat package 2017-10-20 03:40:34 +02:00
Kim Alvefur
01bbe56547 Explicitly install some base requirements
These are in the Prosody debian package dependencies.
2017-10-20 03:39:45 +02:00
Kim Alvefur
67de3d1ecc Merge pull request #30 from chrw/fix-ca-certificates
Install ca-certificates package to fix s2s SSL errors.
2017-01-23 14:08:34 +01:00
Christian Wolff
df16f5af7e Install ca-certificates package to fix s2s SSL errors. 2016-08-08 12:58:44 +02:00
Matthew Wild
b98fdd49f4 build-docker.sh: Some small improvements for parameter handling 2016-03-11 17:37:41 +00:00
Matthew Wild
c095ddd323 Dockerfile: chmod 755 the entrypoint, so we don't depend on the permissions of the build system, fixes #27 2016-03-11 15:51:35 +00:00
Matthew Wild
6d139045cf Merge pull request #28 from prosody/27-entrypoint.sh
Make `entrypoint.sh` executable
2016-03-09 11:13:37 +00:00
Lloyd Watkin
b31d7c913e Make entrypoint.sh executable
Fixes #27
cc @mwild1
2016-03-09 08:52:23 +00:00
Matthew Wild
d346e0912e Install lua-bitop, fixes #24 2016-02-04 19:24:01 +00:00
Matthew Wild
8bbb02e228 entrypoint.sh: If a command is passed to the image, run prosodyctl instead 2016-02-04 19:19:17 +00:00
Matthew Wild
bed0d8e598 Run as user 'prosody', and run prosody instead of prosodyctl. Also set __FLUSH_LOG environment variable to tell Prosody it needs to flush its logs after writing. Fixes #23 and fixes #25. 2016-02-04 19:17:11 +00:00
Lloyd Watkin
82e59c9091 Merge pull request #19 from SamWhited/patch-1
Remove duplicate lua-zlib install line.
2015-10-26 09:08:37 +00:00
Sam Whited
2b420fa628 Remove duplicate lua-zlib install line. 2015-10-23 13:50:25 -05:00
Lloyd Watkin
9cbebe220d Merge pull request #14 from hudon/patch-1
Update README.md
2015-03-31 09:07:48 +02:00
James Hudon
ef57949ed1 Update README.md 2015-03-30 15:37:43 -07:00
Lloyd Watkin
b0f191cbd3 Merge pull request #13 from dwilson6/log-volume-doc-update
Update log volume documentation with note about permissions
2015-03-23 08:33:06 +00:00
Devin Wilson
f84c37d808 Update log volume documentation with note about permissions 2015-03-20 10:00:41 -06:00
Lloyd Watkin
da004da054 Volume mounting documentation fixes 2015-03-16 14:57:01 +00:00
Lloyd Watkin
7f9f2ca6ab Fix documentation
See #11
2015-03-15 15:48:51 +00:00
Lloyd Watkin
d429b2ca59 Merge pull request #2 from DexterTheDragon/improve_dockerfile
Cleanup the Dockerfile
2015-01-01 21:30:46 +00:00
Lloyd Watkin
8c69d7f200 Merge pull request #4 from lloydwatkin/readme-fix
Fix README.md for running Prosody image
2014-12-20 22:11:06 +00:00