Skip to content

Commit

Permalink
Merge pull request #1595 from ONLYOFFICE/hotfix/1.1.1
Browse files Browse the repository at this point in the history
Hotfix/1.1.1
  • Loading branch information
alexeybannov authored Jul 28, 2023
2 parents 61d088a + ef99b47 commit e4ea5a4
Show file tree
Hide file tree
Showing 63 changed files with 1,365 additions and 1,265 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- build/install/rpm**
- build/install/common**
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
BRANCH_NAME: $(echo ${GITHUB_REF#refs/heads/})
Expand All @@ -27,6 +30,16 @@ jobs:
contents: write

steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Import GPG
uses: crazy-max/ghaction-import-gpg@v5
id: gpg_step
Expand Down Expand Up @@ -88,6 +101,16 @@ jobs:
contents: write

steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Import GPG
uses: crazy-max/ghaction-import-gpg@v5
with:
Expand Down
9 changes: 9 additions & 0 deletions build/install/OneClickInstall/install-Debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DS_COMMON_NAME="onlyoffice";
product="docspace"
GIT_BRANCH="master"
INSTALLATION_TYPE="ENTERPRISE"
MAKESWAP="true"
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
Expand Down Expand Up @@ -72,6 +73,13 @@ while [ "$1" != "" ]; do
shift
fi
;;

-ms | --makeswap )
if [ "$2" != "" ]; then
MAKESWAP=$2
shift
fi
;;

-? | -h | --help )
echo " Usage $0 [PARAMETER] [[PARAMETER], ...]"
Expand All @@ -83,6 +91,7 @@ while [ "$1" != "" ]; do
echo " -js, --jwtsecret defines the secret key to validate the JWT in the request"
echo " -ls, --local_scripts use 'true' to run local scripts (true|false)"
echo " -skiphc, --skiphardwarecheck use to skip hardware check (true|false)"
echo " -ms, --makeswap make swap file (true|false)"
echo " -?, -h, --help this help"
echo
exit 0
Expand Down
4 changes: 4 additions & 0 deletions build/install/OneClickInstall/install-Debian/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ cat<<EOF
EOF

if [ -f /etc/needrestart/needrestart.conf ]; then
sed -e "s_#\$nrconf{restart}_\$nrconf{restart}_" -e "s_\(\$nrconf{restart} =\).*_\1 'a';_" -i /etc/needrestart/needrestart.conf
fi

if ! dpkg -l | grep -q "sudo"; then
apt-get install -yq sudo
fi
Expand Down
4 changes: 4 additions & 0 deletions build/install/OneClickInstall/install-Debian/install-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ elif [ "$UPDATE" = "true" ] && [ "$PRODUCT_INSTALLED" = "true" ]; then
fi
fi

if [ "$MAKESWAP" == "true" ]; then
make_swap
fi

echo ""
echo "$RES_INSTALL_SUCCESS"
echo "$RES_QUESTIONS"
Expand Down
6 changes: 0 additions & 6 deletions build/install/OneClickInstall/install-Debian/install-preq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ if ! dpkg -l | grep -q "software-properties-common"; then
apt-get install -yq software-properties-common
fi

locale-gen en_US.UTF-8
if [ -f /etc/needrestart/needrestart.conf ]; then
sed -e "s_#\$nrconf{restart}_\$nrconf{restart}_" -e "s_\(\$nrconf{restart} =\).*_\1 'a';_" -i /etc/needrestart/needrestart.conf
fi

locale-gen en_US.UTF-8

# add elasticsearch repo
Expand Down Expand Up @@ -78,7 +73,6 @@ if ! dpkg -l | grep -q "mysql-server"; then

#Temporary fix for missing mysql repository for debian bookworm
[ "$DISTRIB_CODENAME" = "bookworm" ] && sed -i "s/$DIST/ubuntu/g; s/$DISTRIB_CODENAME/jammy/g" /etc/apt/sources.list.d/mysql.list
[ "$DISTRIB_CODENAME" = "buster" ] && sed -i "s/$DIST/ubuntu/g; s/$DISTRIB_CODENAME/bionic/g" /etc/apt/sources.list.d/mysql.list

echo mysql-community-server mysql-community-server/root-pass password ${MYSQL_SERVER_PASS} | debconf-set-selections
echo mysql-community-server mysql-community-server/re-root-pass password ${MYSQL_SERVER_PASS} | debconf-set-selections
Expand Down
18 changes: 18 additions & 0 deletions build/install/OneClickInstall/install-Debian/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

