Skip to content

Commit

Permalink
Bugfix/modify docker oneclick (#385)
Browse files Browse the repository at this point in the history
* Modify docker oneclick

* Add a variable with a branch selection

* Minor correction
  • Loading branch information
evgeniy-antonyuk authored Oct 11, 2021
1 parent b1714de commit 73403bc
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 22 deletions.
11 changes: 10 additions & 1 deletion build/install/OneClickInstall/appserver-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ DOCKER="";
LOCAL_SCRIPTS="false"
HELP="false";
product="appserver"
GIT_BRANCH="develop"

while [ "$1" != "" ]; do
case $1 in
Expand All @@ -46,6 +47,14 @@ while [ "$1" != "" ]; do
shift
fi
;;

-gb | --gitbranch )
if [ "$2" != "" ]; then
PARAMETERS="$PARAMETERS ${1}";
GIT_BRANCH=$2
shift
fi
;;

"-?" | -h | --help )
HELP="true";
Expand Down Expand Up @@ -119,7 +128,7 @@ if [ "$HELP" == "false" ]; then
fi

#DOWNLOAD_URL_PREFIX="http://download.onlyoffice.com/install-appserver/"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/develop/build/install/OneClickInstall"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/${GIT_BRANCH}/build/install/OneClickInstall"

if [ "$DOCKER" == "true" ]; then
if [ "$LOCAL_SCRIPTS" == "true" ]; then
Expand Down
11 changes: 10 additions & 1 deletion build/install/OneClickInstall/install-Debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
package_sysname="onlyoffice";
DS_COMMON_NAME="onlyoffice";
product="appserver"
GIT_BRANCH="develop"
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
Expand All @@ -20,6 +21,14 @@ while [ "$1" != "" ]; do
shift
fi
;;

-gb | --gitbranch )
if [ "$2" != "" ]; then
PARAMETERS="$PARAMETERS ${1}";
GIT_BRANCH=$2
shift
fi
;;

-ls | --localscripts )
if [ "$2" != "" ]; then
Expand Down Expand Up @@ -56,7 +65,7 @@ if [ $(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed") -
apt-get install -yq curl;
fi

DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/develop/build/install/OneClickInstall/install-Debian"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/${GIT_BRANCH}/build/install/OneClickInstall/install-Debian"
if [ "${LOCAL_SCRIPTS}" == "true" ]; then
source install-Debian/bootstrap.sh
else
Expand Down
64 changes: 46 additions & 18 deletions build/install/OneClickInstall/install-Docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
# terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
#

PRODUCT="onlyoffice"
BASE_DIR="/app/$PRODUCT";
PACKAGE_SYSNAME="onlyoffice"
PRODUCT="appserver"
BASE_DIR="/app/$PACKAGE_SYSNAME";
STATUS=""
SRV_VERSION=""
DOCKER_TAG=""
GIT_BRANCH="develop"

NETWORK=${PRODUCT}
NETWORK=${PACKAGE_SYSNAME}

DISK_REQUIREMENTS=40960;
MEMORY_REQUIREMENTS=5500;
Expand All @@ -46,6 +48,7 @@ DIST="";
REV="";
KERNEL="";

INSTALL_KAFKA="true";
INSTALL_MYSQL_SERVER="true";
INSTALL_DOCUMENT_SERVER="true";
INSTALL_APPSERVER="true";
Expand Down Expand Up @@ -131,6 +134,13 @@ while [ "$1" != "" ]; do
INSTALL_MYSQL_SERVER=$2
shift
fi
;;

-ikafka | --installkafka )
if [ "$2" != "" ]; then
INSTALL_KAFKA=$2
shift
fi
;;

-ht | --helptarget )
Expand Down Expand Up @@ -258,9 +268,17 @@ while [ "$1" != "" ]; do
fi
;;

-vas | --versionappserver )
-tag | --dockertag )
if [ "$2" != "" ]; then
DOCKER_TAG=$2
shift
fi
;;

