Commit graph

78 commits

Author SHA1 Message Date
Kim Alvefur
0581c684a5 ng: Fix bug that would create a VirtualHost""
Seems * in patterns behave differently before Lua 5.3

Thanks to tarneo for reporting this issue
2023-12-02 17:54:53 +01:00
Kim Alvefur
aa886a0b49 ng: Add FIXME wrt failure to start if data directory owned by root 2023-03-21 18:34:20 +01:00
Kim Alvefur
1c79b49c74 ng: Install Lua C headers as workaround for luarocks/luarocks#1275 2023-03-21 18:33:20 +01:00
Kim Alvefur
bfa98dcb30 ng: Apply previous two changes to 0.12 config as well 2023-02-24 14:21:49 +01:00
Kim Alvefur
2a8ec06934 ng: Allow specifying statistics interval
Recommended for Prometheus / OpenMetrics which will probably be the
primary use. In fact, why not just enable and hardcode
mod_http_openmetrics?
2023-01-14 00:28:27 +01:00
Kim Alvefur
84a6c25e5d ng: Set selected interpreter as default in shell
Otherwise it's just going to somehow install Lua 5.1 and then use that
because why not?
2023-01-14 00:25:28 +01:00
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