set -e

make_swap () {
DISK_REQUIREMENTS=6144; #6Gb free space
MEMORY_REQUIREMENTS=11000; #RAM ~12Gb
SWAPFILE="/${PRODUCT}_swapfile";

AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }');
TOTAL_MEMORY=$(free -m | grep -oP '\d+' | head -n 1);
EXIST=$(swapon -s | awk '{ print $1 }' | { grep -x ${SWAPFILE} || true; });

if [[ -z $EXIST ]] && [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ] && [ ${AVAILABLE_DISK_SPACE} -gt ${DISK_REQUIREMENTS} ]; then
fallocate -l 6G ${SWAPFILE}
chmod 600 ${SWAPFILE}
mkswap ${SWAPFILE}
swapon ${SWAPFILE}
echo "$SWAPFILE none swap sw 0 0" >> /etc/fstab
fi
}

command_exists () {
type "$1" &> /dev/null;
}
Expand Down
43 changes: 43 additions & 0 deletions build/install/OneClickInstall/install-Docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ CONTAINER_NAME="${PACKAGE_SYSNAME}-api"

NETWORK_NAME=${PACKAGE_SYSNAME}

SWAPFILE="/${PRODUCT}_swapfile";
MAKESWAP="true";

DISK_REQUIREMENTS=40960;
MEMORY_REQUIREMENTS=5500;
CORE_REQUIREMENTS=2;
Expand Down Expand Up @@ -310,6 +313,13 @@ while [ "$1" != "" ]; do
fi
;;

-ms | --makeswap )
if [ "$2" != "" ]; then
MAKESWAP=$2
shift
fi
;;

-? | -h | --help )
echo " Usage: bash $HELP_TARGET [PARAMETER] [[PARAMETER], ...]"
echo
Expand Down Expand Up @@ -341,6 +351,7 @@ while [ "$1" != "" ]; do
echo " -mysqlp, --mysqlpassword $PRODUCT database password"
echo " -mysqlh, --mysqlhost mysql server host"
echo " -dbm, --databasemigration database migration (true|false)"
echo " -ms, --makeswap make swap file (true|false)"
echo " -?, -h, --help this help"
echo
echo " Install all the components without document server:"
Expand Down Expand Up @@ -480,6 +491,10 @@ check_os_info () {
echo "Not supported OS";
exit 1;
fi

if [ -f /etc/needrestart/needrestart.conf ]; then
sed -e "s_#\$nrconf{restart}_\$nrconf{restart}_" -e "s_\(\$nrconf{restart} =\).*_\1 'a';_" -i /etc/needrestart/needrestart.conf
fi
}

check_kernel () {
Expand Down Expand Up @@ -1048,6 +1063,30 @@ install_product () {
docker-compose -f $BASE_DIR/healthchecks.yml up -d
}

make_swap () {
DISK_REQUIREMENTS=6144; #6Gb free space
MEMORY_REQUIREMENTS=11000; #RAM ~12Gb

AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }');
TOTAL_MEMORY=$(free -m | grep -oP '\d+' | head -n 1);
EXIST=$(swapon -s | awk '{ print $1 }' | { grep -x ${SWAPFILE} || true; });

if [[ -z $EXIST ]] && [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ] && [ ${AVAILABLE_DISK_SPACE} -gt ${DISK_REQUIREMENTS} ]; then

if [ "${DIST}" == "Ubuntu" ] || [ "${DIST}" == "Debian" ]; then
fallocate -l 6G ${SWAPFILE}
else
dd if=/dev/zero of=${SWAPFILE} count=6144 bs=1MiB
fi

chmod 600 ${SWAPFILE}
mkswap ${SWAPFILE}
swapon ${SWAPFILE}
echo "$SWAPFILE none swap sw 0 0" >> /etc/fstab
fi
}


start_installation () {
root_checking

Expand All @@ -1065,6 +1104,10 @@ start_installation () {
check_hardware
fi

if [ "$MAKESWAP" == "true" ]; then
make_swap
fi

if command_exists docker ; then
check_docker_version
service docker start
Expand Down
9 changes: 9 additions & 0 deletions build/install/OneClickInstall/install-RedHat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package_sysname="onlyoffice";
product="docspace"
GIT_BRANCH="master"
INSTALLATION_TYPE="ENTERPRISE"
MAKESWAP="true"
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
Expand Down Expand Up @@ -81,6 +82,13 @@ while [ "$1" != "" ]; do
shift
fi
;;

-ms | --makeswap )
if [ "$2" != "" ]; then
MAKESWAP=$2
shift
fi
;;

-? | -h | --help )
echo " Usage $0 [PARAMETER] [[PARAMETER], ...]"
Expand All @@ -92,6 +100,7 @@ while [ "$1" != "" ]; do
echo " -js, --jwtsecret defines the secret key to validate the JWT in the request"
echo " -ls, --local_scripts use 'true' to run local scripts (true|false)"
echo " -skiphc, --skiphardwarecheck use to skip hardware check (true|false)"
echo " -ms, --makeswap make swap file (true|false)"
echo " -?, -h, --help this help"
echo
exit 0
Expand Down
6 changes: 5 additions & 1 deletion build/install/OneClickInstall/install-RedHat/install-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if [ "$PRODUCT_INSTALLED" = "false" ]; then
-mysqlu ${MYSQL_SERVER_USER} \
-mysqlp ${MYSQL_ROOT_PASS}
elif [[ $PRODUCT_CHECK_UPDATE -eq $UPDATE_AVAILABLE_CODE || $RECONFIGURE_PRODUCT = "true" ]]; then
ENVIRONMENT=$(grep -oP 'ENVIRONMENT=\K.*' /lib/systemd/system/${product}-api.service)
ENVIRONMENT=$(grep -oP 'ENVIRONMENT=\K.*' /usr/lib/systemd/system/${product}-api.service)
CONNECTION_STRING=$(json -f /etc/${package_sysname}/${product}/appsettings.$ENVIRONMENT.json ConnectionStrings.default.connectionString)
${package_manager} -y update ${product}
${product}-configuration \
Expand All @@ -167,6 +167,10 @@ elif [[ $PRODUCT_CHECK_UPDATE -eq $UPDATE_AVAILABLE_CODE || $RECONFIGURE_PRODUCT
-mysqlp $(grep -oP 'Password=\K[^;]*' <<< "$CONNECTION_STRING")
fi

if [ "$MAKESWAP" == "true" ]; then
make_swap
fi

echo ""
echo "$RES_INSTALL_SUCCESS"
echo "$RES_QUESTIONS"
Expand Down
18 changes: 18 additions & 0 deletions build/install/OneClickInstall/install-RedHat/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

set -e

function make_swap () {
local DISK_REQUIREMENTS=6144; #6Gb free space
local MEMORY_REQUIREMENTS=11000; #RAM ~12Gb
SWAPFILE="/${PRODUCT}_swapfile";

local AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }');
local TOTAL_MEMORY=$(free -m | grep -oP '\d+' | head -n 1);
local EXIST=$(swapon -s | awk '{ print $1 }' | { grep -x ${SWAPFILE} || true; });

if [[ -z $EXIST ]] && [ ${TOTAL_MEMORY} -lt ${MEMORY_REQUIREMENTS} ] && [ ${AVAILABLE_DISK_SPACE} -gt ${DISK_REQUIREMENTS} ]; then
dd if=/dev/zero of=${SWAPFILE} count=6144 bs=1MiB
chmod 600 ${SWAPFILE}
mkswap ${SWAPFILE}
swapon ${SWAPFILE}
echo "$SWAPFILE none swap sw 0 0" >> /etc/fstab
fi
}

check_hardware () {
DISK_REQUIREMENTS=40960;
MEMORY_REQUIREMENTS=5500;
Expand Down
11 changes: 5 additions & 6 deletions build/install/common/product-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ set_core_machinekey () {
fi
fi

$JSON_USERCONF "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\", 'notify': { 'postman': \"services\" }}" >/dev/null 2>&1
$JSON $APP_DIR/apisystem.$ENVIRONMENT.json -e "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\", 'notify': { 'postman': \"services\" }}" >/dev/null 2>&1
$JSON_USERCONF "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\"}" >/dev/null 2>&1
$JSON $APP_DIR/apisystem.$ENVIRONMENT.json -e "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\"}" >/dev/null 2>&1
sed "s^\(machine_key\)\s*=.*^\1 = ${CORE_MACHINEKEY}^g" -i $APP_DIR/radicale.config
}

Expand All @@ -239,7 +239,7 @@ install_json() {
restart_services() {
chown -R ${PACKAGE_SYSNAME}:${PACKAGE_SYSNAME} $APP_DIR $PRODUCT_DIR $LOG_DIR /var/www/$PACKAGE_SYSNAME/Data

sed "s_\(ENVIRONMENT=\).*_\1${ENVIRONMENT}_i" -i /lib/systemd/system/${PRODUCT}*.service >/dev/null 2>&1
sed "s_\(ENVIRONMENT=\).*_\1${ENVIRONMENT}_i" -i /usr/lib/systemd/system/${PRODUCT}*.service >/dev/null 2>&1
systemctl daemon-reload

echo -n "Updating database... "
Expand Down Expand Up @@ -606,8 +606,7 @@ setup_elasticsearch() {
setup_redis() {
echo -n "Configuring redis... "

sed "s_\(\"Host\":\).*_\1 \"${REDIS_HOST}\",_" -i $APP_DIR/redis.json
sed "s_\(\"Port\":\).*_\1 \"${REDIS_PORT}\"_" -i $APP_DIR/redis.json
$JSON $APP_DIR/redis.$ENVIRONMENT.json -e "this.Redis={'Hosts': [ { Host: \"${REDIS_HOST}\", Port: \"${REDIS_PORT}\" } ] }" >/dev/null 2>&1

if [ -e /etc/redis/redis.conf ]; then
sed "s_\(^bind\).*_\1 ${REDIS_HOST}_" -i /etc/redis/redis.conf
Expand Down Expand Up @@ -635,7 +634,7 @@ product_configuration(){
echo -n "Configuring ${PRODUCT}... "

#Creating environment configuration files
enviromentFiles=("appsettings.$ENVIRONMENT.json" "apisystem.$ENVIRONMENT.json" "elastic.$ENVIRONMENT.json" "rabbitmq.$ENVIRONMENT.json")
enviromentFiles=("appsettings.$ENVIRONMENT.json" "apisystem.$ENVIRONMENT.json" "elastic.$ENVIRONMENT.json" "rabbitmq.$ENVIRONMENT.json" "redis.$ENVIRONMENT.json")

for i in "${!enviromentFiles[@]}"; do
if [ ! -e "$APP_DIR/${enviromentFiles[$i]}" ]; then
Expand Down
7 changes: 6 additions & 1 deletion build/install/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ override_dh_auto_build:
if ! grep -q 'var/www/${PRODUCT}' ${SRC_PATH}/config/nginx/*.conf; then find ${SRC_PATH}/config/nginx/ -name "*.conf" -exec sed -i "s@\(var/www/\)@\1${PRODUCT}/@" {} +; fi

json -I -f ${SRC_PATH}/config/appsettings.services.json -e "this.logPath=\"/var/log/onlyoffice/${PRODUCT}\"" -e "this.socket={ 'path': '../ASC.Socket.IO/' }" \
-e "this.ssoauth={ 'path': '../ASC.SsoAuth/' }" -e "this.core={ 'products': { 'folder': '/var/www/${PRODUCT}/products', 'subfolder': 'server'} }"
-e "this.ssoauth={ 'path': '../ASC.SsoAuth/' }" -e "this.logLevel=\"warning\"" -e "this.core={ 'products': { 'folder': '/var/www/${PRODUCT}/products', 'subfolder': 'server'} }"

find ${SRC_PATH}/config/ -type f -regex '.*\.\(test\|dev\).*' -delete
json -I -f ${SRC_PATH}/config/appsettings.json -e "this.core.notify.postman=\"services\"" -e "this.Logging.LogLevel.Default=\"Warning\"" -e "this['debug-info'].enabled=\"false\""
json -I -f ${SRC_PATH}/config/apisystem.json -e "this.core.notify.postman=\"services\""
sed 's_\(minlevel=\)".*"_\1"Warn"_g' -i ${SRC_PATH}/config/nlog.config

sed 's/teamlab.info/onlyoffice.com/g' -i ${SRC_PATH}/config/autofac.consumers.json

for i in ${PRODUCT} $$(ls ${CURRENT_PATH}/debian/*.install | grep -oP 'debian/\K.*' | grep -o '^[^.]*'); do \
cp ${CURRENT_PATH}/debian/source/lintian-overrides ${CURRENT_PATH}/debian/$$i.lintian-overrides; \
Expand Down
3 changes: 3 additions & 0 deletions build/install/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
ENV_EXTENSION=none
APP_CORE_BASE_DOMAIN=localhost
APP_URL_PORTAL="http://localhost:8092"
OAUTH_REDIRECT_URL="https://service.onlyoffice.com/oauth2.aspx"
LOG_LEVEL="Warning"
DEBUG_INFO="false"

APP_KNOWN_PROXIES=""
APP_KNOWN_NETWORKS=""
Expand Down
Loading

0 comments on commit e4ea5a4

Please sign in to comment.