feat: allow setting shm-size on created containers
Refs dokku/dokku-postgres#188 Closes dokku/dokku-postgres#201
This commit is contained in:
@@ -72,6 +72,7 @@ flags:
|
|||||||
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
||||||
- `-p|--password PASSWORD`: override the user-level service password
|
- `-p|--password PASSWORD`: override the user-level service password
|
||||||
- `-r|--root-password PASSWORD`: override the root-level service password
|
- `-r|--root-password PASSWORD`: override the root-level service password
|
||||||
|
- `-s|--shm-size SHM_SIZE`: override shared memory size for mysql docker container
|
||||||
|
|
||||||
Create a mysql service named lolipop:
|
Create a mysql service named lolipop:
|
||||||
|
|
||||||
@@ -392,6 +393,7 @@ flags:
|
|||||||
- `-i|--image IMAGE`: the image name to start the service with
|
- `-i|--image IMAGE`: the image name to start the service with
|
||||||
- `-I|--image-version IMAGE_VERSION`: the image version to start the service with
|
- `-I|--image-version IMAGE_VERSION`: the image version to start the service with
|
||||||
- `-R|--restart-apps "true"`: whether to force an app restart
|
- `-R|--restart-apps "true"`: whether to force an app restart
|
||||||
|
- `-s|--shm-size SHM_SIZE`: override shared memory size for mysql docker container
|
||||||
|
|
||||||
You can upgrade an existing service to a new image or image-version:
|
You can upgrade an existing service to a new image or image-version:
|
||||||
|
|
||||||
@@ -432,6 +434,7 @@ flags:
|
|||||||
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
- `-m|--memory MEMORY`: container memory limit (default: unlimited)
|
||||||
- `-p|--password PASSWORD`: override the user-level service password
|
- `-p|--password PASSWORD`: override the user-level service password
|
||||||
- `-r|--root-password PASSWORD`: override the root-level service password
|
- `-r|--root-password PASSWORD`: override the root-level service password
|
||||||
|
- `-s|--shm-size SHM_SIZE`: override shared memory size for mysql docker container
|
||||||
|
|
||||||
You can clone an existing service to a new one:
|
You can clone an existing service to a new one:
|
||||||
|
|
||||||
|
|||||||
@@ -247,6 +247,10 @@ service_commit_config() {
|
|||||||
if [[ -n "$SERVICE_MEMORY" ]]; then
|
if [[ -n "$SERVICE_MEMORY" ]]; then
|
||||||
echo "$SERVICE_MEMORY" >"$SERVICE_ROOT/SERVICE_MEMORY"
|
echo "$SERVICE_MEMORY" >"$SERVICE_ROOT/SERVICE_MEMORY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$SERVICE_SHM_SIZE" ]]; then
|
||||||
|
echo "$SERVICE_SHM_SIZE" >"$SERVICE_ROOT/SHM_SIZE"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
service_backup_auth() {
|
service_backup_auth() {
|
||||||
@@ -578,13 +582,14 @@ service_parse_args() {
|
|||||||
"--querystring") set -- "$@" "-q" ;;
|
"--querystring") set -- "$@" "-q" ;;
|
||||||
"--restart-apps") set -- "$@" "-R" ;;
|
"--restart-apps") set -- "$@" "-R" ;;
|
||||||
"--root-password") set -- "$@" "-r" ;;
|
"--root-password") set -- "$@" "-r" ;;
|
||||||
|
"--shm-size") set -- "$@" "-s" ;;
|
||||||
"--user") set -- "$@" "-u" ;;
|
"--user") set -- "$@" "-u" ;;
|
||||||
*) set -- "$@" "$arg" ;;
|
*) set -- "$@" "$arg" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
while getopts "a:c:C:d:i:I:m:p:q:R:r:u:" opt; do
|
while getopts "a:c:C:d:i:I:m:p:q:R:r:s:u:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
a)
|
a)
|
||||||
SERVICE_ALIAS="${OPTARG^^}"
|
SERVICE_ALIAS="${OPTARG^^}"
|
||||||
@@ -620,6 +625,9 @@ service_parse_args() {
|
|||||||
r)
|
r)
|
||||||
export SERVICE_ROOT_PASSWORD=$OPTARG
|
export SERVICE_ROOT_PASSWORD=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
s)
|
||||||
|
export SERVICE_SHM_SIZE=$OPTARG
|
||||||
|
;;
|
||||||
u)
|
u)
|
||||||
export SERVICE_USER=$OPTARG
|
export SERVICE_USER=$OPTARG
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -89,8 +89,13 @@ service_create_container() {
|
|||||||
MEMORY_LIMIT="--memory=${SERVICE_MEMORY}m"
|
MEMORY_LIMIT="--memory=${SERVICE_MEMORY}m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[[ -f "$SERVICE_ROOT/SHM_SIZE" ]] && SERVICE_SHM_SIZE="$(cat "$SERVICE_ROOT/SHM_SIZE")"
|
||||||
|
if [[ -n "$SERVICE_SHM_SIZE" ]]; then
|
||||||
|
SHM_SIZE="--shm-size=${SERVICE_SHM_SIZE}"
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
ID=$(docker run --name "$SERVICE_NAME" $MEMORY_LIMIT -v "$SERVICE_HOST_ROOT/data:/var/lib/mysql" -v "$SERVICE_HOST_ROOT/$PLUGIN_CONFIG_SUFFIX:/etc/mysql/conf.d" -e "MYSQL_ROOT_PASSWORD=$ROOTPASSWORD" -e MYSQL_USER=mysql -e "MYSQL_PASSWORD=$PASSWORD" -e "MYSQL_DATABASE=$DATABASE_NAME" --env-file="$SERVICE_ROOT/ENV" -d --restart always --label dokku=service --label dokku.service=mysql "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" $CONFIG_OPTIONS)
|
ID=$(docker run --name "$SERVICE_NAME" $MEMORY_LIMIT $SHM_SIZE -v "$SERVICE_HOST_ROOT/data:/var/lib/mysql" -v "$SERVICE_HOST_ROOT/$PLUGIN_CONFIG_SUFFIX:/etc/mysql/conf.d" -e "MYSQL_ROOT_PASSWORD=$ROOTPASSWORD" -e MYSQL_USER=mysql -e "MYSQL_PASSWORD=$PASSWORD" -e "MYSQL_DATABASE=$DATABASE_NAME" --env-file="$SERVICE_ROOT/ENV" -d --restart always --label dokku=service --label dokku.service=mysql "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" $CONFIG_OPTIONS)
|
||||||
echo "$ID" >"$SERVICE_ROOT/ID"
|
echo "$ID" >"$SERVICE_ROOT/ID"
|
||||||
|
|
||||||
dokku_log_verbose_quiet "Waiting for container to be ready"
|
dokku_log_verbose_quiet "Waiting for container to be ready"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ service-clone-cmd() {
|
|||||||
#F -m|--memory MEMORY, container memory limit (default: unlimited)
|
#F -m|--memory MEMORY, container memory limit (default: unlimited)
|
||||||
#F -p|--password PASSWORD, override the user-level service password
|
#F -p|--password PASSWORD, override the user-level service password
|
||||||
#F -r|--root-password PASSWORD, override the root-level service password
|
#F -r|--root-password PASSWORD, override the root-level service password
|
||||||
|
#F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container
|
||||||
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
declare desc="create container <new-name> then copy data from <name> into <new-name>"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@")
|
local cmd="$PLUGIN_COMMAND_PREFIX:clone" argv=("$@")
|
||||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ service-create-cmd() {
|
|||||||
#F -m|--memory MEMORY, container memory limit (default: unlimited)
|
#F -m|--memory MEMORY, container memory limit (default: unlimited)
|
||||||
#F -p|--password PASSWORD, override the user-level service password
|
#F -p|--password PASSWORD, override the user-level service password
|
||||||
#F -r|--root-password PASSWORD, override the root-level service password
|
#F -r|--root-password PASSWORD, override the root-level service password
|
||||||
|
#F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container
|
||||||
declare desc="create a $PLUGIN_SERVICE service"
|
declare desc="create a $PLUGIN_SERVICE service"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@")
|
local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@")
|
||||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ service-upgrade-cmd() {
|
|||||||
#F -i|--image IMAGE, the image name to start the service with
|
#F -i|--image IMAGE, the image name to start the service with
|
||||||
#F -I|--image-version IMAGE_VERSION, the image version to start the service with
|
#F -I|--image-version IMAGE_VERSION, the image version to start the service with
|
||||||
#F -R|--restart-apps "true", whether to force an app restart
|
#F -R|--restart-apps "true", whether to force an app restart
|
||||||
|
#F -s|--shm-size SHM_SIZE, override shared memory size for $PLUGIN_COMMAND_PREFIX docker container
|
||||||
declare desc="upgrade service <service> to the specified versions"
|
declare desc="upgrade service <service> to the specified versions"
|
||||||
local cmd="$PLUGIN_COMMAND_PREFIX:upgrade" argv=("$@")
|
local cmd="$PLUGIN_COMMAND_PREFIX:upgrade" argv=("$@")
|
||||||
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
[[ ${argv[0]} == "$cmd" ]] && shift 1
|
||||||
|
|||||||
Reference in New Issue
Block a user