mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
set max connections and max php children based on available hardware
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
b307c39f70
commit
5804f68824
4 changed files with 18 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# From https://github.com/docker-library/postgres/blob/master/13/alpine/Dockerfile
|
||||
FROM postgres:14.5-alpine
|
||||
|
||||
RUN apk add --update --no-cache bash openssl shadow netcat-openbsd grep
|
||||
RUN apk add --update --no-cache bash openssl shadow netcat-openbsd grep mawk
|
||||
|
||||
# We need to use the same gid and uid as on old installations
|
||||
RUN set -ex; \
|
||||
|
|
|
|||
|
|
@ -110,6 +110,11 @@ if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then
|
|||
rm -rf "${DATADIR:?}/"*
|
||||
fi
|
||||
|
||||
echo "Setting max connections..."
|
||||
MEMORY=$(mawk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
|
||||
MAX_CONNECTIONS=$((MEMORY/50+3))
|
||||
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
|
||||
|
||||
# Catch docker stop attempts
|
||||
trap 'true' SIGINT SIGTERM
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue