Skip to content

Commit

Permalink
Bugfix/rpm errors (#295)
Browse files Browse the repository at this point in the history
* Fix the elasticsearch configuration

* Add copying of the start files

* License correction

* Fix file copying

* Add a warning about an unsupported version of the distribution

* Correction of folder names

* Correction of directory name

* Fix configuration errors and add a quiet mode

* Remove a quiet mode

* Release ports for launching services

* Add topics to launch socket.io

* Fix folder name

* Fix the output of messages about the creation of topics

* Remove unnecessary lines

* Delete an unnecessary line
  • Loading branch information
evgeniy-antonyuk authored Jul 13, 2021
1 parent a046cd3 commit 8d28724
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 29 deletions.
10 changes: 9 additions & 1 deletion build/install/OneClickInstall/install-RedHat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ package_services="";
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product}.";
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product^^}.";
RES_QUESTIONS="In case you have any questions contact us via http://support.onlyoffice.com or visit our forum at http://dev.onlyoffice.org"

res_unsupported_version () {
RES_CHOICE="Please, enter Y or N"
RES_CHOICE_INSTALLATION="Continue installation [Y/N]? "
RES_UNSPPORTED_VERSION="You have an unsupported version of $DIST installed"
RES_SELECT_INSTALLATION="Select 'N' to cancel the ONLYOFFICE installation (recommended). Select 'Y' to continue installing ONLYOFFICE"
RES_ERROR_REMINDER="Please note, that if you continue with the installation, there may be errors"
}

while [ "$1" != "" ]; do
case $1 in

Expand Down
31 changes: 30 additions & 1 deletion build/install/OneClickInstall/install-RedHat/install-preq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ${package_manager} clean all

${package_manager} -y install yum-utils

DIST=$(rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release);
DIST=$(echo $DIST | sed -n '/-.*/s///p');
REV=$(cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//);
REV_PARTS=(${REV//\./ });
REV=${REV_PARTS[0]};
Expand All @@ -23,6 +25,33 @@ if ! [[ "$REV" =~ ^[0-9]+$ ]]; then
REV=7;
fi

read_unsupported_installation () {
read -p "$RES_CHOICE_INSTALLATION " CHOICE_INSTALLATION
case "$CHOICE_INSTALLATION" in
y|Y ) yum -y install $DIST*-release
;;

n|N ) exit 0;
;;

* ) echo $RES_CHOICE;
read_unsupported_installation
;;
esac
}

{ yum check-update $DIST*-release; exitCode=$?; } || true #Checking for distribution update

UPDATE_AVAILABLE_CODE=100
if [[ $exitCode -eq $UPDATE_AVAILABLE_CODE ]]; then
res_unsupported_version
echo $RES_UNSPPORTED_VERSION
echo $RES_SELECT_INSTALLATION
echo $RES_ERROR_REMINDER
echo $RES_QUESTIONS
read_unsupported_installation
fi