-gb | --gitbranch )
if [ "$2" != "" ]; then
SRV_VERSION=$2
PARAMETERS="$PARAMETERS ${1}";
GIT_BRANCH=$2
shift
fi
;;
Expand All @@ -275,7 +293,8 @@ while [ "$1" != "" ]; do
echo " -ias, --installappserver install or update appserver (true|false)"
echo " -vas, --versionappserver select the version to install appserver (latest|develop|version number)"
echo " -ids, --installdocumentserver install or update document server (true|false)"
echo " -imysql, --installmysql install or update mysql (true|false)"
echo " -imysql, --installmysql install or update mysql (true|false)"
echo " -ikafka, --installkafka install or update kafka (true|false)"
echo " -mysqlrp, --mysqlrootpassword mysql server root password"
echo " -mysqld, --mysqldatabase appserver database name"
echo " -mysqlu, --mysqluser appserver database user"
Expand Down Expand Up @@ -708,15 +727,15 @@ set_jwt_secret () {
CURRENT_JWT_SECRET="";

if [[ -z ${JWT_SECRET} ]]; then
CURRENT_JWT_SECRET=$(get_container_env_parameter "${PRODUCT}-document-server" "JWT_SECRET");
CURRENT_JWT_SECRET=$(get_container_env_parameter "${PACKAGE_SYSNAME}-document-server" "JWT_SECRET");

if [[ -n ${CURRENT_JWT_SECRET} ]]; then
DOCUMENT_SERVER_JWT_SECRET="$CURRENT_JWT_SECRET";
fi
fi

if [[ -z ${JWT_SECRET} ]]; then
CURRENT_JWT_SECRET=$(get_container_env_parameter "${PRODUCT}-api" "DOCUMENT_SERVER_JWT_SECRET");
CURRENT_JWT_SECRET=$(get_container_env_parameter "${PACKAGE_SYSNAME}-api" "DOCUMENT_SERVER_JWT_SECRET");

if [[ -n ${CURRENT_JWT_SECRET} ]]; then
DOCUMENT_SERVER_JWT_SECRET="$CURRENT_JWT_SECRET";
Expand All @@ -742,7 +761,7 @@ set_core_machinekey () {
fi

if [[ -z ${CORE_MACHINEKEY} ]]; then
CURRENT_CORE_MACHINEKEY=$(get_container_env_parameter "${PRODUCT}-api" "$APP_CORE_MACHINEKEY");
CURRENT_CORE_MACHINEKEY=$(get_container_env_parameter "${PACKAGE_SYSNAME}-api" "$APP_CORE_MACHINEKEY");

if [[ -n ${CURRENT_CORE_MACHINEKEY} ]]; then
APP_CORE_MACHINEKEY="$CURRENT_CORE_MACHINEKEY";
Expand All @@ -764,11 +783,12 @@ download_files () {
install_service wget
fi

DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/AppServer/develop/build/install/docker"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${PRODUCT}/${GIT_BRANCH}/build/install/docker"
wget -q -O $BASE_DIR/.env "${DOWNLOAD_URL_PREFIX}/.env"
wget -q -O $BASE_DIR/appserver.yml "${DOWNLOAD_URL_PREFIX}/appserver.yml"
wget -q -O $BASE_DIR/db.yml "${DOWNLOAD_URL_PREFIX}/db.yml"
wget -q -O $BASE_DIR/ds.yml "${DOWNLOAD_URL_PREFIX}/ds.yml"
wget -q -O $BASE_DIR/kafka.yml "${DOWNLOAD_URL_PREFIX}/kafka.yml"
wget -q -O $BASE_DIR/appserver.yml "${DOWNLOAD_URL_PREFIX}/appserver.yml"
wget -q -O $BASE_DIR/config/createdb.sql "${DOWNLOAD_URL_PREFIX}/config/createdb.sql"
wget -q -O $BASE_DIR/config/onlyoffice.sql "${DOWNLOAD_URL_PREFIX}/config/onlyoffice.sql"
wget -q -O $BASE_DIR/config/onlyoffice.data.sql "${DOWNLOAD_URL_PREFIX}/config/onlyoffice.data.sql"
Expand Down Expand Up @@ -825,19 +845,23 @@ install_document_server () {
docker-compose -f $BASE_DIR/ds.yml up -d
}

install_kafka () {
reconfigure ZOO_PORT ${ZOO_PORT}
reconfigure ZOO_HOST ${ZOO_HOST}
reconfigure KAFKA_HOST ${KAFKA_HOST}

docker-compose -f $BASE_DIR/kafka.yml up -d
}

install_appserver () {
if ! command_exists docker-compose; then
install_docker_compose
fi

reconfigure ZOO_PORT ${ZOO_PORT}
reconfigure ZOO_HOST ${ZOO_HOST}
reconfigure KAFKA_HOST ${KAFKA_HOST}
reconfigure ELK_HOST ${ELK_HOST}
reconfigure SERVICE_PORT ${SERVICE_PORT}
reconfigure APP_CORE_MACHINEKEY ${APP_CORE_MACHINEKEY}
reconfigure APP_CORE_BASE_DOMAIN ${APP_CORE_BASE_DOMAIN}
reconfigure SRV_VERSION ${SRV_VERSION}
reconfigure DOCKER_TAG ${DOCKER_TAG}

if [[ -n $EXTERNAL_PORT ]]; then
sed -i "s/8092:8092/${EXTERNAL_PORT}:8092/g" $BASE_DIR/appserver.yml
Expand Down Expand Up @@ -886,12 +910,16 @@ start_installation () {
install_document_server
fi

if [ "$INSTALL_KAFKA" == "true" ]; then
install_kafka
fi

if [ "$INSTALL_APPSERVER" == "true" ]; then
install_appserver
fi

echo ""
echo "Thank you for installing ONLYOFFICE Appserver."
echo "Thank you for installing ONLYOFFICE ${PRODUCT^^}."
echo "In case you have any questions contact us via http://support.onlyoffice.com or visit our forum at http://dev.onlyoffice.org"
echo ""

Expand Down
12 changes: 10 additions & 2 deletions build/install/OneClickInstall/install-RedHat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
package_manager="yum"
package_sysname="onlyoffice";
product="appserver"

GIT_BRANCH="develop"
package_services="";
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
Expand All @@ -32,6 +32,14 @@ while [ "$1" != "" ]; do
fi
;;

-gb | --gitbranch )
if [ "$2" != "" ]; then
PARAMETERS="$PARAMETERS ${1}";
GIT_BRANCH=$2
shift
fi
;;

-ls | --localscripts )
if [ "$2" != "" ]; then
LOCAL_SCRIPTS=$2
Expand Down Expand Up @@ -80,7 +88,7 @@ gpgkey=http://static.teamlab.info.s3.amazonaws.com/k8s
END

#DOWNLOAD_URL_PREFIX="https://download.onlyoffice.com/install-appserver/install-RedHat"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/develop/build/install/OneClickInstall/install-RedHat"
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/${GIT_BRANCH}/build/install/OneClickInstall/install-RedHat"

if [ "$LOCAL_SCRIPTS" = "true" ]; then
source install-RedHat/bootstrap.sh
Expand Down

0 comments on commit 73403bc

Please sign in to comment.