bring in line with github.com/container-images
- use baseruntime:latest as base image - reimplement cgroup-limits in shell - take real memory size into account for configuration - don't use nss_wrapper.so - don't reference separate shared-userspace repo - fix usage label - get rid of /var/lib/psql <-> .../data distinction - drop a few unused files from root/
This commit is contained in:
parent
058779a5d5
commit
1ae18a54f9
7 changed files with 185 additions and 332 deletions
|
|
@ -6,14 +6,19 @@ export POSTGRESQL_MAX_PREPARED_TRANSACTIONS=${POSTGRESQL_MAX_PREPARED_TRANSACTIO
|
|||
# limits are set).
|
||||
# Users can still override this by setting the POSTGRESQL_SHARED_BUFFERS
|
||||
# and POSTGRESQL_EFFECTIVE_CACHE_SIZE variables.
|
||||
if [[ "${NO_MEMORY_LIMIT:-}" == "true" || -z "${MEMORY_LIMIT_IN_BYTES:-}" ]]; then
|
||||
if [[ "${NO_MEMORY_LIMIT:-}" == "true" || -z "${MEMORY_LIMIT_IN_BYTES:-}" || -z "${RAM_SIZE_IN_BYTES:-}" ]]; then
|
||||
export POSTGRESQL_SHARED_BUFFERS=${POSTGRESQL_SHARED_BUFFERS:-32MB}
|
||||
export POSTGRESQL_EFFECTIVE_CACHE_SIZE=${POSTGRESQL_EFFECTIVE_CACHE_SIZE:-128MB}
|
||||
else
|
||||
if [ "$MEMORY_LIMIT_IN_BYTES" -gt "$RAM_SIZE_IN_BYTES" ]; then
|
||||
mem_limit="$RAM_SIZE_IN_BYTES"
|
||||
else
|
||||
mem_limit="$MEMORY_LIMIT_IN_BYTES"
|
||||
fi
|
||||
# Use 1/4 of given memory for shared buffers
|
||||
shared_buffers_computed="$(($MEMORY_LIMIT_IN_BYTES/1024/1024/4))MB"
|
||||
shared_buffers_computed="$(($mem_limit/1024/1024/4))MB"
|
||||
# Setting effective_cache_size to 1/2 of total memory would be a normal conservative setting,
|
||||
effective_cache="$(($MEMORY_LIMIT_IN_BYTES/1024/1024/2))MB"
|
||||
effective_cache="$(($mem_limit/1024/1024/2))MB"
|
||||
export POSTGRESQL_SHARED_BUFFERS=${POSTGRESQL_SHARED_BUFFERS:-$shared_buffers_computed}
|
||||
export POSTGRESQL_EFFECTIVE_CACHE_SIZE=${POSTGRESQL_EFFECTIVE_CACHE_SIZE:-$effective_cache}
|
||||
fi
|
||||
|
|
@ -126,7 +131,7 @@ function generate_passwd_file() {
|
|||
export GROUP_ID=$(id -g)
|
||||
grep -v ^postgres /etc/passwd > "$HOME/passwd"
|
||||
echo "postgres:x:${USER_ID}:${GROUP_ID}:PostgreSQL Server:${HOME}:/bin/bash" >> "$HOME/passwd"
|
||||
export LD_PRELOAD=libnss_wrapper.so
|
||||
#export LD_PRELOAD=libnss_wrapper.so
|
||||
export NSS_WRAPPER_PASSWD=${HOME}/passwd
|
||||
export NSS_WRAPPER_GROUP=/etc/group
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# This will make scl collection binaries work out of box.
|
||||
unset BASH_ENV PROMPT_COMMAND ENV
|
||||
source scl_source enable $ENABLED_COLLECTIONS
|
||||
Loading…
Add table
Add a link
Reference in a new issue