# add epel repo
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-$REV.noarch.rpm || true
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-$REV.rpm || true
Expand Down Expand Up @@ -140,7 +169,7 @@ ${package_manager} -y install epel-release \
make \
yarn \
dotnet-sdk-5.0 \
elasticsearch-7.8.1 --enablerepo=elasticsearch \
elasticsearch-7.13.1 --enablerepo=elasticsearch \
mysql-server \
nginx \
supervisor \
Expand Down
12 changes: 6 additions & 6 deletions build/install/common/systemd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ reassign_values (){
EXEC_FILE="ASC.ApiSystem.dll"
;;
urlshortener )
SERVICE_PORT="9999"
WORK_DIR="${BASE_DIR}/services/ASC.UrlShortener/"
SERVICE_PORT="9998"
WORK_DIR="${BASE_DIR}/services/ASC.UrlShortener.Svc/"
EXEC_FILE="ASC.UrlShortener.Svc.dll"
;;
thumbnails )
SERVICE_PORT="9800"
WORK_DIR="${BASE_DIR}/services/ASC.Thumbnails/"
SERVICE_PORT="9799"
WORK_DIR="${BASE_DIR}/services/ASC.Thumbnails.Svc/"
EXEC_FILE="ASC.Thumbnails.Svc.dll"
;;
socket )
SERVICE_PORT="9899"
WORK_DIR="${BASE_DIR}/services/ASC.Socket.IO/"
SERVICE_PORT="9898"
WORK_DIR="${BASE_DIR}/services/ASC.Socket.IO.Svc/"
EXEC_FILE="ASC.Socket.IO.Svc.dll"
;;
studio-notify )
Expand Down
2 changes: 1 addition & 1 deletion build/install/rpm/SPECS/appserver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Packager: Ascensio System SIA <[email protected]>
ExclusiveArch: x86_64
AutoReq: no
AutoProv: no
License: GPLv3
License: AGPLv3
Source0: https://github.com/ONLYOFFICE/%{product}/archive/%GIT_BRANCH.tar.gz
BuildRequires: nodejs >= 12.0
BuildRequires: yarn
Expand Down
3 changes: 3 additions & 0 deletions build/install/rpm/SPECS/files.spec
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,21 @@
%files urlshortener
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.UrlShortener/
%{buildpath}/services/ASC.UrlShortener.Svc/
%{_sysconfdir}/systemd/system/%{product}-urlshortener.service
%dir %{buildpath}/services/

%files thumbnails
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.Thumbnails/
%{buildpath}/services/ASC.Thumbnails.Svc/
%{_sysconfdir}/systemd/system/%{product}-thumbnails.service
%dir %{buildpath}/services/

