New step to upgrade only office installation

This commit is contained in:
2020-01-01 23:29:18 +01:00
parent 2688d60f6d
commit 99375dd4f3
2 changed files with 46 additions and 10 deletions

View File

@@ -4,3 +4,4 @@ onlyOfficePort="80"
dockerDns1="80.241.218.68" # https://dismail.de/info.html#dns dockerDns1="80.241.218.68" # https://dismail.de/info.html#dns
dockerDns2="46.182.19.48" # https://digitalcourage.de/support/zensurfreier-dns-server dockerDns2="46.182.19.48" # https://digitalcourage.de/support/zensurfreier-dns-server
dockerDefaultConf="/etc/default/docker" dockerDefaultConf="/etc/default/docker"
dockerImageName="onlyoffice/documentserver"

View File

@@ -34,7 +34,7 @@ step_config() {
fi fi
} }
step_1_info() { echo "Install docker dependencies"; } step_1_info() { echo "Install Docker dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { ALIAS="install"; }
step_1() { step_1() {
local aptOption= local aptOption=
@@ -48,7 +48,7 @@ step_1() {
endReturn -o $? "Docker dependencies installation failed" endReturn -o $? "Docker dependencies installation failed"
} }
step_2_info() { echo "Install docker repository"; } step_2_info() { echo "Install Docker repository"; }
step_2() { step_2() {
# Add official docker GPG key # Add official docker GPG key
exep "curl -fsSL ${dockerGpgKeyUrl} | sudo apt-key add -" exep "curl -fsSL ${dockerGpgKeyUrl} | sudo apt-key add -"
@@ -60,7 +60,7 @@ step_2() {
endReturn -o $? "Docker repository not available" endReturn -o $? "Docker repository not available"
} }
step_3_info() { echo "Install latest docker version"; } step_3_info() { echo "Install latest Docker version"; }
step_3() { step_3() {
# Install the latest version # Install the latest version
if [ $QUIET -ne 0 ] ; then if [ $QUIET -ne 0 ] ; then
@@ -83,20 +83,51 @@ step_4() {
fi fi
} }
step_5_info() { echo "Install/start onlyoffice docker container <SECRET>"; } step_5_info() {
echo "Install/start onlyoffice docker container <SECRET>."
echoinfo "If <SECRET> is empty, user input will be available if not run --quiet."
echoinfo "$toolName will be run unsecured if no secret was provied."
}
step_5_alias() { ALIAS="startoo"; } step_5_alias() { ALIAS="startoo"; }
step_5() { step_5() {
local options= local options=
local secret=
if [ ! -z "$2" ] ; then
secret="$2"
elif [ $QUIET -eq 0 ] ; then
exe read -s -p "JWT Secret: " secret
fi
# The correct expansion for missing SECRET or SECRET with spaces is not possible. # The correct expansion for missing SECRET or SECRET with spaces is not possible.
# Therefore docker without secret needs to be called separately # Therefore docker without secret needs to be called separately
if [ ! -z "$2" ] && [ "$2" != "" ] ; then if [ ! -z "$secret" ] ; then
options="-e JWT_ENABLED=true -e JWT_SECRET=" options="-e JWT_ENABLED=true -e JWT_SECRET="
# This is the only way to provide SECRET($2) to docker command line which handles all types of characters. # This is the only way to provide SECRET($2) to docker command line which handles all types of characters.
exe docker run -i -t -d -p ${onlyOfficePort}:80 ${options}"$2" --restart=always onlyoffice/documentserver exe docker run -i -t -d -p ${onlyOfficePort}:80 ${options}"$secret" --restart=always onlyoffice/documentserver
else else
echo " [I] Running $toolName without JWT (JSON Web Tokens)" echoerr " [W] Running $toolName without JWT (JSON Web Tokens)"
exe docker run -i -t -d -p ${onlyOfficePort}:80 --restart=always onlyoffice/documentserver exe docker run -i -t -d -p ${onlyOfficePort}:80 --restart=always onlyoffice/documentserver
fi fi
unset secret
}
step_7_info() { echo "Upgrade $toolName to latest version"; }
step_7_alias() { ALIAS="upgrade"; }
step_7() {
# get container ID
local containerId=$(docker ps -aqf ancestor="$dockerImageName")
if [ ! -z $containerId ] ; then
exe docker stop $containerId
exe docker rm $containerId
else
echoerr " [W] No $toolName Docker container found"
fi
exe docker pull $dockerImageName
endReturn -o $? "Error getting $toolName Docker update"
step startoo
} }
step_10_info() { echo "List running Docker container"; } step_10_info() { echo "List running Docker container"; }
@@ -109,14 +140,18 @@ step_10() {
echo " e.g.: docker stop 70f1c5c81be2" echo " e.g.: docker stop 70f1c5c81be2"
} }
step_12_info() { echo "Clean unused Docker data (unused containers, dangling images, networks and build cache)"; } step_12_info() {
echo "Clean unused Docker data"
echoinfo "(unused containers, dangling images, networks, build cache and volumes)"
}
step_12_alias() { ALIAS="prune"; } step_12_alias() { ALIAS="prune"; }
step_12() { step_12() {
exe docker system df exe docker system df
exe docker system prune exe docker system prune
exe docker volume prune
} }
step_100_info() { echo "Uninstall docker"; } step_100_info() { echo "Uninstall Docker"; }
step_100_alias() { ALIAS="uninstall"; } step_100_alias() { ALIAS="uninstall"; }
step_100() { step_100() {
exe apt-get purge docker-ce exe apt-get purge docker-ce