%files socket
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.Socket.IO/
%{buildpath}/services/ASC.Socket.IO.Svc/
%{buildpath}/products/ASC.Files/server/
%{buildpath}/products/ASC.People/server/
%{buildpath}/products/ASC.CRM/server/
Expand Down
20 changes: 12 additions & 8 deletions build/install/rpm/SPECS/install.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mkdir -p "%{buildroot}%{buildpath}/products/ASC.CRM/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.CRM/server/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/editor/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/server/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/server/DocStore/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/service/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Mail/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Mail/server/"
Expand All @@ -23,15 +23,18 @@ mkdir -p "%{buildroot}%{buildpath}/products/ASC.Projects/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Projects/server/"
mkdir -p "%{buildroot}%{buildpath}/public/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Socket.IO/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Socket.IO.Svc/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.ApiSystem/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Data.Backup/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Notify/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Data.Storage.Encryption/service"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Data.Storage.Migration/service"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Studio.Notify/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.TelegramService/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Thumbnails/client/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.UrlShortener/client/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Thumbnails/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.UrlShortener/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.UrlShortener.Svc/"
mkdir -p "%{buildroot}%{buildpath}/services/ASC.Thumbnails.Svc/"
mkdir -p "%{buildroot}%{buildpath}/sql/"
mkdir -p "%{buildroot}%{buildpath}/studio/api/"
mkdir -p "%{buildroot}%{buildpath}/studio/client/"
Expand All @@ -48,15 +51,15 @@ cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.ApiSystem/service/* "%{bu
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Data.Backup/service/* "%{buildroot}%{buildpath}/services/ASC.Data.Backup/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Notify/service/* "%{buildroot}%{buildpath}/services/ASC.Notify/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Socket.IO/service/* "%{buildroot}%{buildpath}/services/ASC.Socket.IO/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Socket.IO.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.Socket.IO/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Socket.IO.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.Socket.IO.Svc/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Data.Storage.Encryption/service/* "%{buildroot}%{buildpath}/services/ASC.Data.Storage.Encryption/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Data.Storage.Migration/service/* "%{buildroot}%{buildpath}/services/ASC.Data.Storage.Migration/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Studio.Notify/service/* "%{buildroot}%{buildpath}/services/ASC.Studio.Notify/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.TelegramService/service/* "%{buildroot}%{buildpath}/services/ASC.TelegramService/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Thumbnails/service/* "%{buildroot}%{buildpath}/services/ASC.Thumbnails/client/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Thumbnails.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.Thumbnails/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.UrlShortener/service/* "%{buildroot}%{buildpath}/services/ASC.UrlShortener/client/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.UrlShortener.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.UrlShortener/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Thumbnails/service/* "%{buildroot}%{buildpath}/services/ASC.Thumbnails/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Thumbnails.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.Thumbnails.Svc/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.UrlShortener/service/* "%{buildroot}%{buildpath}/services/ASC.UrlShortener/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.UrlShortener.Svc/service/* "%{buildroot}%{buildpath}/services/ASC.UrlShortener.Svc/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Web.Api/service/* "%{buildroot}%{buildpath}/studio/api/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Web.Studio/service/* "%{buildroot}%{buildpath}/studio/server/"
cp -rf %{_builddir}/%{sourcename}/build/install/common/systemd/modules/* "%{buildroot}%{_sysconfdir}/systemd/system/"
Expand All @@ -67,6 +70,7 @@ cp -rf %{_builddir}/%{sourcename}/config/nginx/includes/onlyoffice*.conf "%{buil
cp -rf %{_builddir}/%{sourcename}/config/nginx/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/conf.d/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.CRM/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.CRM/client/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.Files/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.Files/client/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.Files/Server/DocStore/* "%{buildroot}%{buildpath}/products/ASC.Files/server/DocStore/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.People/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.People/client/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.Projects/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.Projects/client/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.Calendar/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.Calendar/client/"
Expand Down
35 changes: 23 additions & 12 deletions build/install/rpm/appserver-configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ ELK_PORT="9200"

JSON="json -I -f"
JSON_USERCONF="$JSON $USER_CONF -e"
JSON_DSCONF="$JSON $DS_CONF -e"

[ $(id -u) -ne 0 ] && { echo "Root privileges required"; exit 1; }

Expand Down Expand Up @@ -129,7 +128,7 @@ while [ "$1" != "" ]; do
echo " -zkp, --zookeeperport zookeeper port (default 2181)"
echo " -esh, --elastichost elasticsearch ip"
echo " -esp, --elasticport elasticsearch port (default 9200)"
echo " -e, --environment environment (default 'production')"
echo " -e, --environment environment (default 'production')"
echo " -?, -h, --help this help"
echo
exit 0
Expand Down Expand Up @@ -167,8 +166,8 @@ install_json() {

set_core_machinekey
$JSON_USERCONF "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\" }" \
-e "this.urlshortener={ 'path': 'client/index.js' }" -e "this.thumb={ 'path': 'client/' }" \
-e "this.socket={ 'path': '../ASC.Socket.IO' }" >/dev/null 2>&1
-e "this.urlshortener={ 'path': '../ASC.UrlShortener/index.js' }" -e "this.thumb={ 'path': '../ASC.Thumbnails/' }" \
-e "this.socket={ 'path': '../ASC.Socket.IO/' }" >/dev/null 2>&1
$JSON $APP_DIR/appsettings.json -e "this.core.products.subfolder='server'" >/dev/null 2>&1
$JSON $APP_DIR/appsettings.services.json -e "this.core={ 'products': { 'folder': '../../products', 'subfolder': 'server'} }" >/dev/null 2>&1

Expand All @@ -178,23 +177,21 @@ install_json() {
restart_services() {
echo -n "Restarting services... "

sed -i "s/ENVIRONMENT=.*/ENVIRONMENT=$ENVIRONMENT/" $SYSTEMD_DIR/${PRODUCT}*.service >/dev/null 2>&1
systemctl daemon-reload

for SVC in nginx mysqld ${PRODUCT}-api ${PRODUCT}-api-system ${PRODUCT}-urlshortener ${PRODUCT}-thumbnails \
${PRODUCT}-socket ${PRODUCT}-studio-notify ${PRODUCT}-notify ${PRODUCT}-people-server ${PRODUCT}-files \
${PRODUCT}-files-services ${PRODUCT}-studio ${PRODUCT}-backup ${PRODUCT}-storage-encryption \
${PRODUCT}-storage-migration ${PRODUCT}-projects-server ${PRODUCT}-telegram-service ${PRODUCT}-crm \
${PRODUCT}-calendar ${PRODUCT}-mail elasticsearch kafka zookeeper
do
sed -i "s/ENVIRONMENT=.*/ENVIRONMENT=$ENVIRONMENT/" $SYSTEMD_DIR/$SVC.service >/dev/null 2>&1

if systemctl is-active $SVC | grep -q "active"; then
systemctl restart $SVC.service >/dev/null 2>&1
else
systemctl enable $SVC.service >/dev/null 2>&1
systemctl start $SVC.service >/dev/null 2>&1
fi
if systemctl is-active $SVC | grep -v "active" >/dev/null; then
echo -e "\033[31m $SVC not started \033[0m"
fi
done
echo "OK"
}
Expand Down Expand Up @@ -418,6 +415,7 @@ setup_nginx(){
setup_docs() {
echo -n "Configuring Docs... "
local DS_CONF="/etc/onlyoffice/documentserver/local.json"
local JSON_DSCONF="$JSON $DS_CONF -e"

#Changing the Docs port in nginx conf
sed -i "s/0.0.0.0:.*;/0.0.0.0:$DOCUMENT_SERVER_PORT;/" $NGINX_CONF/ds.conf
Expand Down Expand Up @@ -504,7 +502,7 @@ setup_elasticsearch() {
echo -n "Configuring elasticsearch... "

#Save elasticsearch parameters in .json
$JSON_USERCONF "this.elastic={'Scheme': \"${ELK_SHEME}\",'Host': \"${ELK_HOST}\",'Port': \"${ELK_PORT}\" }" >/dev/null 2>&1
$JSON $APP_DIR/elastic.json -e "this.elastic={'Scheme': \"${ELK_SHEME}\",'Host': \"${ELK_HOST}\",'Port': \"${ELK_PORT}\",'Threads': \"1\" }" >/dev/null 2>&1

change_elasticsearch_config

Expand All @@ -515,12 +513,14 @@ setup_kafka() {

local KAFKA_SERVICE=$(systemctl --type=service | grep 'kafka' | tr -d '' | awk '{print $1;}')

if [ $KAFKA_SERVICE ]; then
if [ -n ${KAFKA_SERVICE} ]; then

echo -n "Configuring kafka... "

local KAFKA_DIR="$(cat $SYSTEMD_DIR/$KAFKA_SERVICE | grep ExecStop= | cut -c 10- | rev | cut -c 26- | rev)"
local KAFKA_CONF="${KAFKA_DIR}/config"

#Change kafka config
local KAFKA_CONF="$(cat $SYSTEMD_DIR/$KAFKA_SERVICE | grep ExecStop= | cut -c 10- | rev | cut -c 26- | rev)/config"
sed -i "s/clientPort=.*/clientPort=${ZOOKEEPER_PORT}/g" $KAFKA_CONF/zookeeper.properties
sed -i "s/zookeeper.connect=.*/zookeeper.connect=${ZOOKEEPER_HOST}:${ZOOKEEPER_PORT}/g" $KAFKA_CONF/server.properties
sed -i "s/bootstrap.servers=.*/bootstrap.servers=${KAFKA_HOST}:${KAFKA_PORT}/g" $KAFKA_CONF/consumer.properties
Expand All @@ -532,6 +532,17 @@ setup_kafka() {
#Save kafka parameters in .json
$JSON_USERCONF "this.kafka={'BootstrapServers': \"${KAFKA_HOST}:${KAFKA_PORT}\"}" >/dev/null 2>&1

#Add topics for kafka
KAFKA_TOPICS=( ascchannelQuotaCacheItemAny
ascchannelTariffCacheItemRemove
ascchannelTenantCacheItemInsertOrUpdate
ascchannelTenantSettingRemove )

for i in "${KAFKA_TOPICS[@]}"
do
${KAFKA_DIR}/bin/kafka-topics.sh --create --zookeeper ${ZOOKEEPER_HOST}:${ZOOKEEPER_PORT} --topic $i --replication-factor 1 --partitions 3 >/dev/null 2>&1
done

echo "OK"
fi

Expand Down

0 comments on commit 8d28724

Please sign in to comment.