Merge branch 'develop' into feature/backup

This commit is contained in:
Tatiana Lopaeva 2021-05-30 20:57:01 +03:00
commit f9feb35afc
509 changed files with 14939 additions and 8353 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ Data/
Logs/
**/.DS_Store
.eslintcache
build/deploy/

View File

@ -79,7 +79,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Encryption", "comm
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Projects", "products\ASC.Projects\Server\ASC.Projects.csproj", "{D1A33923-5680-4B86-A7DA-41E78350D997}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.CRM", "products\ASC.CRM\Server\ASC.CRM.csproj", "{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.CRM", "products\ASC.CRM\Server\ASC.CRM.csproj", "{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Mail", "products\ASC.Mail\Server\ASC.Mail.csproj", "{137CA67B-D0F5-4746-B8BC-1888D2859B90}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Calendar", "products\ASC.Calendar\Server\ASC.Calendar.csproj", "{F39933F8-7598-492F-9DD3-E25780D68288}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -227,6 +231,14 @@ Global
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Release|Any CPU.Build.0 = Release|Any CPU
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Release|Any CPU.Build.0 = Release|Any CPU
{F39933F8-7598-492F-9DD3-E25780D68288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F39933F8-7598-492F-9DD3-E25780D68288}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F39933F8-7598-492F-9DD3-E25780D68288}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F39933F8-7598-492F-9DD3-E25780D68288}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -3,12 +3,8 @@
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<config>
<add key="repositorypath" value="$\..\..\packages" />
</config>
<packageSources>
<add key="Pomelo" value="https://pkgs.dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_packaging/pomelo-efcore-public/nuget/v3/index.json" />
<add key="Custom NuGet Server" value="packages" />
<add key="Custom NuGet Server" value=".nuget\packages" />
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<packageRestore>

16
build/Jenkinsfile vendored
View File

@ -6,14 +6,14 @@ pipeline {
stage('Unix') {
agent { label 'net-core' }
stages {
stage('Backend') {
stage('Frontend') {
steps {
sh 'yarn install && yarn build'
}
}
stage('Frontend') {
stage('Backend') {
steps {
sh 'dotnet build ASC.Web.sln --configfile .nuget/NuGet.Config'
sh 'dotnet build ASC.Web.sln'
}
}
}
@ -21,14 +21,14 @@ pipeline {
stage('Windows') {
agent { label 'win-core' }
stages {
stage('Backend') {
stage('Frontend') {
steps {
bat 'yarn install && yarn build'
}
}
stage('Frontend') {
stage('Backend') {
steps {
bat 'dotnet build ASC.Web.sln --configfile .nuget\\NuGet.Config'
bat 'dotnet build ASC.Web.sln'
}
}
}
@ -62,7 +62,7 @@ pipeline {
}
stage('Files') {
steps {
sh "dotnet build ASC.Web.sln --configfile .nuget/NuGet.Config && cd ${env.WORKSPACE}/products/ASC.Files/Tests/ && dotnet test ASC.Files.Tests.csproj -r linux-x64 -l \"console;verbosity=detailed\""
sh "dotnet build ASC.Web.sln && cd ${env.WORKSPACE}/products/ASC.Files/Tests/ && dotnet test ASC.Files.Tests.csproj -r linux-x64 -l \"console;verbosity=detailed\""
}
}
}
@ -90,7 +90,7 @@ pipeline {
}
stage('Files') {
steps {
bat "dotnet build ASC.Web.sln --configfile .nuget\\NuGet.Config && cd ${env.WORKSPACE}\\products\\ASC.Files\\Tests\\ && dotnet test ASC.Files.Tests.csproj"
bat "dotnet build ASC.Web.sln && cd ${env.WORKSPACE}\\products\\ASC.Files\\Tests\\ && dotnet test ASC.Files.Tests.csproj"
}
}
}

View File

@ -4,12 +4,13 @@ set -e
package_manager="yum"
package_sysname="onlyoffice";
product="appserver"
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 Appserver.";
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"
while [ "$1" != "" ]; do

View File

@ -10,11 +10,11 @@ cat<<EOF
EOF
if rpm -qa | grep ${package_sysname}-appserver; then
echo "${package_sysname}-appserver $RES_APP_INSTALLED"
if rpm -qa | grep ${package_sysname}-${product}; then
echo "${package_sysname}-${product} $RES_APP_INSTALLED"
APPSERVER_INSTALLED="true";
elif [ "${UPDATE}" != "true" ] && netstat -lnp | awk '{print $4}' | grep -qE ":80$|:8081$|:8083$|:5001$|:5002$|:8080$|:80$"; then
echo "${package_sysname}-appserver $RES_APP_CHECK_PORTS: 80, 8081, 8083, 5001, 5002, 9200, 2181, 9092";
echo "${package_sysname}-${product} $RES_APP_CHECK_PORTS: 80, 8081, 8083, 5001, 5002, 9200, 2181, 9092";
echo "$RES_CHECK_PORTS"
exit
else

View File

@ -10,6 +10,21 @@ cat<<EOF
EOF
if [ -e /etc/redis.conf ]; then
sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis.conf
sed -r "/^save\s[0-9]+/d" -i /etc/redis.conf
systemctl restart redis
fi
sed "/host\s*all\s*all\s*127\.0\.0\.1\/32\s*ident$/s|ident$|trust|" -i /var/lib/pgsql/data/pg_hba.conf
sed "/host\s*all\s*all\s*::1\/128\s*ident$/s|ident$|trust|" -i /var/lib/pgsql/data/pg_hba.conf
for SVC in $package_services; do
systemctl start $SVC
systemctl enable $SVC
done
MYSQL_SERVER_HOST=${MYSQL_SERVER_HOST:-"localhost"}
MYSQL_SERVER_DB_NAME=${MYSQL_SERVER_DB_NAME:-"${package_sysname}"}
MYSQL_SERVER_USER=${MYSQL_SERVER_USER:-"root"}
@ -31,30 +46,24 @@ if [ "${MYSQL_FIRST_TIME_INSTALL}" = "true" ]; then
MYSQL="mysql --connect-expired-password -u$MYSQL_SERVER_USER -D mysql";
else
MYSQL="mysql --connect-expired-password -u$MYSQL_SERVER_USER -p${MYSQL_TEMPORARY_ROOT_PASS} -D mysql";
MYSQL_ROOT_PASS=$(echo $MYSQL_TEMPORARY_ROOT_PASS | sed -e 's/;/%/g' -e 's/=/%/g');
fi
$MYSQL -e "ALTER USER '${MYSQL_SERVER_USER}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_TEMPORARY_ROOT_PASS}'" >/dev/null 2>&1 \
|| $MYSQL -e "UPDATE user SET plugin='mysql_native_password', authentication_string=PASSWORD('${MYSQL_TEMPORARY_ROOT_PASS}') WHERE user='${MYSQL_SERVER_USER}' and host='localhost';"
$MYSQL -e "ALTER USER '${MYSQL_SERVER_USER}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASS}'" >/dev/null 2>&1 \
|| $MYSQL -e "UPDATE user SET plugin='mysql_native_password', authentication_string=PASSWORD('${MYSQL_ROOT_PASS}') WHERE user='${MYSQL_SERVER_USER}' and host='localhost';"
systemctl restart mysqld
fi
elif [ "${UPDATE}" = "true" ] && [ "${MYSQL_FIRST_TIME_INSTALL}" != "true" ]; then
ENVIRONMENT="$(cat /etc/systemd/system/${product}-api.service | grep -oP 'ENVIRONMENT=\K.*')"
USER_CONNECTIONSTRING=$(json -f /etc/onlyoffice/${product}/appsettings.$ENVIRONMENT.json ConnectionStrings.default.connectionString)
MYSQL_SERVER_HOST=$(echo $USER_CONNECTIONSTRING | grep -oP 'Server=\K.*' | grep -o '^[^;]*')
MYSQL_SERVER_DB_NAME=$(echo $USER_CONNECTIONSTRING | grep -oP 'Database=\K.*' | grep -o '^[^;]*')
MYSQL_SERVER_USER=$(echo $USER_CONNECTIONSTRING | grep -oP 'User ID=\K.*' | grep -o '^[^;]*')
MYSQL_SERVER_PORT=$(echo $USER_CONNECTIONSTRING | grep -oP 'Port=\K.*' | grep -o '^[^;]*')
MYSQL_ROOT_PASS=$(echo $USER_CONNECTIONSTRING | grep -oP 'Password=\K.*' | grep -o '^[^;]*')
fi
if [ -e /etc/redis.conf ]; then
sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis.conf
sed -r "/^save\s[0-9]+/d" -i /etc/redis.conf
systemctl restart redis
fi
sed "/host\s*all\s*all\s*127\.0\.0\.1\/32\s*ident$/s|ident$|trust|" -i /var/lib/pgsql/data/pg_hba.conf
sed "/host\s*all\s*all\s*::1\/128\s*ident$/s|ident$|trust|" -i /var/lib/pgsql/data/pg_hba.conf
for SVC in $package_services; do
systemctl start $SVC
systemctl enable $SVC
done
if [ "$DOCUMENT_SERVER_INSTALLED" = "false" ]; then
declare -x DS_PORT=8083
@ -125,6 +134,8 @@ expect << EOF
EOF
DOCUMENT_SERVER_INSTALLED="true";
elif [ "$UPDATE" = "true" ] && [ "$DOCUMENT_SERVER_INSTALLED" = "true" ]; then
${package_manager} -y update ${package_sysname}-documentserver
fi
NGINX_ROOT_DIR="/etc/nginx"
@ -141,16 +152,24 @@ if rpm -q "firewalld"; then
systemctl restart firewalld.service
fi
if [ "$APPSERVER_INSTALLED" = "false" ]; then
if [ "$APPSERVER_INSTALLED" = "false" ] || [ "$UPDATE" = "true" ]; then
if [ "$APPSERVER_INSTALLED" = "false" ]; then
${package_manager} install -y ${package_sysname}-${product}
else
${package_manager} -y update ${package_sysname}-${product}
fi
${package_manager} install -y ${package_sysname}-appserver.x86_64
if [ "${MYSQL_FIRST_TIME_INSTALL}" = "true" ]; then
if [ "${MYSQL_FIRST_TIME_INSTALL}" = "true" ] || [ "$UPDATE" = "true" ]; then
expect << EOF
set timeout -1
log_user 1
spawn appserver-configuration.sh
if { "${UPDATE}" == "true" } {
spawn ${product}-configuration.sh -e ${ENVIRONMENT}
} else {
spawn ${product}-configuration.sh
}
expect -re "Database host:"
send "\025$MYSQL_SERVER_HOST\r"
@ -161,13 +180,14 @@ expect << EOF
send "\025$MYSQL_SERVER_USER\r"
expect -re "Database password:"
send "\025$MYSQL_TEMPORARY_ROOT_PASS\r"
send "\025$MYSQL_ROOT_PASS\r"
expect eof
EOF
APPSERVER_INSTALLED="true";
APPSERVER_INSTALLED="true";
else
bash appserver-configuration.sh
bash ${product}-configuration.sh
APPSERVER_INSTALLED="true";
fi
fi

View File

@ -63,12 +63,13 @@ type=rpm-md
END
#install kafka
mkdir -p /var/www/appserver/services/
getent passwd kafka >/dev/null || useradd -m -d /var/www/appserver/services/kafka -s /sbin/nologin -p kafka kafka
cd /var/www/appserver/services/kafka
PRODUCT_DIR="/var/www/${product}"
mkdir -p ${PRODUCT_DIR}/services/
getent passwd kafka >/dev/null || useradd -m -d ${PRODUCT_DIR}/services/kafka -s /sbin/nologin -p kafka kafka
cd ${PRODUCT_DIR}/services/kafka
wget https://downloads.apache.org/kafka/2.7.0/kafka_2.13-2.7.0.tgz
tar xzf kafka_*.tgz --strip 1 && rm -rf kafka_*.tgz
chown -R kafka /var/www/appserver/services/kafka
chown -R kafka ${PRODUCT_DIR}/services/kafka
cd -
cat > /etc/systemd/system/zookeeper.service <<END
@ -78,8 +79,8 @@ After=network.target remote-fs.target
[Service]
Type=simple
User=kafka
ExecStart=/bin/sh -c '/var/www/appserver/services/kafka/bin/zookeeper-server-start.sh /var/www/appserver/services/kafka/config/zookeeper.properties > /var/www/appserver/services/kafka/zookeeper.log 2>&1'
ExecStop=/var/www/appserver/services/kafka/bin/zookeeper-server-stop.sh
ExecStart=/bin/sh -c '${PRODUCT_DIR}/services/kafka/bin/zookeeper-server-start.sh ${PRODUCT_DIR}/services/kafka/config/zookeeper.properties > ${PRODUCT_DIR}/services/kafka/zookeeper.log 2>&1'
ExecStop=${PRODUCT_DIR}/services/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
@ -92,8 +93,8 @@ After=zookeeper.service
[Service]
Type=simple
User=kafka
ExecStart=/bin/sh -c '/var/www/appserver/services/kafka/bin/kafka-server-start.sh /var/www/appserver/services/kafka/config/server.properties > /var/www/appserver/services/kafka/kafka.log 2>&1'
ExecStop=/var/www/appserver/services/kafka/bin/kafka-server-stop.sh
ExecStart=/bin/sh -c '${PRODUCT_DIR}/services/kafka/bin/kafka-server-start.sh ${PRODUCT_DIR}/services/kafka/config/server.properties > ${PRODUCT_DIR}/services/kafka/kafka.log 2>&1'
ExecStop=${PRODUCT_DIR}/services/kafka/bin/kafka-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
@ -111,8 +112,9 @@ module_hotfixes=true
END
if [ "$REV" = "8" ]; then
rabbitmq_version="-3.8.12"
cat > /etc/yum.repos.d/rabbitmq-server.repo <<END
cat > /etc/yum.repos.d/rabbitmq-server.repo <<END
[rabbitmq-server]
name=rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/\$basearch
@ -126,6 +128,7 @@ metadata_expire=300
END
fi
${package_manager} -y install yum-plugin-versionlock
${package_manager} versionlock clear
@ -136,20 +139,23 @@ ${package_manager} -y install epel-release \
gcc-c++ \
make \
yarn \
dotnet-sdk-3.1 \
dotnet-sdk-5.0 \
elasticsearch-7.8.1 --enablerepo=elasticsearch \
mysql-server \
nginx \
supervisor \
postgresql \
postgresql-server \
rabbitmq-server \
rabbitmq-server$rabbitmq_version \
redis --enablerepo=remi
postgresql-setup initdb || true
semanage permissive -a httpd_t
if [ ! -e /usr/bin/json ]; then
npm i json -g >/dev/null 2>&1
fi
systemctl daemon-reload
package_services="rabbitmq-server postgresql redis supervisord nginx kafka"
systemctl enable mysqld && systemctl start mysqld
package_services="rabbitmq-server postgresql redis supervisord nginx kafka mysqld"

View File

@ -42,7 +42,7 @@ done
echo "== BACK-END-BUILD =="
cd ${SRC_PATH}
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config ${ARGS}
dotnet restore ASC.Web.sln${ARGS}
dotnet build ASC.Web.sln ${ARGS}
echo "== Build ASC.Thumbnails =="

View File

@ -60,6 +60,8 @@ servers_products_name_backend=(ASC.CRM)
servers_products_name_backend+=(ASC.Files)
servers_products_name_backend+=(ASC.People)
servers_products_name_backend+=(ASC.Projects)
servers_products_name_backend+=(ASC.Calendar)
servers_products_name_backend+=(ASC.Mail)
# Publish server backend products
for i in ${!servers_products_name_backend[@]}; do

View File

@ -1,126 +1,184 @@
#!/bin/bash
PRODUCT="onlyoffice/appserver"
BASE_DIR="/etc/${PRODUCT}"
PATH_TO_CONF="${BASE_DIR}"
STORAGE_ROOT="${BASE_DIR}/data"
LOG_DIR="/var/log/${PRODUCT}"
BASEDIR="$(cd $(dirname $0) && pwd)"
BUILD_PATH="$BASEDIR/modules"
while [ "$1" != "" ]; do
case $1 in
-bp | --buildpath )
if [ "$2" != "" ]; then
BUILD_PATH=$2
shift
fi
;;
-? | -h | --help )
echo " Usage: bash build.sh [PARAMETER] [[PARAMETER], ...]"
echo " Parameters:"
echo " -bp, --buildpath output path"
echo " -?, -h, --help this help"
echo " Examples"
echo " bash build.sh -bp /etc/systemd/system/"
exit 0
;;
* )
echo "Unknown parameter $1" 1>&2
exit 1
;;
esac
shift
done
PRODUCT="appserver"
BASE_DIR="/var/www/${PRODUCT}"
PATH_TO_CONF="/etc/onlyoffice/${PRODUCT}"
STORAGE_ROOT="${PATH_TO_CONF}/data"
LOG_DIR="/var/log/onlyoffice/${PRODUCT}"
DOTNET_RUN="/usr/bin/dotnet"
APP_URLS="http://0.0.0.0"
ENVIRONMENT=" --ENVIRONMENT=production"
service_name=(
SERVICE_NAME=(
api
api_system
api-system
urlshortener
thumbnails
socket
studio_notify
studio-notify
notify
people
people-server
files
files_service
files-services
studio
backup)
SERVICE_PORT=""
SERVICE_NAME=""
WORK_DIR=""
EXEC_FILE=""
CORE=""
backup
storage-encryption
storage-migration
projects-server
telegram-service
crm
calendar
mail
)
reassign_values (){
case $1 in
api )
SERVICE_NAME="$1"
api )
SERVICE_PORT="5000"
WORK_DIR="/var/www/appserver/studio/api/"
WORK_DIR="${BASE_DIR}/studio/api/"
EXEC_FILE="ASC.Web.Api.dll"
;;
api_system )
SERVICE_NAME="$1"
api-system )
SERVICE_PORT="5010"
WORK_DIR="/var/www/appserver/services/apisystem/"
WORK_DIR="${BASE_DIR}/services/ASC.ApiSystem/"
EXEC_FILE="ASC.ApiSystem.dll"
;;
urlshortener )
SERVICE_NAME="$1"
SERVICE_PORT="5015"
WORK_DIR="/services/ASC.UrlShortener/service/"
SERVICE_PORT="9999"
WORK_DIR="${BASE_DIR}/services/ASC.UrlShortener/"
EXEC_FILE="ASC.UrlShortener.Svc.dll"
;;
thumbnails )
SERVICE_NAME="$1"
SERVICE_PORT="5016"
WORK_DIR="/services/ASC.Thumbnails/service/"
thumbnails )
SERVICE_PORT="9800"
WORK_DIR="${BASE_DIR}/services/ASC.Thumbnails/"
EXEC_FILE="ASC.Thumbnails.Svc.dll"
;;
socket )
SERVICE_NAME="$1"
SERVICE_PORT="9999"
WORK_DIR="/services/ASC.Socket.IO/service/"
socket )
SERVICE_PORT="9899"
WORK_DIR="${BASE_DIR}/services/ASC.Socket.IO/"
EXEC_FILE="ASC.Socket.IO.Svc.dll"
;;
studio_notify )
SERVICE_NAME="$1"
studio-notify )
SERVICE_PORT="5006"
WORK_DIR="/var/www/appserver/services/studio.notify/"
WORK_DIR="${BASE_DIR}/services/ASC.Studio.Notify/"
EXEC_FILE="ASC.Studio.Notify.dll"
CORE=" --core:products:folder=/var/www/appserver/products --core:products:subfolder=server "
CORE=" --core:products:folder=${BASE_DIR}/products --core:products:subfolder=server "
;;
notify )
SERVICE_NAME="$1"
SERVICE_PORT="5005"
WORK_DIR="/var/www/appserver/services/notify/"
WORK_DIR="${BASE_DIR}/services/ASC.Notify/"
EXEC_FILE="ASC.Notify.dll"
CORE=" --core:products:folder=/var/www/appserver/products --core:products:subfolder=server "
CORE=" --core:products:folder=${BASE_DIR}/products --core:products:subfolder=server "
;;
people )
SERVICE_NAME="$1"
people-server )
SERVICE_PORT="5004"
WORK_DIR="/var/www/appserver/products/ASC.People/server/"
WORK_DIR="${BASE_DIR}/products/ASC.People/server/"
EXEC_FILE="ASC.People.dll"
;;
files )
SERVICE_NAME="$1"
SERVICE_PORT="5007"
WORK_DIR="/var/www/appserver/products/ASC.Files/server/"
WORK_DIR="${BASE_DIR}/products/ASC.Files/server/"
EXEC_FILE="ASC.Files.dll"
;;
files_service )
SERVICE_NAME="$1"
files-services )
SERVICE_PORT="5009"
WORK_DIR="/var/www/appserver/products/ASC.Files/service/"
WORK_DIR="${BASE_DIR}/products/ASC.Files/service/"
EXEC_FILE="ASC.Files.Service.dll"
CORE=" --core:products:folder=/var/www/appserver/products --core:products:subfolder=server"
CORE=" --core:products:folder=${BASE_DIR}/products --core:products:subfolder=server"
;;
studio )
SERVICE_NAME="$1"
SERVICE_PORT="5003"
WORK_DIR="/var/www/appserver/studio/server/"
WORK_DIR="${BASE_DIR}/studio/server/"
EXEC_FILE="ASC.Web.Studio.dll"
;;
backup )
SERVICE_NAME="$1"
SERVICE_PORT="5012"
WORK_DIR="/var/www/appserver/services/backup/"
WORK_DIR="${BASE_DIR}/services/ASC.Data.Backup/"
EXEC_FILE="ASC.Data.Backup.dll"
CORE=" --core:products:folder=/var/www/appserver/products --core:products:subfolder=server"
CORE=" --core:products:folder=${BASE_DIR}/products --core:products:subfolder=server"
;;
storage-migration )
SERVICE_PORT="5018"
WORK_DIR="${BASE_DIR}/services/ASC.Data.Storage.Migration/"
EXEC_FILE="ASC.Data.Storage.Migration.dll"
;;
storage-encryption )
SERVICE_PORT="5019"
WORK_DIR="${BASE_DIR}/services/ASC.Data.Storage.Encryption/"
EXEC_FILE="ASC.Data.Storage.Encryption.dll"
;;
projects-server )
SERVICE_PORT="5020"
WORK_DIR="${BASE_DIR}/products/ASC.Projects/server/"
EXEC_FILE="ASC.Projects.dll"
;;
telegram-service )
SERVICE_PORT="51702"
WORK_DIR="${BASE_DIR}/services/ASC.TelegramService/"
EXEC_FILE="ASC.TelegramService.dll"
;;
crm )
SERVICE_PORT="5021"
WORK_DIR="${BASE_DIR}/products/ASC.CRM/server/"
EXEC_FILE="ASC.CRM.dll"
;;
calendar )
SERVICE_PORT="5023"
WORK_DIR="${BASE_DIR}/products/ASC.Calendar/server/"
EXEC_FILE="ASC.Calendar.dll"
;;
mail )
SERVICE_PORT="5022"
WORK_DIR="${BASE_DIR}/products/ASC.Mail/server/"
EXEC_FILE="ASC.Mail.dll"
;;
esac
EXEC_START="${DOTNET_RUN} ${WORK_DIR}${EXEC_FILE} --urls=${APP_URLS}:${SERVICE_PORT} --pathToConf=${PATH_TO_CONF} --'\$STORAGE_ROOT'=${STORAGE_ROOT} --log:dir=${LOG_DIR} --log:name=${SERVICE_NAME}${CORE}${ENVIRONMENT}"
SERVICE_NAME="$1"
EXEC_START="${DOTNET_RUN} ${WORK_DIR}${EXEC_FILE} --urls=${APP_URLS}:${SERVICE_PORT} --pathToConf=${PATH_TO_CONF} \
--'\$STORAGE_ROOT'=${STORAGE_ROOT} --log:dir=${LOG_DIR} --log:name=${SERVICE_NAME}${CORE}${ENVIRONMENT}"
CORE=""
}
write_to_file () {
sed -i -e 's#${SERVICE_NAME}#'$SERVICE_NAME'#g' -e 's#${WORK_DIR}#'$WORK_DIR'#g' -e \
"s#\${EXEC_START}#$EXEC_START#g" modules/appserver-${service_name[$i]}.service
"s#\${EXEC_START}#$EXEC_START#g" $BUILD_PATH/${PRODUCT}-${SERVICE_NAME[$i]}.service
}
mkdir -p modules
mkdir -p $BUILD_PATH
for i in ${!service_name[@]}; do
cp service ./modules/appserver-${service_name[$i]}.service
reassign_values "${service_name[$i]}"
for i in ${!SERVICE_NAME[@]}; do
cp $BASEDIR/service $BUILD_PATH/${PRODUCT}-${SERVICE_NAME[$i]}.service
reassign_values "${SERVICE_NAME[$i]}"
write_to_file $i
done

View File

@ -47,10 +47,12 @@
# service host #
API_SYSTEM_HOST=${CONTAINER_PREFIX}api-system
BACKUP_HOST=${CONTAINER_PREFIX}backup
CALENDAR_HOST=${CONTAINER_PREFIX}calendar
CRM_HOST=${CONTAINER_PREFIX}crm
STORAGE_ENCRYPTION_HOST=${CONTAINER_PREFIX}storage-encryption
FILES_HOST=${CONTAINER_PREFIX}files
FILES_SERVICES_HOST=${CONTAINER_PREFIX}files-services
MAIL_HOST=${CONTAINER_PREFIX}mail
STORAGE_MIGRATION_HOST=${CONTAINER_PREFIX}storage-migration
NOTIFY_HOST=${CONTAINER_PREFIX}notify
PEOPLE_SERVER_HOST=${CONTAINER_PREFIX}people-server
@ -68,9 +70,11 @@
SERVICE_API_SYSTEM=${API_SYSTEM_HOST}:${SERVICE_PORT}
SERVICE_BACKUP=${BACKUP_HOST}:${SERVICE_PORT}
SERVICE_CRM=${CRM_HOST}:${SERVICE_PORT}
SERVICE_CALENDAR=${CALENDAR_HOST}:${SERVICE_PORT}
SERVICE_STORAGE_ENCRYPTION=${STORAGE_ENCRYPTION_HOST}:${SERVICE_PORT}
SERVICE_FILES=${FILES_HOST}:${SERVICE_PORT}
SERVICE_FILES_SERVICES=${FILES_SERVICES_HOST}:${SERVICE_PORT}
SERVICE_MAIL=${MAIL_HOST}:${SERVICE_PORT}
SERVICE_STORAGE_MIGRATION=${STORAGE_MIGRATION_HOST}:${SERVICE_PORT}
SERVICE_NOTIFY=${NOTIFY_HOST}:${SERVICE_PORT}
SERVICE_PEOPLE_SERVER=${PEOPLE_SERVER_HOST}:${SERVICE_PORT}

View File

@ -140,7 +140,7 @@ RUN cd /app/onlyoffice/src/ && \
cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && \
dotnet restore ASC.Web.sln && \
dotnet build -r linux-x64 ASC.Web.sln && \
cd products/ASC.People/Server && \
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.People/server && \

View File

@ -44,12 +44,20 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
cd ${SRC_PATH}/build/install/common/ && \
bash build-frontend.sh -sp ${SRC_PATH} && \
bash build-backend.sh -sp ${SRC_PATH} -ar "--disable-parallel" && \
bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel"
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel" && \
rm -rf ${SRC_PATH}/common/* && \
rm -rf ${SRC_PATH}/web/ASC.Web.Core/* && \
rm -rf ${SRC_PATH}/web/ASC.Web.Studio/* && \
rm -rf ${SRC_PATH}/products/ASC.Calendar/Server/* && \
rm -rf ${SRC_PATH}/products/ASC.CRM/Server/* && \
rm -rf ${SRC_PATH}/products/ASC.Files/Server/* && \
rm -rf ${SRC_PATH}/products/ASC.Files/Service/* && \
rm -rf ${SRC_PATH}/products/ASC.Mail/Server/* && \
rm -rf ${SRC_PATH}/products/ASC.People/Server/* && \
rm -rf ${SRC_PATH}/products/ASC.Projects/Server/*
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
RUN rm -rf /var/lib/apt/lists/*
@ -88,6 +96,10 @@ ENTRYPOINT ["./docker-entrypoint.sh"]
FROM nginx AS web
ARG SRC_PATH
ARG BUILD_PATH
ARG COUNT_WORKER_CONNECTIONS=1024
ENV DNS_NAMESERVER=127.0.0.11 \
COUNT_WORKER_CONNECTIONS=$COUNT_WORKER_CONNECTIONS \
MAP_HASH_BUCKET_SIZE=""
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
apt-get -y update && \
@ -107,8 +119,12 @@ COPY --from=base ${SRC_PATH}/web/ASC.Web.Login/dist ${BUILD_PATH}/studio/login
COPY --from=base ${SRC_PATH}/products/ASC.People/Client/dist ${BUILD_PATH}/products/ASC.People/client
COPY --from=base ${SRC_PATH}/products/ASC.Projects/Client/dist ${BUILD_PATH}/products/ASC.Projects/client
COPY --from=base ${SRC_PATH}/web/ASC.Web.Client/dist ${BUILD_PATH}/studio/client
COPY --from=base ${SRC_PATH}/products/ASC.Calendar/Client/dist ${BUILD_PATH}/products/ASC.Calendar/client
COPY --from=base ${SRC_PATH}/products/ASC.Mail/Client/dist ${BUILD_PATH}/products/ASC.Mail/client
COPY /config/nginx/templates/upstream.conf.template /etc/nginx/templates/upstream.conf.template
COPY /config/nginx/templates/nginx.conf.template /etc/nginx/nginx.conf.template
COPY prepare-nginx-proxy.sh /docker-entrypoint.d/prepare-nginx-proxy.sh
# add defualt user and group for no-root run
RUN chown nginx:nginx /etc/nginx/* -R && \
@ -122,11 +138,10 @@ RUN chown nginx:nginx /etc/nginx/* -R && \
sed -i 's/localhost:5020/$service_projects_server/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5000/$service_api/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5003/$service_studio/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5023/$service_calendar/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:5022/$service_mail/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/localhost:9999/$service_urlshortener/' /etc/nginx/conf.d/onlyoffice.conf && \
sed -i 's/172.*/$document_server;/' /etc/nginx/conf.d/onlyoffice.conf && \
# configute the image nginx whith less privileged https://hub.docker.com/_/nginx
sed -i 's/pid.*nginx.pid;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf && \
sed -i 's/http.*{/http {\n client_body_temp_path \/tmp\/client_temp;\n proxy_temp_path \/tmp\/proxy_temp_path;\n fastcgi_temp_path \/tmp\/fastcgi_temp;\n uwsgi_temp_path \/tmp\/uwsgi_temp;\n scgi_temp_path \/tmp\/scgi_temp;/' /etc/nginx/nginx.conf
sed -i 's/172.*/$document_server;/' /etc/nginx/conf.d/onlyoffice.conf
## ASC.ApiSystem ##
FROM builder AS api_system
@ -146,6 +161,15 @@ COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Data.B
CMD ["ASC.Data.Backup.dll", "ASC.Data.Backup", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## ASC.Calendar ##
FROM builder AS calendar
WORKDIR ${BUILD_PATH}/products/ASC.Calendar/server/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/products/ASC.Calendar/server/ .
CMD ["ASC.Calendar.dll", "ASC.Calendar"]
## ASC.CRM ##
FROM builder AS crm
WORKDIR ${BUILD_PATH}/products/ASC.CRM/server/
@ -182,6 +206,15 @@ COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Files.
CMD ["ASC.Files.Service.dll", "ASC.Files.Service", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
## ASC.Mail ##
FROM builder AS mail
WORKDIR ${BUILD_PATH}/products/ASC.Mail/server/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/products/ASC.Mail/server/ .
CMD ["ASC.Mail.dll", "ASC.Mail"]
## ASC.Data.Storage.Migration ##
FROM builder AS data_storage_migration
WORKDIR ${BUILD_PATH}/services/storage.migration/service/
@ -283,3 +316,30 @@ COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Web.Studio/service/ .
CMD ["ASC.Web.Studio.dll", "ASC.Web.Studio"]
## image for k8s bin-share ##
FROM busybox:latest AS bin_share
RUN mkdir -p /app/appserver/ASC.Files/server && \
mkdir -p /app/appserver/ASC.People/server/ && \
mkdir -p /app/appserver/ASC.CRM/server/ && \
mkdir -p /app/appserver/ASC.Projects/server/ && \
mkdir -p /app/appserver/ASC.Calendar/server/ && \
mkdir -p /app/appserver/ASC.Mail/server/ && \
addgroup --system --gid 107 onlyoffice && \
adduser -u 104 onlyoffice --home /var/www/onlyoffice --system -G onlyoffice
COPY bin-share-docker-entrypoint.sh /app/docker-entrypoint.sh
COPY --from=base /var/www/products/ASC.Files/server/ /app/appserver/ASC.Files/server/
COPY --from=base /var/www/products/ASC.People/server/ /app/appserver/ASC.People/server/
COPY --from=base /var/www/products/ASC.CRM/server/ /app/appserver/ASC.CRM/server/
COPY --from=base /var/www/products/ASC.Projects/server/ /app/appserver/ASC.Projects/server/
COPY --from=base /var/www/products/ASC.Calendar/server/ /app/appserver/ASC.Calendar/server/
COPY --from=base /var/www/products/ASC.Mail/server/ /app/appserver/ASC.Mail/server/
ENTRYPOINT ["./app/docker-entrypoint.sh"]
## image for k8s wait-bin-share ##
FROM busybox:latest AS wait_bin_share
RUN mkdir /app
COPY wait-bin-share-docker-entrypoint.sh /app/docker-entrypoint.sh
ENTRYPOINT ["./app/docker-entrypoint.sh"]

View File

@ -29,6 +29,9 @@ x-service:
- people_data:/var/www/products/ASC.People/server/
- crm_data:/var/www/products/ASC.CRM/server/
- project_data:/var/www/products/ASC.Projects/server/
- calendar_data:/var/www/products/ASC.Calendar/server/
- mail_data:/var/www/products/ASC.Mail/server/
services:
onlyoffice-elasticsearch:
@ -95,6 +98,11 @@ services:
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
container_name: ${BACKUP_HOST}
onlyoffice-calendar:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-calendar:${SRV_VERSION}"
container_name: ${CALENDAR_HOST}
onlyoffice-crm:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-crm:${SRV_VERSION}"
@ -115,6 +123,11 @@ services:
image: "${REPO}/${STATUS}appserver-files-services:${SRV_VERSION}"
container_name: ${FILES_SERVICES_HOST}
onlyoffice-mail:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-mail:${SRV_VERSION}"
container_name: ${MAIL_HOST}
onlyoffice-storage-migration:
<<: *x-service-base
image: "${REPO}/${STATUS}appserver-storage-migration:${SRV_VERSION}"
@ -187,10 +200,12 @@ services:
depends_on:
- onlyoffice-api-system
- onlyoffice-backup
- onlyoffice-calendar
- onlyoffice-crm
- onlyoffice-storage-encryption
- onlyoffice-files
- onlyoffice-files-services
- onlyoffice-mail
- onlyoffice-storage-migration
- onlyoffice-people-server
- onlyoffice-projects-server
@ -204,10 +219,12 @@ services:
environment:
- SERVICE_API_SYSTEM=${SERVICE_API_SYSTEM}
- SERVICE_BACKUP=${SERVICE_BACKUP}
- SERVICE_CALENDAR=${SERVICE_CALENDAR}
- SERVICE_CRM=${SERVICE_CRM}
- SERVICE_STORAGE_ENCRYPTION=${SERVICE_STORAGE_ENCRYPTION}
- SERVICE_FILES=${SERVICE_FILES}
- SERVICE_FILES_SERVICES=${SERVICE_FILES_SERVICES}
- SERVICE_MAIL=${SERVICE_MAIL}
- SERVICE_STORAGE_MIGRATION=${SERVICE_STORAGE_MIGRATION}
- SERVICE_NOTIFY=${SERVICE_NOTIFY}
- SERVICE_PEOPLE_SERVER=${SERVICE_PEOPLE_SERVER}
@ -240,3 +257,5 @@ volumes:
people_data:
crm_data:
project_data:
calendar_data:
mail_data:

View File

@ -0,0 +1,14 @@
#!/bin/sh
echo "##################################################################"
echo "##### Run preparation for launching AppServer services #####"
echo "##################################################################"
cp -r /app/appserver/ASC.Files/server/* /var/www/products/ASC.Files/server/
cp -r /app/appserver/ASC.People/server/* /var/www/products/ASC.People/server/
cp -r /app/appserver/ASC.CRM/server/* /var/www/products/ASC.CRM/server/
cp -r /app/appserver/ASC.Projects/server/* /var/www/products/ASC.Projects/server/
cp -r /app/appserver/ASC.Calendar/server/* /var/www/products/ASC.Calendar/server/
cp -r /app/appserver/ASC.Mail/server/* /var/www/products/ASC.Mail/server/
chown -R onlyoffice:onlyoffice /var/www/products/
echo "Ok" > /var/www/products/ASC.Files/server/status.txt
echo "Preparation for launching AppServer services is complete"

View File

@ -15,6 +15,13 @@ services:
target: backup
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
onlyoffice-calendar:
build:
context: ./
dockerfile: "${DOCKERFILE}"
target: calendar
image: "${REPO}/${STATUS}appserver-calendar:${SRV_VERSION}"
onlyoffice-crm:
build:
context: ./
@ -43,6 +50,13 @@ services:
target: files_services
image: "${REPO}/${STATUS}appserver-files-services:${SRV_VERSION}"
onlyoffice-mail:
build:
context: ./
dockerfile: "${DOCKERFILE}"
target: mail
image: "${REPO}/${STATUS}appserver-mail:${SRV_VERSION}"
onlyoffice-storage-migration:
build:
context: ./
@ -119,7 +133,21 @@ services:
dockerfile: "${DOCKERFILE}"
target: studio
image: "${REPO}/${STATUS}appserver-studio:${SRV_VERSION}"
onlyoffice-bin-share:
build:
context: ./
dockerfile: "${DOCKERFILE}"
target: bin_share
image: "${REPO}/${STATUS}appserver-bin-share:${SRV_VERSION}"
onlyoffice-wait-bin-share:
build:
context: ./
dockerfile: "${DOCKERFILE}"
target: wait_bin_share
image: "${REPO}/${STATUS}appserver-wait-bin-share:${SRV_VERSION}"
onlyoffice-proxy:
build:
context: ./

View File

@ -0,0 +1,34 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /tmp/nginx.pid;
events {
worker_connections $COUNT_WORKER_CONNECTIONS;
}
http {
$MAP_HASH_BUCKET_SIZE
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}

View File

@ -1,4 +1,4 @@
resolver 127.0.0.11 valid=30s;
resolver $DNS_NAMESERVER valid=30s;
map $SERVICE_API_SYSTEM $service_api_system {
volatile;
@ -10,6 +10,11 @@ map $SERVICE_BACKUP $service_backup {
$SERVICE_BACKUP $SERVICE_BACKUP;
}
map $SERVICE_CALENDAR $service_calendar {
volatile;
$SERVICE_CALENDAR $SERVICE_CALENDAR;
}
map $SERVICE_CRM $service_crm {
volatile;
$SERVICE_CRM $SERVICE_CRM;
@ -30,6 +35,11 @@ map $SERVICE_FILES_SERVICES $service_files_services {
$SERVICE_FILES_SERVICES $SERVICE_FILES_SERVICES;
}
map $SERVICE_MAIL $service_mail {
volatile;
$SERVICE_MAIL $SERVICE_MAIL;
}
map $SERVICE_STORAGE_MIGRATION $service_storage_migration {
volatile;
$SERVICE_STORAGE_MIGRATION $SERVICE_STORAGE_MIGRATION;

View File

@ -29,6 +29,8 @@ x-service:
- people_data:/var/www/products/ASC.People/server/
- crm_data:/var/www/products/ASC.CRM/server/
- project_data:/var/www/products/ASC.Projects/server/
- calendar_data:/var/www/products/ASC.Calendar/server/
- mail_data:/var/www/products/ASC.Mail/server/
services:
onlyoffice-notify:
@ -47,3 +49,5 @@ volumes:
people_data:
crm_data:
project_data:
calendar_data:
mail_data:

View File

@ -0,0 +1,2 @@
#!/bin/sh
envsubst '$MAP_HASH_BUCKET_SIZE,$COUNT_WORKER_CONNECTIONS' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf

View File

@ -0,0 +1,7 @@
#!/bin/sh
until cat /var/www/products/status.txt
do
echo "waiting for the storage to be ready"
sleep 5
done

View File

@ -1,4 +1,7 @@
%define debug_package %{nil}
%global product appserver
%global buildpath %{_var}/www/%{product}
%global sourcename AppServer-%GIT_BRANCH
Name: onlyoffice-appserver
Summary: Business productivity tools.
Version: %version
@ -11,24 +14,31 @@ ExclusiveArch: x86_64
AutoReq: no
AutoProv: no
License: GPLv3
Source0: https://github.com/ONLYOFFICE/appserver/archive/%GIT_BRANCH.tar.gz
Source0: https://github.com/ONLYOFFICE/%{product}/archive/%GIT_BRANCH.tar.gz
BuildRequires: nodejs >= 12.0
BuildRequires: yarn
BuildRequires: libgdiplus
BuildRequires: dotnet-sdk-3.1
BuildRequires: dotnet-sdk-5.0
Requires: %name-api-system
Requires: %name-calendar
Requires: %name-crm
Requires: %name-backup
Requires: %name-files_services
Requires: %name-notify
Requires: %name-storage-encryption
Requires: %name-storage-migration
Requires: %name-files
Requires: %name-api_system
Requires: %name-proxy
Requires: %name-people.server
Requires: %name-urlshortener
Requires: %name-thumbnails
Requires: %name-studio
Requires: %name-studio.notify
Requires: %name-files-services
Requires: %name-mail
Requires: %name-notify
Requires: %name-people-server
Requires: %name-projects-server
Requires: %name-socket
Requires: %name-studio-notify
Requires: %name-telegram-service
Requires: %name-thumbnails
Requires: %name-urlshortener
Requires: %name-api
Requires: %name-studio
Requires: %name-proxy
AutoReqProv: no
%description
App Server is a platform for building your own online office by connecting ONLYOFFICE modules packed as separate apps.
@ -37,8 +47,8 @@ App Server is a platform for building your own online office by connecting ONLYO
%prep
rm -rf %{_rpmdir}/%{_arch}/%{name}-*
%setup -n AppServer-%GIT_BRANCH
rm -rf %{_rpmdir}/%{_arch}/%{product}-*
%setup -n %{sourcename}
%include build.spec
@ -55,7 +65,7 @@ getent passwd onlyoffice >/dev/null || useradd -r -g onlyoffice -s /sbin/nologin
%post
chmod +x %{_bindir}/appserver-configuration.sh
chmod +x %{_bindir}/%{product}-configuration.sh
%preun

View File

@ -1,99 +1,9 @@
%build
cd %{_builddir}/AppServer-%GIT_BRANCH/build/install/common/systemd/
bash build.sh
bash build/install/common/systemd/build.sh
cd %{_builddir}/AppServer-%GIT_BRANCH/
yarn install --cwd web/ASC.Web.Components --frozen-lockfile > build/ASC.Web.Components.log
yarn pack --cwd web/ASC.Web.Components
cd %{_builddir}/AppServer-%GIT_BRANCH/
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz)
yarn remove asc-web-components --cwd web/ASC.Web.Common --peer
yarn add file:../../$component --cwd web/ASC.Web.Common --cache-folder ../../yarn --peer
yarn install --cwd web/ASC.Web.Common --frozen-lockfile > build/ASC.Web.Common.log
yarn pack --cwd web/ASC.Web.Common
bash build/install/common/build-frontend.sh --srcpath %{_builddir}/%{sourcename}
bash build/install/common/build-backend.sh --srcpath %{_builddir}/%{sourcename}
bash build/install/common/publish-backend.sh --srcpath %{_builddir}/%{sourcename} --arguments "--disable-parallel"
cd %{_builddir}/AppServer-%GIT_BRANCH/
npm run-script build:storybook --prefix web/ASC.Web.Components
cd %{_builddir}/AppServer-%GIT_BRANCH/
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz)
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz)
yarn remove asc-web-components asc-web-common --cwd web/ASC.Web.Client
yarn add ../../$component --cwd web/ASC.Web.Client --cache-folder ../../yarn
yarn add ../../$common --cwd web/ASC.Web.Client --cache-folder ../../yarn
yarn install --cwd web/ASC.Web.Client --frozen-lockfile || (cd web/ASC.Web.Client \
npm i && cd ../../)
npm run-script build --prefix web/ASC.Web.Client
cd %{_builddir}/AppServer-%GIT_BRANCH/
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz)
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz)
yarn remove asc-web-components asc-web-common --cwd products/ASC.Files/Client
yarn add ../../../$component --cwd products/ASC.Files/Client --cache-folder ../../../yarn
yarn add ../../../$common --cwd products/ASC.Files/Client --cache-folder ../../../yarn
yarn install --cwd products/ASC.Files/Client --frozen-lockfile || (cd products/ASC.Files/Client \
npm i && cd ../../../)
npm run-script build --prefix products/ASC.Files/Client
cd %{_builddir}/AppServer-%GIT_BRANCH/
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz)
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz)
yarn remove asc-web-components asc-web-common --cwd products/ASC.People/Client
yarn add ../../../$component --cwd products/ASC.People/Client --cache-folder ../../../yarn
yarn add ../../../$common --cwd products/ASC.People/Client --cache-folder ../../../yarn
yarn install --cwd products/ASC.People/Client --frozen-lockfile || (cd products/ASC.People/Client \
npm i && cd ../../../)
npm run-script build --prefix products/ASC.People/Client
cd %{_builddir}/AppServer-%GIT_BRANCH/
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config
dotnet build -r linux-x64 ASC.Web.sln
cd products/ASC.People/Server
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/products/ASC.People/server
cd ../../../
cd products/ASC.Files/Server
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/products/ASC.Files/server
cp -avrf DocStore %{_builddir}%{_var}/www/appserver/products/ASC.Files/server/
cd ../../../
cd products/ASC.Files/Service
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/products/ASC.Files/service
cd ../../../
cd web/ASC.Web.Api
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/studio/api
cd ../../
cd web/ASC.Web.Studio
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/studio/server
cd ../../
cd common/services/ASC.Data.Backup
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/services/backup
cd ../../../
cd common/services/ASC.Notify
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/services/notify
cd ../../../
cd common/services/ASC.ApiSystem
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/services/apisystem
cd ../../../
cd common/services/ASC.Thumbnails.Svc
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}/services/thumb/service
cd ../../../
yarn install --cwd common/ASC.Thumbnails --frozen-lockfile
cd common/services/ASC.UrlShortener.Svc
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}/services/urlshortener/service
cd ../../../
yarn install --cwd common/ASC.UrlShortener --frozen-lockfile
cd common/services/ASC.Socket.IO.Svc
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}/services/socket/service
cd ../../../
yarn install --cwd common/ASC.Socket.IO --frozen-lockfile
cd common/services/ASC.Studio.Notify
dotnet add ASC.Studio.Notify.csproj reference ../../../products/ASC.People/Server/ASC.People.csproj ../../../products/ASC.Files/Server/ASC.Files.csproj
dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/services/studio.notify
cd ../../../
sed -i "s@var/www@var/www/appserver@" config/nginx/onlyoffice-*.conf
sed -i "s@var/www@var/www/%{product}@" config/nginx/onlyoffice-*.conf && sed -i "s@var/www@var/www/%{product}@" config/nginx/includes/onlyoffice-*.conf

View File

@ -3,142 +3,305 @@
%files api
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/studio/api/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-api.service
%dir %{_var}/www/appserver/studio
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/products/ASC.Files/server/
%{buildpath}/studio/api/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-api.service
%dir %{buildpath}/studio/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files backup
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/services/backup/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-backup.service
%dir %{_var}/www/appserver/services/
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/products/ASC.Files/server/
%{buildpath}/services/ASC.Data.Backup/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-backup.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files common
%defattr(-, onlyoffice, onlyoffice, -)
%config %{_sysconfdir}/onlyoffice/appserver/
%{_var}/log/onlyoffice/appserver/
%{_var}/www/appserver/sql/
%config %{_sysconfdir}/onlyoffice/%{product}/
%{_var}/log/onlyoffice/%{product}/
%{buildpath}/sql/
%dir %{_sysconfdir}/onlyoffice/
%dir %{_var}/log/onlyoffice/
%files files_services
%files files-services
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/products/ASC.Files/service/
%{_sysconfdir}/systemd/system/appserver-files_service.service
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.Files/
%{buildpath}/products/ASC.Files/service/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.People/server/ASC.People*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-files-services.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files notify
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/services/notify/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-notify.service
%dir %{_var}/www/appserver/services/
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/products/ASC.Files/server/
%{buildpath}/services/ASC.Notify/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-notify.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files files
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/products/ASC.Files/server/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_sysconfdir}/systemd/system/appserver-files.service
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%{buildpath}/products/ASC.Files/server/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-files.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files api_system
%files api-system
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/services/apisystem/
%{_sysconfdir}/systemd/system/appserver-api_system.service
%dir %{_var}/www/appserver/services/
%{buildpath}/services/ASC.ApiSystem/
%{_sysconfdir}/systemd/system/%{product}-api-system.service
%dir %{buildpath}/services/
%files proxy
%defattr(-, onlyoffice, onlyoffice, -)
%{_sysconfdir}/nginx/includes/*
%{_sysconfdir}/nginx/conf.d/*
%{_var}/www/appserver/story/
%{_var}/www/appserver/products/ASC.People/client/
%{_var}/www/appserver/products/ASC.Files/client/
%{_var}/www/appserver/public/
%{_var}/www/appserver/studio/client/
%dir %{_var}/www/appserver/studio/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.Files/
%{buildpath}/public/
%{buildpath}/studio/client/
%{buildpath}/studio/login
%{buildpath}/products/ASC.People/client/
%{buildpath}/products/ASC.Files/client/
%{buildpath}/products/ASC.Files/editor/
%{buildpath}/products/ASC.CRM/client/
%{buildpath}/products/ASC.Projects/client
%{buildpath}/products/ASC.Calendar/client/
%{buildpath}/products/ASC.Mail/client
%dir %{buildpath}/studio/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Calendar/
%dir %{buildpath}/products/ASC.Mail/
%files studio.notify
%files studio-notify
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/services/studio.notify/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-studio_notify.service
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/services/
%{buildpath}/services/ASC.Studio.Notify/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-studio-notify.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files people.server
%files people-server
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/products/ASC.People/server/
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-people.service
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/products/ASC.Files/server/
%{buildpath}/products/ASC.People/server/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-people-server.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files urlshortener
%defattr(-, onlyoffice, onlyoffice, -)
/services/ASC.UrlShortener/
%{_sysconfdir}/systemd/system/appserver-urlshortener.service
%dir /services/
%dir /services/ASC.UrlShortener/
%dir /services/ASC.UrlShortener/service
%{buildpath}/services/ASC.UrlShortener/
%{_sysconfdir}/systemd/system/%{product}-urlshortener.service
%dir %{buildpath}/services/
%files thumbnails
%defattr(-, onlyoffice, onlyoffice, -)
/services/ASC.Thumbnails/
%{_sysconfdir}/systemd/system/appserver-thumbnails.service
%dir /services/
%dir /services/ASC.Thumbnails/
%dir /services/ASC.Thumbnails/service
%{buildpath}/services/ASC.Thumbnails/
%{_sysconfdir}/systemd/system/%{product}-thumbnails.service
%dir %{buildpath}/services/
%files socket
%defattr(-, onlyoffice, onlyoffice, -)
/services/ASC.Socket.IO/
%{_sysconfdir}/systemd/system/appserver-socket.service
%dir /services/
%dir /services/ASC.Socket.IO/
%dir /services/ASC.Socket.IO/service
%{buildpath}/services/ASC.Socket.IO/
%{buildpath}/products/ASC.Files/server/
%{buildpath}/products/ASC.People/server/
%{buildpath}/products/ASC.CRM/server/
%{buildpath}/products/ASC.Projects/server/
%{_sysconfdir}/systemd/system/%{product}-socket.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.Projects/
%files studio
%defattr(-, onlyoffice, onlyoffice, -)
%{_var}/www/appserver/studio/server/
%{_var}/www/appserver/products/ASC.People/server/ASC.People.dll
%{_var}/www/appserver/products/ASC.Files/server/ASC.Files*.dll
%{_sysconfdir}/systemd/system/appserver-studio.service
%dir %{_var}/www/appserver/studio/
%dir %{_var}/www/appserver/products/
%dir %{_var}/www/appserver/products/ASC.People/
%dir %{_var}/www/appserver/products/ASC.People/server/
%dir %{_var}/www/appserver/products/ASC.Files/
%dir %{_var}/www/appserver/products/ASC.Files/server/
%{buildpath}/studio/server/
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-studio.service
%dir %{buildpath}/studio/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files storage-encryption
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.Data.Storage.Encryption/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-storage-encryption.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server
%files storage-migration
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.Data.Storage.Migration/
%{buildpath}/products/ASC.Files/server/
%{buildpath}/products/ASC.People/server/
%{buildpath}/products/ASC.CRM/server/
%{buildpath}/products/ASC.Projects/server/
%{_sysconfdir}/systemd/system/%{product}-storage-migration.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.Projects/
%files projects-server
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/products/ASC.Projects/server/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{_sysconfdir}/systemd/system/%{product}-projects-server.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%files telegram-service
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/services/ASC.TelegramService/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.CRM/server/ASC.CRM*.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-telegram-service.service
%dir %{buildpath}/services/
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.People/
%dir %{buildpath}/products/ASC.People/server/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.CRM/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files crm
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/products/ASC.CRM/server/
%{buildpath}/products/ASC.Files/server/ASC.Files*.dll
%{buildpath}/products/ASC.People/server/ASC.People.dll
%{buildpath}/products/ASC.Projects/server/ASC.Projects*.dll
%{_sysconfdir}/systemd/system/%{product}-crm.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.CRM/
%dir %{buildpath}/products/ASC.Files/
%dir %{buildpath}/products/ASC.Files/server/
%dir %{buildpath}/products/ASC.Projects/
%dir %{buildpath}/products/ASC.Projects/server/
%files calendar
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/products/ASC.Calendar/server/
%{_sysconfdir}/systemd/system/%{product}-calendar.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Calendar/
%files mail
%defattr(-, onlyoffice, onlyoffice, -)
%{buildpath}/products/ASC.Mail/server/
%{_sysconfdir}/systemd/system/%{product}-mail.service
%dir %{buildpath}/products/
%dir %{buildpath}/products/ASC.Mail/

View File

@ -1,53 +1,77 @@
%install
mkdir -p "%{buildroot}%{_bindir}/"
mkdir -p "%{buildroot}%{_sysconfdir}/nginx/conf.d/"
mkdir -p "%{buildroot}%{_sysconfdir}/nginx/includes"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/appserver/"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/appserver/data"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/appserver/.private/"
mkdir -p "%{buildroot}%{_sysconfdir}/nginx/includes/"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/.private/"
mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/data/"
mkdir -p "%{buildroot}%{_sysconfdir}/systemd/system/"
mkdir -p "%{buildroot}%{_var}/log/onlyoffice/appserver/"
mkdir -p "%{buildroot}%{_var}/www/appserver/products/ASC.Files/client/"
mkdir -p "%{buildroot}%{_var}/www/appserver/products/ASC.Files/server/"
mkdir -p "%{buildroot}%{_var}/www/appserver/products/ASC.Files/service/"
mkdir -p "%{buildroot}%{_var}/www/appserver/products/ASC.People/client/"
mkdir -p "%{buildroot}%{_var}/www/appserver/products/ASC.People/server/"
mkdir -p "%{buildroot}%{_var}/www/appserver/public/"
mkdir -p "%{buildroot}%{_var}/www/appserver/services/apisystem/"
mkdir -p "%{buildroot}%{_var}/www/appserver/services/backup/"
mkdir -p "%{buildroot}%{_var}/www/appserver/services/notify/"
mkdir -p "%{buildroot}%{_var}/www/appserver/services/studio.notify/"
mkdir -p "%{buildroot}%{_var}/www/appserver/sql/"
mkdir -p "%{buildroot}%{_var}/www/appserver/story/"
mkdir -p "%{buildroot}%{_var}/www/appserver/studio/api/"
mkdir -p "%{buildroot}%{_var}/www/appserver/studio/client/"
mkdir -p "%{buildroot}%{_var}/www/appserver/studio/server/"
mkdir -p "%{buildroot}/services/ASC.Socket.IO/service"
mkdir -p "%{buildroot}/services/ASC.Thumbnails/service/"
mkdir -p "%{buildroot}/services/ASC.UrlShortener/service/"
cp -rf %{_builddir}%{_var}/www/appserver/products/ASC.Files/server/* "%{buildroot}%{_var}/www/appserver/products/ASC.Files/server/"
cp -rf %{_builddir}%{_var}/www/appserver/products/ASC.Files/service/* "%{buildroot}%{_var}/www/appserver/products/ASC.Files/service/"
cp -rf %{_builddir}%{_var}/www/appserver/products/ASC.People/server/* "%{buildroot}%{_var}/www/appserver/products/ASC.People/server/"
cp -rf %{_builddir}%{_var}/www/appserver/services/apisystem/* "%{buildroot}%{_var}/www/appserver/services/apisystem/"
cp -rf %{_builddir}%{_var}/www/appserver/services/backup/* "%{buildroot}%{_var}/www/appserver/services/backup/"
cp -rf %{_builddir}%{_var}/www/appserver/services/notify/* "%{buildroot}%{_var}/www/appserver/services/notify/"
cp -rf %{_builddir}%{_var}/www/appserver/services/studio.notify/* "%{buildroot}%{_var}/www/appserver/services/studio.notify/"
cp -rf %{_builddir}%{_var}/www/appserver/studio/api/* "%{buildroot}%{_var}/www/appserver/studio/api"
cp -rf %{_builddir}%{_var}/www/appserver/studio/server/* "%{buildroot}%{_var}/www/appserver/studio/server/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/build/install/docker/config/*.sql "%{buildroot}%{_var}/www/appserver/sql"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/build/install/rpm/*.sh "%{buildroot}%{_bindir}/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/build/install/common/systemd/modules/* "%{buildroot}%{_sysconfdir}/systemd/system"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/common/ASC.Socket.IO/* "%{buildroot}/services/ASC.Socket.IO"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/common/ASC.Thumbnails/* "%{buildroot}/services/ASC.Thumbnails"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/common/ASC.UrlShortener/* "%{buildroot}/services/ASC.UrlShortener"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/config/* "%{buildroot}%{_sysconfdir}/onlyoffice/appserver/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/config/nginx/includes/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/includes/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/config/nginx/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/conf.d/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/products/ASC.Files/Client/build/* "%{buildroot}%{_var}/www/appserver/products/ASC.Files/client"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/products/ASC.People/Client/build/* "%{buildroot}%{_var}/www/appserver/products/ASC.People/client"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/public/* "%{buildroot}%{_var}/www/appserver/public/"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/web/ASC.Web.Client/build/* "%{buildroot}%{_var}/www/appserver/studio/client"
cp -rf %{_builddir}/AppServer-%GIT_BRANCH/web/ASC.Web.Components/storybook-static/* "%{buildroot}%{_var}/www/appserver/story/"
cp -rf %{_builddir}/services/socket/service/* "%{buildroot}/services/ASC.Socket.IO/service/"
cp -rf %{_builddir}/services/thumb/service/* "%{buildroot}/services/ASC.Thumbnails/service/"
cp -rf %{_builddir}/services/urlshortener/service/* "%{buildroot}/services/ASC.UrlShortener/service/"
mkdir -p "%{buildroot}%{_var}/log/onlyoffice/%{product}/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Calendar/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Calendar/server/"
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/service/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Mail/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.Mail/server/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.People/client/"
mkdir -p "%{buildroot}%{buildpath}/products/ASC.People/server/"
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.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}/sql/"
mkdir -p "%{buildroot}%{buildpath}/studio/api/"
mkdir -p "%{buildroot}%{buildpath}/studio/client/"
mkdir -p "%{buildroot}%{buildpath}/studio/login/"
mkdir -p "%{buildroot}%{buildpath}/studio/server/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.Calendar/server/* "%{buildroot}%{buildpath}/products/ASC.Calendar/server/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.Mail/server/* "%{buildroot}%{buildpath}/products/ASC.Mail/server/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.CRM/server/* "%{buildroot}%{buildpath}/products/ASC.CRM/server/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.Files/server/* "%{buildroot}%{buildpath}/products/ASC.Files/server/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Files.Service/service/* "%{buildroot}%{buildpath}/products/ASC.Files/service/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.People/server/* "%{buildroot}%{buildpath}/products/ASC.People/server/"
cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.Projects/server/* "%{buildroot}%{buildpath}/products/ASC.Projects/server/"
cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.ApiSystem/service/* "%{buildroot}%{buildpath}/services/ASC.ApiSystem/"
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.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.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/"
cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/*.sql "%{buildroot}%{buildpath}/sql/"
cp -rf %{_builddir}/%{sourcename}/build/install/rpm/*.sh "%{buildroot}%{_bindir}/"
cp -rf %{_builddir}/%{sourcename}/config/* "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/"
cp -rf %{_builddir}/%{sourcename}/config/nginx/includes/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/includes/"
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.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/"
cp -rf %{_builddir}/%{sourcename}/products/ASC.Mail/Client/dist/* "%{buildroot}%{buildpath}/products/ASC.Mail/client/"
cp -rf %{_builddir}/%{sourcename}/public/* "%{buildroot}%{buildpath}/public/"
cp -rf %{_builddir}/%{sourcename}/web/ASC.Web.Client/dist/* "%{buildroot}%{buildpath}/studio/client/"
cp -rf %{_builddir}/%{sourcename}/web/ASC.Web.Editor/dist/* "%{buildroot}%{buildpath}/products/ASC.Files/editor/"
cp -rf %{_builddir}/%{sourcename}/web/ASC.Web.Login/dist/* "%{buildroot}%{buildpath}/studio/login/"

View File

@ -2,7 +2,7 @@
Summary: backup
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description backup
@ -11,19 +11,19 @@ Summary: common
Group: Applications/Internet
%description common
%package files_services
Summary: files_services
%package files-services
Summary: files-services
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description files_services
%description files-services
%package notify
Summary: notify
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description notify
@ -31,17 +31,17 @@ AutoReqProv: no
Summary: files
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description files
%package api_system
Summary: api_system
%package api-system
Summary: api-system
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description api_system
%description api-system
%package proxy
Summary: proxy
@ -52,27 +52,27 @@ Requires: mysql-community-client >= 5.7.0
AutoReqProv: no
%description proxy
%package studio.notify
Summary: studio.notify
%package studio-notify
Summary: studio-notify
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description studio.notify
%description studio-notify
%package people.server
Summary: people.server
%package people-server
Summary: people-server
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description people.server
%description people-server
%package urlshortener
Summary: urlshortener
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
Requires: nodejs >= 12.0
AutoReqProv: no
%description urlshortener
@ -81,7 +81,7 @@ AutoReqProv: no
Summary: socket
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
Requires: nodejs >= 12.0
AutoReqProv: no
%description socket
@ -90,7 +90,7 @@ AutoReqProv: no
Summary: thumbnails
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
Requires: nodejs >= 12.0
AutoReqProv: no
%description thumbnails
@ -99,14 +99,70 @@ AutoReqProv: no
Summary: studio
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description studio
%package crm
Summary: crm
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description crm
%package api
Summary: api
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-3.1
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description api
%package storage-encryption
Summary: storage-encryption
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description storage-encryption
%package storage-migration
Summary: storage-migration
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description storage-migration
%package projects-server
Summary: projects-server
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description projects-server
%package telegram-service
Summary: telegram-service
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description telegram-service
%package calendar
Summary: calendar
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description calendar
%package mail
Summary: mail
Group: Applications/Internet
Requires: %name-common
Requires: dotnet-sdk-5.0
AutoReqProv: no
%description mail

View File

@ -1,8 +1,8 @@
#!/bin/bash
PRODUCT="appserver"
ENVIRONMENT="production"
APP_DIR="/etc/onlyoffice/appserver"
APP_CONF="$APP_DIR/appsettings.json"
APP_DIR="/etc/onlyoffice/${PRODUCT}"
USER_CONF="$APP_DIR/appsettings.$ENVIRONMENT.json"
NGINX_CONF="/etc/nginx/conf.d"
SYSTEMD_DIR="/etc/systemd/system"
@ -116,11 +116,11 @@ while [ "$1" != "" ]; do
;;
-? | -h | --help )
echo " Usage: bash appserver-configuration.sh [PARAMETER] [[PARAMETER], ...]"
echo " Usage: bash ${PRODUCT}-configuration.sh [PARAMETER] [[PARAMETER], ...]"
echo
echo " Parameters:"
echo " -ash, --appshost appserver ip"
echo " -asp, --appsport appserver port (default 80)"
echo " -ash, --appshost ${PRODUCT} ip"
echo " -asp, --appsport ${PRODUCT} port (default 80)"
echo " -dsh, --docshost document server ip"
echo " -dsp, --docsport document server port (default 8083)"
echo " -kh, --kafkahost kafka ip"
@ -166,17 +166,23 @@ install_json() {
chown onlyoffice:onlyoffice $USER_CONF
set_core_machinekey
$JSON_USERCONF "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\"}" >/dev/null 2>&1
$JSON $APP_CONF -e "this.core.products.subfolder='server'" >/dev/null 2>&1 #Fix error
$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
$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
fi
}
restart_services() {
echo -n "Restarting services... "
for SVC in nginx mysqld appserver-api appserver-socket appserver-api_system appserver-backup \
appserver-files appserver-files_service appserver-notify appserver-people appserver-studio appserver-studio_notify \
appserver-thumbnails appserver-urlshortener elasticsearch kafka zookeeper
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
@ -347,20 +353,27 @@ execute_mysql_script(){
#Checking the quantity of the tables created in the db
DB_TABLES_COUNT=$($MYSQL --silent --skip-column-names -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='${DB_NAME}'");
local SQL_DIR="/var/www/${PRODUCT}/sql"
if [ "${DB_TABLES_COUNT}" -eq "0" ]; then
local SQL_DIR="/var/www/appserver/sql"
echo -n "Installing MYSQL database... "
#Adding data to the db
sed -i -e '1 s/^/SET SQL_MODE='ALLOW_INVALID_DATES';\n/;' $SQL_DIR/onlyoffice.sql
$MYSQL -e "CREATE DATABASE IF NOT EXISTS $DB_NAME CHARACTER SET utf8 COLLATE 'utf8_general_ci';" >/dev/null 2>&1
echo 'CREATE TABLE IF NOT EXISTS `Tenants` ( `id` varchar(200) NOT NULL, `Status` varchar(200) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;' >> $SQL_DIR/onlyoffice.sql #Fix non-existent tables Tenants
$MYSQL "$DB_NAME" < "$SQL_DIR/createdb.sql" >/dev/null 2>&1
$MYSQL "$DB_NAME" < "$SQL_DIR/onlyoffice.sql" >/dev/null 2>&1
$MYSQL "$DB_NAME" < "$SQL_DIR/onlyoffice.data.sql" >/dev/null 2>&1
$MYSQL "$DB_NAME" < "$SQL_DIR/onlyoffice.resources.sql" >/dev/null 2>&1
for i in $(ls $SQL_DIR/*upgrade*.sql); do
$MYSQL "$DB_NAME" < ${i} >/dev/null 2>&1
done
else
echo -n "Upgrading MySQL database... "
for i in $(ls $SQL_DIR/*upgrade*.sql); do
$MYSQL "$DB_NAME" < ${i} >/dev/null 2>&1
done
fi
echo "OK"
}
@ -381,7 +394,9 @@ setup_nginx(){
PORTS+=("$DOCUMENT_SERVER_PORT")
PORTS+=('5001') #ASC.Web.Studio
PORTS+=('5002') #ASC.People
PORTS+=('5008') #ASC.Files
PORTS+=('5008') #ASC.Files/client
PORTS+=('5013') #ASC.Files/editor
PORTS+=('5014') #ASC.CRM
setsebool -P httpd_can_network_connect on
;;
disabled)

View File

@ -0,0 +1,2 @@
echo "RUN ASC.Web.Calendar"
call set BROWSER=none&&npm start --prefix ../../products/ASC.Calendar/Client

View File

@ -0,0 +1,2 @@
echo "RUN ASC.Calendar"
call dotnet run --project ..\..\products\ASC.Calendar\Server\ASC.Calendar.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=calendar

2
build/run/MailClient.bat Normal file
View File

@ -0,0 +1,2 @@
echo "RUN ASC.Web.Mail"
call set BROWSER=none&&npm start --prefix ../../products/ASC.Mail/Client

2
build/run/MailServer.bat Normal file
View File

@ -0,0 +1,2 @@
echo "RUN ASC.Mail"
call dotnet run --project ..\..\products\ASC.Mail\Server\ASC.Mail.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=mail

View File

@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

View File

@ -4,8 +4,6 @@ using System.Linq;
using System.Reflection;
using ASC.Common.DependencyInjection;
using ASC.Common.Threading.Progress;
using ASC.Common.Threading.Workers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
@ -145,7 +143,7 @@ namespace ASC.Common
}
public void RegisterProducts(IConfiguration configuration, string path)
{
{
var types = AutofacExtension.FindAndLoad(configuration, path);
foreach (var t in types)
@ -160,9 +158,9 @@ namespace ASC.Common
}
public bool TryAdd<TService, TImplementation>() where TService : class
{
{
return TryAdd(typeof(TService), typeof(TImplementation));
}
}
public bool TryAdd(Type service, Type implementation = null)
{
@ -176,7 +174,7 @@ namespace ASC.Common
if (service == null)
{
return false;
}
}
}
var serviceName = $"{service}{implementation}";
@ -191,18 +189,18 @@ namespace ASC.Common
var isnew = false;
if (di != null)
{
{
if (di.Additional != null)
{
{
var m = di.Additional.GetMethod("Register", BindingFlags.Public | BindingFlags.Static);
m.Invoke(null, new[] { this });
}
}
if (!service.IsInterface || implementation != null)
{
isnew = implementation != null ? Register(service, implementation) : Register(service);
if (!isnew) return false;
}
}
if (service.IsInterface && implementation == null || !service.IsInterface)
{
@ -220,19 +218,19 @@ namespace ASC.Common
var b = a.GetGenericArguments();
foreach (var g in b)
{
{
if (g != service)
{
{
TryAdd(g);
if (service.IsInterface && di.Implementation == null)
{
TryAdd(service, g);
}
}
}
}
TryAdd(a, di.Service);
}
}
else
{
Type c = null;
@ -240,20 +238,20 @@ namespace ASC.Common
var b = a.GetGenericArguments().FirstOrDefault();
if (b != null && b.IsGenericType)
{
{
var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments());
TryAdd(b1);
c = a1.MakeGenericType(b1);
}
else
{
{
c = a1.MakeGenericType(service.GetGenericArguments());
}
}
TryAdd(c, di.Service.MakeGenericType(service.GetGenericArguments()));
//a, di.Service
}
}
}
else
{
@ -271,14 +269,14 @@ namespace ASC.Common
}
if (di.Implementation != null)
{
{
var a = di.Implementation.GetInterfaces().FirstOrDefault(x => x.IsGenericType &&
(x.GetGenericTypeDefinition() == typeof(IConfigureOptions<>) ||
x.GetGenericTypeDefinition() == typeof(IPostConfigureOptions<>) ||
x.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>))
);
if (a != null)
{
{
if (!a.ContainsGenericParameters)
{
var b = a.GetGenericArguments();
@ -291,12 +289,12 @@ namespace ASC.Common
if (service.IsInterface && implementation == null)
{
TryAdd(service, g);
}
}
}
}
TryAdd(a, di.Implementation);
}
}
else
{
Type c = null;
@ -304,20 +302,20 @@ namespace ASC.Common
var b = a.GetGenericArguments().FirstOrDefault();
if (b != null && b.IsGenericType)
{
{
var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments());
TryAdd(b1);
c = a1.MakeGenericType(b1);
}
else
{
{
c = a1.MakeGenericType(service.GetGenericArguments());
}
}
TryAdd(c, di.Implementation.MakeGenericType(service.GetGenericArguments()));
//a, di.Service
}
}
}
else
{
@ -328,13 +326,13 @@ namespace ASC.Common
}
if (isnew)
{
{
ConstructorInfo[] props = null;
if (!service.IsInterface)
{
{
props = service.GetConstructors();
}
}
else if (implementation != null)
{
props = implementation.GetConstructors();
@ -350,7 +348,7 @@ namespace ASC.Common
foreach (var p1 in par)
{
TryAdd(p1.ParameterType);
}
}
}
}
@ -377,7 +375,6 @@ namespace ASC.Common
return false;
}
public DIHelper TryAddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
{
var serviceName = $"{typeof(TService)}";
@ -390,6 +387,18 @@ namespace ASC.Common
return this;
}
public DIHelper TryAddSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService
{
var serviceName = $"{typeof(TService)}{typeof(TImplementation)}";
if (!Services[DIAttributeEnum.Singletone].Contains(serviceName))
{
Services[DIAttributeEnum.Singletone].Add(serviceName);
ServiceCollection.TryAddSingleton<TService, TImplementation>();
}
return this;
}
public DIHelper Configure<TOptions>(Action<TOptions> configureOptions) where TOptions : class
{
var serviceName = $"{typeof(TOptions)}";
@ -402,42 +411,6 @@ namespace ASC.Common
return this;
}
private void AddToConfigured<TOptions>(string type, Action<TOptions> action) where TOptions : class
{
if (!Configured.Contains(type))
{
Configured.Add(type);
ServiceCollection.Configure(action);
}
}
public DIHelper AddWorkerQueue<T1>(int workerCount, int waitInterval, bool stopAfterFinsih, int errorCount)
{
void action(WorkerQueue<T1> a)
{
a.workerCount = workerCount;
a.waitInterval = waitInterval;
a.stopAfterFinsih = stopAfterFinsih;
a.errorCount = errorCount;
}
AddToConfigured($"{typeof(WorkerQueue<T1>)}", (Action<WorkerQueue<T1>>)action);
return this;
}
public DIHelper AddProgressQueue<T1>(int workerCount, int waitInterval, bool removeAfterCompleted, bool stopAfterFinsih, int errorCount) where T1 : class, IProgressItem
{
void action(ProgressQueue<T1> a)
{
a.workerCount = workerCount;
a.waitInterval = waitInterval;
a.stopAfterFinsih = stopAfterFinsih;
a.errorCount = errorCount;
a.removeAfterCompleted = removeAfterCompleted;
}
AddToConfigured($"{typeof(ProgressQueue<T1>)}", (Action<ProgressQueue<T1>>)action);
return this;
}
public DIHelper Configure<TOptions>(string name, Action<TOptions> configureOptions) where TOptions : class
{
var serviceName = $"{typeof(TOptions)}{name}";

View File

@ -34,7 +34,7 @@ namespace ASC.Common.Threading
{
public Action<DistributedTask> Publication { get; set; }
public DistributedTaskCache DistributedTaskCache { get; internal set; }
protected internal DistributedTaskCache DistributedTaskCache { get; internal set; }
public int InstanceId
{
@ -53,7 +53,7 @@ namespace ASC.Common.Threading
{
return DistributedTaskCache.Id;
}
private set
protected set
{
DistributedTaskCache.Id = value?.ToString() ?? "";
}
@ -65,19 +65,19 @@ namespace ASC.Common.Threading
{
return Enum.Parse<DistributedTaskStatus>(DistributedTaskCache.Status);
}
internal set
set
{
DistributedTaskCache.Status = value.ToString();
}
}
public AggregateException Exception
public Exception Exception
{
get
{
return new AggregateException(DistributedTaskCache.Exception);
return new Exception(DistributedTaskCache.Exception);
}
internal set
set
{
DistributedTaskCache.Exception = value?.ToString() ?? "";
}

View File

@ -0,0 +1,66 @@
using System;
namespace ASC.Common.Threading
{
[Transient]
public class DistributedTaskProgress : DistributedTask
{
public double Percentage
{
get
{
return Math.Min(100.0, Math.Max(0, DistributedTaskCache.Percentage));
}
set
{
DistributedTaskCache.Percentage = value;
}
}
public bool IsCompleted
{
get
{
return DistributedTaskCache.IsCompleted;
}
set
{
DistributedTaskCache.IsCompleted = value;
}
}
protected int StepCount
{
get
{
return DistributedTaskCache.StepCount;
}
set
{
DistributedTaskCache.StepCount = value;
}
}
protected void StepDone()
{
if (StepCount > 0)
{
Percentage += 100.0 / StepCount;
}
PublishChanges();
}
public void RunJob()
{
Percentage = 0;
Status = DistributedTaskStatus.Running;
DoJob();
}
protected virtual void DoJob()
{
}
}
}

View File

@ -34,6 +34,9 @@ using System.Threading.Tasks;
using ASC.Common.Caching;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace ASC.Common.Threading
{
[Singletone]
@ -91,17 +94,68 @@ namespace ASC.Common.Threading
notifyCache.Publish(new DistributedTaskCache() { Id = id, Key = key }, CacheNotifyAction.Remove);
}
}
[Singletone(typeof(ConfigureDistributedTaskQueue))]
public class DistributedTaskQueueOptionsManager : OptionsManager<DistributedTaskQueue>
{
public DistributedTaskQueueOptionsManager(IOptionsFactory<DistributedTaskQueue> factory) : base(factory)
{
}
public DistributedTaskQueue Get<T>() where T : DistributedTask
{
return Get(typeof(T).FullName);
}
}
[Scope]
public class ConfigureDistributedTaskQueue : IConfigureNamedOptions<DistributedTaskQueue>
{
private DistributedTaskCacheNotify DistributedTaskCacheNotify { get; }
public IServiceProvider ServiceProvider { get; }
public ConfigureDistributedTaskQueue(DistributedTaskCacheNotify distributedTaskCacheNotify, IServiceProvider serviceProvider)
{
DistributedTaskCacheNotify = distributedTaskCacheNotify;
ServiceProvider = serviceProvider;
}
public void Configure(DistributedTaskQueue queue)
{
queue.DistributedTaskCacheNotify = DistributedTaskCacheNotify;
queue.ServiceProvider = ServiceProvider;
}
public void Configure(string name, DistributedTaskQueue options)
{
Configure(options);
options.Name = name;
}
}
public class DistributedTaskQueue
{
public static readonly int InstanceId;
private readonly string key;
private readonly ICache cache;
private readonly TaskScheduler scheduler;
private readonly ConcurrentDictionary<string, CancellationTokenSource> cancelations;
private string key;
private TaskScheduler Scheduler { get; set; } = TaskScheduler.Default;
private DistributedTaskCacheNotify DistributedTaskCacheNotify { get; }
public IServiceProvider ServiceProvider { get; set; }
public string Name { get { return key; } set { key = value + GetType().Name; } }
private ICache Cache { get => DistributedTaskCacheNotify.Cache; }
private ConcurrentDictionary<string, CancellationTokenSource> Cancelations { get => DistributedTaskCacheNotify.Cancelations; }
public int MaxThreadsCount
{
set
{
Scheduler = value <= 0
? TaskScheduler.Default
: new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, value).ConcurrentScheduler;
}
}
public DistributedTaskCacheNotify DistributedTaskCacheNotify { get; set; }
static DistributedTaskQueue()
{
@ -109,28 +163,11 @@ namespace ASC.Common.Threading
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="name">Name of queue</param>
/// <param name="maxThreadsCount">limit of threads count; Default: -1 - no limit</param>
public DistributedTaskQueue(DistributedTaskCacheNotify distributedTaskCacheNotify, string name, int maxThreadsCount = -1)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
key = name + GetType().Name;
scheduler = maxThreadsCount <= 0
? TaskScheduler.Default
: new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, maxThreadsCount).ConcurrentScheduler;
DistributedTaskCacheNotify = distributedTaskCacheNotify;
cancelations = DistributedTaskCacheNotify.Cancelations;
cache = DistributedTaskCacheNotify.Cache;
}
public void QueueTask(DistributedTaskProgress taskProgress)
{
QueueTask((a, b) => taskProgress.RunJob(), taskProgress);
}
public void QueueTask(Action<DistributedTask, CancellationToken> action, DistributedTask distributedTask = null)
{
if (distributedTask == null)
@ -142,7 +179,7 @@ namespace ASC.Common.Threading
var cancelation = new CancellationTokenSource();
var token = cancelation.Token;
cancelations[distributedTask.Id] = cancelation;
Cancelations[distributedTask.Id] = cancelation;
var task = new Task(() => { action(distributedTask, token); }, token, TaskCreationOptions.LongRunning);
task
@ -158,12 +195,31 @@ namespace ASC.Common.Threading
}
distributedTask.PublishChanges();
task.Start(scheduler);
task.Start(Scheduler);
}
public IEnumerable<DistributedTask> GetTasks()
{
var tasks = cache.HashGetAll<DistributedTaskCache>(key).Select(r => new DistributedTask(r.Value)).ToList();
var tasks = Cache.HashGetAll<DistributedTaskCache>(key).Values.Select(r => new DistributedTask(r)).ToList();
tasks.ForEach(t =>
{
if (t.Publication == null)
{
t.Publication = GetPublication();
}
});
return tasks;
}
public IEnumerable<T> GetTasks<T>() where T : DistributedTask
{
var tasks = Cache.HashGetAll<DistributedTaskCache>(key).Values.Select(r =>
{
var result = ServiceProvider.GetService<T>();
result.DistributedTaskCache = r;
return result;
}).ToList();
tasks.ForEach(t =>
{
if (t.Publication == null)
@ -174,14 +230,39 @@ namespace ASC.Common.Threading
return tasks;
}
public T GetTask<T>(string id) where T : DistributedTask
{
var cache = Cache.HashGet<DistributedTaskCache>(key, id);
if (cache != null)
{
using var scope = ServiceProvider.CreateScope();
var task = scope.ServiceProvider.GetService<T>();
task.DistributedTaskCache = cache;
if (task != null && task.Publication == null)
{
task.Publication = GetPublication();
}
return task;
}
return null;
}
public DistributedTask GetTask(string id)
{
var task = new DistributedTask(cache.HashGet<DistributedTaskCache>(key, id));
if (task != null && task.Publication == null)
{
task.Publication = GetPublication();
}
return task;
{
var cache = Cache.HashGet<DistributedTaskCache>(key, id);
if (cache != null)
{
var task = new DistributedTask();
task.DistributedTaskCache = cache;
if (task != null && task.Publication == null)
{
task.Publication = GetPublication();
}
return task;
}
return null;
}
public void SetTask(DistributedTask task)
@ -215,7 +296,7 @@ namespace ASC.Common.Threading
distributedTask.Status = DistributedTaskStatus.Canceled;
}
cancelations.TryRemove(id, out _);
Cancelations.TryRemove(id, out _);
distributedTask.PublishChanges();
}
@ -232,5 +313,31 @@ namespace ASC.Common.Threading
DistributedTaskCacheNotify.SetTask(t);
};
}
}
}
public static class DistributedTaskQueueExtention
{
public static DIHelper AddDistributedTaskQueueService<T>(this DIHelper services, int maxThreadsCount) where T : DistributedTask
{
services.TryAdd<DistributedTaskCacheNotify>();
services.TryAdd<DistributedTaskQueueOptionsManager>();
services.TryAdd<DistributedTaskQueue>();
var type = typeof(T);
if (!type.IsAbstract)
{
services.TryAdd<T>();
}
services.TryAddSingleton<IConfigureOptions<DistributedTaskQueue>, ConfigureDistributedTaskQueue>();
_ = services.Configure<DistributedTaskQueue>(type.Name, r =>
{
r.MaxThreadsCount = maxThreadsCount;
//r.errorCount = 1;
});
return services;
}
}
}

View File

@ -30,8 +30,8 @@ namespace ASC.Common.Threading.Progress
{
public interface IProgressItem : ICloneable
{
object Id { get; set; }
object Status { get; set; }
string Id { get; }
DistributedTaskStatus Status { get; set; }
object Error { get; set; }
double Percentage { get; set; }
bool IsCompleted { get; set; }

View File

@ -1,122 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System;
using System.Threading.Tasks;
namespace ASC.Common.Threading.Progress
{
public abstract class ProgressBase : IProgressItem
{
private double _percentage;
protected int StepCount { get; set; }
public object Id { get; set; }
public object Status { get; set; }
public object Error { get; set; }
public double Percentage
{
get { return Math.Min(100.0, Math.Max(0, _percentage)); }
set { _percentage = value; }
}
public virtual bool IsCompleted { get; set; }
public void RunJob()
{
try
{
Percentage = 0;
DoJob();
}
catch (Exception e)
{
Error = e;
}
finally
{
Percentage = 100;
IsCompleted = true;
}
}
public async Task RunJobAsync()
{
try
{
Percentage = 0;
await DoJobAsync();
}
catch (Exception e)
{
Error = e;
}
finally
{
Percentage = 100;
IsCompleted = true;
}
}
protected ProgressBase()
{
Id = Guid.NewGuid(); // random id
}
protected void ProgressAdd(double value)
{
Percentage += value;
}
protected void StepDone()
{
if (StepCount > 0)
{
Percentage += 100.0 / StepCount;
}
}
protected abstract void DoJob();
protected virtual Task DoJobAsync()
{
return Task.Run(() => { });
}
object ICloneable.Clone()
{
return MemberwiseClone();
}
}
}

View File

@ -1,142 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System;
using System.Linq;
using ASC.Common.Logging;
using ASC.Common.Threading.Workers;
using Microsoft.Extensions.Options;
namespace ASC.Common.Threading.Progress
{
[Singletone(typeof(ConfigureProgressQueue<>))]
public class ProgressQueueOptionsManager<T> : OptionsManager<ProgressQueue<T>> where T : class, IProgressItem
{
public ProgressQueueOptionsManager(IOptionsFactory<ProgressQueue<T>> factory) : base(factory)
{
}
}
[Singletone]
public class ConfigureProgressQueue<T> : IPostConfigureOptions<ProgressQueue<T>> where T : class, IProgressItem
{
public ConfigureProgressQueue(IOptionsMonitor<ILog> log)
{
Log = log;
}
private IOptionsMonitor<ILog> Log { get; }
public void PostConfigure(string name, ProgressQueue<T> queue)
{
queue.log = Log.Get("ASC.WorkerQueue");
queue.Start(x => x.RunJob());
}
}
[Singletone]
public class ProgressQueue<T> : WorkerQueue<T> where T : class, IProgressItem
{
public bool removeAfterCompleted;
public ProgressQueue()
{
}
public override void Add(T item)
{
if (GetStatus(item.Id) == null)
{
base.Add(item);
}
}
public T GetStatus(object id)
{
T item;
lock (SynchRoot)
{
item = GetItems().Where(x => Equals(x.Id, id)).SingleOrDefault();
if (item != null)
{
if (removeAfterCompleted && item.IsCompleted)
{
Remove(item);
}
return (T)item.Clone();
}
}
return item;
}
public void PostComplete(object id)
{
lock (SynchRoot)
{
var item = GetItems().Where(x => Equals(x.Id, id)).SingleOrDefault();
if (item != null)
{
item.IsCompleted = true;
if (removeAfterCompleted)
{
Remove(item);
}
}
}
}
protected override WorkItem<T> Selector()
{
return Items
.Where(x => !x.IsProcessed && !x.IsCompleted)
.OrderBy(x => x.Added)
.FirstOrDefault();
}
protected override void PostComplete(WorkItem<T> item)
{
item.IsCompleted = true;
}
protected override void ErrorLimit(WorkItem<T> item)
{
PostComplete(item);
}
protected override void Error(WorkItem<T> workItem, Exception exception)
{
workItem.Item.Error = exception;
workItem.Item.IsCompleted = true;
base.Error(workItem, exception);
}
}
}

View File

@ -1,354 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ASC.Common.Logging;
using Microsoft.Extensions.Options;
namespace ASC.Common.Threading.Workers
{
[Singletone(typeof(ConfigureWorkerQueue<>))]
public class WorkerQueueOptionsManager<T> : OptionsManager<WorkerQueue<T>>
{
public WorkerQueueOptionsManager(IOptionsFactory<WorkerQueue<T>> factory) : base(factory)
{
}
}
[Singletone]
public class ConfigureWorkerQueue<T> : IConfigureOptions<WorkerQueue<T>>
{
public ConfigureWorkerQueue(IOptionsMonitor<ILog> log)
{
Log = log;
}
private IOptionsMonitor<ILog> Log { get; }
public void Configure(Workers.WorkerQueue<T> queue)
{
queue.log = Log.Get("ASC.WorkerQueue");
}
}
[Singletone]
public class WorkerQueue<T>
{
internal ILog log;
private readonly ICollection<WorkItem<T>> items = new List<WorkItem<T>>();
private readonly List<Thread> threads = new List<Thread>();
private readonly AutoResetEvent waitEvent = new AutoResetEvent(false);
private readonly ManualResetEvent stopEvent = new ManualResetEvent(false);
public int workerCount;
public bool stopAfterFinsih;
public int errorCount;
public int waitInterval;
private Action<T> action;
private volatile bool started;
public object SynchRoot { get { return Items; } }
protected virtual ICollection<WorkItem<T>> Items { get { return items; } }
public bool IsStarted { get { return started; } }
public WorkerQueue()
{
}
public void Start(Action<T> starter)
{
Start(starter, true);
}
public IEnumerable<T> GetItems()
{
lock (Items)
{
return Items.Select(x => x.Item).ToList();
}
}
public virtual void AddRange(IEnumerable<T> items)
{
lock (Items)
{
foreach (var item in items)
{
Items.Add(new WorkItem<T>(item));
}
}
waitEvent.Set();
ReviveThreads();
}
public virtual void Add(T item)
{
lock (Items)
{
Items.Add(new WorkItem<T>(item));
}
waitEvent.Set();
ReviveThreads();
}
public void Remove(T item)
{
lock (Items)
{
var existing = Items.Where(x => Equals(x.Item, item)).SingleOrDefault();
RemoveInternal(existing);
}
}
public void Clear()
{
lock (Items)
{
foreach (var workItem in Items)
{
workItem.Dispose();
}
Items.Clear();
}
}
public void Stop()
{
if (started)
{
started = false;
stopEvent.Set();
waitEvent.Set();
log.Debug("Stoping queue. Joining threads");
foreach (var workerThread in threads)
{
workerThread.Join();
}
threads.Clear();
log.Debug("Queue stoped. Threads cleared");
}
}
public void Terminate()
{
if (started)
{
started = false;
stopEvent.Set();
waitEvent.Set();
log.Debug("Stoping queue. Terminating threads");
foreach (var worker in threads.Where(t => t != Thread.CurrentThread))
{
worker.Abort();
}
if (threads.Contains(Thread.CurrentThread))
{
threads.Clear();
log.Debug("Terminate called from current worker thread. Terminating");
Thread.CurrentThread.Abort();
}
threads.Clear();
log.Debug("Queue stoped. Threads cleared");
}
}
protected virtual WorkItem<T> Selector()
{
return Items.Where(x => !x.IsProcessed).OrderBy(x => x.Added).FirstOrDefault();
}
protected virtual void PostComplete(WorkItem<T> item)
{
RemoveInternal(item);
}
protected void RemoveInternal(WorkItem<T> item)
{
if (item != null)
{
Items.Remove(item);
item.Dispose();
}
}
protected virtual void ErrorLimit(WorkItem<T> item)
{
RemoveInternal(item);
}
protected virtual void Error(WorkItem<T> item, Exception exception)
{
log.Error(item, exception);
item.IsProcessed = false;
item.Added = DateTime.Now;
}
private WaitHandle[] WaitObjects()
{
return new WaitHandle[] { stopEvent, waitEvent };
}
private void ReviveThreads()
{
if (threads.Count != 0)
{
var haveLiveThread = threads.Count(x => x.IsAlive) > 0;
if (!haveLiveThread)
{
Stop();
Start(action);
}
}
}
private void Start(Action<T> starter, bool backgroundThreads)
{
if (!started)
{
started = true;
action = starter;
stopEvent.Reset();
waitEvent.Reset();
log.Debug("Creating threads");
for (var i = 0; i < workerCount; i++)
{
threads.Add(new Thread(DoWork) { IsBackground = backgroundThreads });
}
log.Debug("Starting threads");
foreach (var thread in threads)
{
thread.Start(stopAfterFinsih);
}
}
}
private void DoWork(object state)
{
try
{
var stopAfterFinsih = false;
if (state != null && state is bool b)
{
stopAfterFinsih = b;
}
do
{
WorkItem<T> item;
Action<T> localAction;
lock (Items)
{
localAction = action;
item = Selector();
if (item != null)
{
item.IsProcessed = true;
}
}
if (localAction == null)
break;//Exit if action is null
if (item != null)
{
try
{
localAction(item.Item);
var fallSleep = false;
lock (Items)
{
PostComplete(item);
if (Items.Count == 0)
{
fallSleep = true;
}
}
if (fallSleep)
{
if (stopAfterFinsih || WaitHandle.WaitAny(WaitObjects(), Timeout.Infinite, false) == 0)
{
break;
}
}
}
catch (ThreadAbortException)
{
return;
}
catch (Exception e)
{
lock (Items)
{
Error(item, e);
item.ErrorCount++;
if (item.ErrorCount > errorCount)
{
ErrorLimit(item);
}
}
}
}
else
{
if (stopAfterFinsih || WaitHandle.WaitAny(WaitObjects(), waitInterval, false) == 0)
{
break;
}
}
} while (true);
}
catch (ThreadAbortException)
{
return;
}
catch (Exception err)
{
log.Error(err);
}
}
}
}

View File

@ -9,6 +9,9 @@ message DistributedTaskCache {
string Exception = 4;
repeated DistributedTaskCacheProp Props = 5;
string Key = 6;
double Percentage = 7;
bool IsCompleted = 8;
int32 StepCount = 9;
message DistributedTaskCacheProp
{

View File

@ -60,7 +60,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0-alpha.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.2" />
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
</ItemGroup>

View File

@ -361,13 +361,18 @@ namespace ASC.Core
internal List<GroupInfo> GetUserGroups(Guid userID, IncludeType includeType, Guid? categoryId)
{
var httpRequestDictionary = new HttpRequestDictionary<List<GroupInfo>>(Accessor?.HttpContext, "GroupInfo");
var fromCache = httpRequestDictionary.Get(userID.ToString());
if (fromCache != null)
{
return fromCache;
var result = httpRequestDictionary.Get(userID.ToString());
if (result != null)
{
if (categoryId.HasValue)
{
result = result.Where(r => r.CategoryID.Equals(categoryId.Value)).ToList();
}
return result;
}
var result = new List<GroupInfo>();
result = new List<GroupInfo>();
var distinctUserGroups = new List<GroupInfo>();
var refs = GetRefsInternal();
@ -391,17 +396,17 @@ namespace ASC.Core
if (IncludeType.Distinct == (includeType & IncludeType.Distinct))
{
result.AddRange(distinctUserGroups);
}
}
result.Sort((group1, group2) => string.Compare(group1.Name, group2.Name, StringComparison.Ordinal));
httpRequestDictionary.Add(userID.ToString(), result);
if (categoryId.HasValue)
{
result = result.Where(r => r.CategoryID.Equals(categoryId.Value)).ToList();
}
result.Sort((group1, group2) => string.Compare(group1.Name, group2.Name, StringComparison.Ordinal));
httpRequestDictionary.Add(userID.ToString(), result);
return result;
}

View File

@ -745,11 +745,11 @@ namespace ASC.Core.Data
if (!string.IsNullOrEmpty(text))
{
q = q.Where(
u => u.FirstName.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
u.LastName.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
u.Title.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
u.Location.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
u.Email.Contains(text, StringComparison.InvariantCultureIgnoreCase));
u => u.FirstName.Contains(text) ||
u.LastName.Contains(text) ||
u.Title.Contains(text) ||
u.Location.Contains(text) ||
u.Email.Contains(text));
}
return q;

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
@ -42,13 +43,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("id")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UId)
.HasColumnName("uid")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Linked)
.HasColumnName("linked")
@ -59,13 +60,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("profile")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Provider)
.HasColumnName("provider")
.HasColumnType("char(60)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddAccountLinks(this ModelBuilder modelBuilder)

View File

@ -36,7 +36,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("browser")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Date)
.HasColumnName("date")
@ -46,37 +46,37 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("description")
.HasColumnType("varchar(20000)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Initiator)
.HasColumnName("initiator")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Ip)
.HasColumnName("ip")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Page)
.HasColumnName("page")
.HasColumnType("varchar(300)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Platform)
.HasColumnName("platform")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Target)
.HasColumnName("target")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
@ -84,7 +84,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("user_id")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddAuditEvent(this ModelBuilder modelBuilder)

View File

@ -37,7 +37,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("browser")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Date)
.HasColumnName("date")
@ -47,31 +47,31 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("description")
.HasColumnType("varchar(500)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Ip)
.HasColumnName("ip")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Login)
.HasColumnName("login")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Page)
.HasColumnName("page")
.HasColumnType("varchar(300)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Platform)
.HasColumnName("platform")
.HasColumnType("varchar(200)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
@ -80,7 +80,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("user_id")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddLoginEvents(this ModelBuilder modelBuilder)

View File

@ -61,7 +61,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("company_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ContactTypeId).HasColumnName("contact_type_id");
@ -70,7 +70,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("create_by")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CreateOn)
.HasColumnName("create_on")
@ -80,25 +80,25 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("currency")
.HasColumnType("varchar(3)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.DisplayName)
.HasColumnName("display_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.FirstName)
.HasColumnName("first_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Industry)
.HasColumnName("industry")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IsCompany).HasColumnName("is_company");
@ -108,7 +108,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("last_modifed_by")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModifedOn)
.HasColumnName("last_modifed_on")
@ -118,13 +118,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("last_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Notes)
.HasColumnName("notes")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.StatusId).HasColumnName("status_id");
@ -134,7 +134,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("title")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddCrmContact(this ModelBuilder modelBuilder)

View File

@ -49,7 +49,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("id")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AnsweredBy)
.IsRequired()
@ -57,7 +57,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnType("varchar(50)")
.HasDefaultValueSql("'00000000-0000-0000-0000-000000000000'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ContactId).HasColumnName("contact_id");
@ -72,21 +72,21 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("number_from")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.NumberTo)
.IsRequired()
.HasColumnName("number_to")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ParentCallId)
.IsRequired()
.HasColumnName("parent_call_id")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Price)
.HasColumnName("price")
@ -102,13 +102,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("record_sid")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.RecordUrl)
.HasColumnName("record_url")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Status).HasColumnName("status");

View File

@ -34,26 +34,26 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("id")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Alias)
.HasColumnName("alias")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Number)
.IsRequired()
.HasColumnName("number")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Settings)
.HasColumnName("settings")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
});

View File

@ -1,6 +1,8 @@
using System;
using ASC.Common.Security.Authorizing;
using ASC.Core.Common.EF.Model;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF
@ -113,20 +115,20 @@ namespace ASC.Core.Common.EF
.HasColumnName("subject")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Action)
.HasColumnName("action")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Object)
.HasColumnName("object")
.HasColumnType("varchar(255)")
.HasDefaultValueSql("''")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AceType).HasColumnName("acetype");
});

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
@ -47,7 +48,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("id")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnName("last_modified")

View File

@ -77,26 +77,26 @@ namespace ASC.Core.Common.EF
.HasColumnName("source")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Action)
.HasColumnName("action")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Recipient)
.HasColumnName("recipient")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Sender)
.IsRequired()
.HasColumnName("sender")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddSubscriptionMethod(this ModelBuilder modelBuilder)

View File

@ -66,25 +66,25 @@ namespace ASC.Core.Common.EF
.HasColumnName("source")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Action)
.HasColumnName("action")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Recipient)
.HasColumnName("recipient")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Object)
.HasColumnName("object")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Unsubscribed).HasColumnName("unsubscribed");
});

View File

@ -35,7 +35,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("index_name")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnName("last_modified")

View File

@ -46,19 +46,19 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("ID")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserId)
.HasColumnName("UserID")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Data)
.IsRequired()
.HasColumnType("mediumtext")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddWebstudioSettings(this ModelBuilder modelBuilder)

View File

@ -52,13 +52,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("productid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserId)
.HasColumnName("userid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.FirstVisitTime)
.HasColumnName("firstvisittime")

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;

using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
@ -47,27 +46,27 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("addr_type")
.HasColumnType("enum('ipv4','ipv6')")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.City)
.IsRequired()
.HasColumnName("city")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Country)
.IsRequired()
.HasColumnName("country")
.HasColumnType("varchar(2)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.District)
.HasColumnName("district")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.GeonameId).HasColumnName("geoname_id");
@ -76,14 +75,14 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("ip_end")
.HasColumnType("varchar(39)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IPStart)
.IsRequired()
.HasColumnName("ip_start")
.HasColumnType("varchar(39)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Latitude).HasColumnName("latitude");
@ -98,13 +97,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("stateprov")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimezoneName)
.HasColumnName("timezone_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimezoneOffset).HasColumnName("timezone_offset");
@ -112,7 +111,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("zipcode")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}

View File

@ -52,7 +52,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("id")
.HasColumnType("varchar(88)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AggregateDate)
.HasColumnName("aggregated_date")
@ -63,7 +63,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("author")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CreatedDate)
.HasColumnName("created_date")
@ -73,27 +73,27 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("group_id")
.HasColumnType("varchar(70)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Json)
.IsRequired()
.HasColumnName("json")
.HasColumnType("mediumtext")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Keywords)
.HasColumnName("keywords")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ModifiedBy)
.IsRequired()
.HasColumnName("modified_by")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ModifiedDate)
.HasColumnName("modified_date")
@ -104,14 +104,14 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("module")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Product)
.IsRequired()
.HasColumnName("product")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
});

View File

@ -36,7 +36,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("last_key")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastDate)
.HasColumnName("last_date")

View File

@ -40,13 +40,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("user_id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Module)
.HasColumnName("module")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimeStamp)
.HasColumnName("timestamp")

View File

@ -39,13 +39,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("feed_id")
.HasColumnType("varchar(88)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserId)
.HasColumnName("user_id")
.HasColumnType("char(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddFeedUsers(this ModelBuilder modelBuilder)

View File

@ -177,13 +177,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("input")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Output)
.HasColumnName("output")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddFilesConverts(this ModelBuilder modelBuilder)

View File

@ -76,7 +76,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("address")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.BeginDate)
.HasColumnName("begin_date")
@ -114,7 +114,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("email_in_folder")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Enabled)
.HasColumnName("enabled")
@ -129,7 +129,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("id_user")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Imap).HasColumnName("imap");
@ -137,7 +137,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("imap_intervals")
.HasColumnType("mediumtext")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IsDefault).HasColumnName("is_default");
@ -157,13 +157,13 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Pop3Password)
.HasColumnName("pop3_password")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.QuotaError).HasColumnName("quota_error");
@ -173,7 +173,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("smtp_password")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
@ -181,7 +181,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("token")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TokenType).HasColumnName("token_type");

View File

@ -254,26 +254,26 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("display_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.DisplayShortName)
.HasColumnName("display_short_name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Documentation)
.HasColumnName("documentation")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.IsRequired()
.HasColumnName("name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddMailboxProvider(this ModelBuilder modelBuilder)

View File

@ -545,14 +545,14 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("authentication")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Hostname)
.IsRequired()
.HasColumnName("hostname")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IdProvider).HasColumnName("id_provider");
@ -566,20 +566,20 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnType("enum('plain','SSL','STARTTLS')")
.HasDefaultValueSql("'plain'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Type)
.IsRequired()
.HasColumnName("type")
.HasColumnType("enum('pop3','imap','smtp')")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserName)
.HasColumnName("username")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddMailboxServer(this ModelBuilder modelBuilder)

View File

@ -38,7 +38,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnName("connection_string")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ImapSettingsId).HasColumnName("imap_settings_id");
@ -48,7 +48,7 @@ namespace ASC.Core.Common.EF.Model.Mail
.HasColumnType("varchar(128)")
.HasDefaultValueSql("''")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ServerType).HasColumnName("server_type");

View File

@ -33,7 +33,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("user_email")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AppType).HasColumnName("app_type");

View File

@ -43,25 +43,25 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("attachments")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AutoSubmitted)
.HasColumnName("auto_submitted")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Content)
.HasColumnName("content")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ContentType)
.HasColumnName("content_type")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CreationDate)
.HasColumnName("creation_date")
@ -71,31 +71,31 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("reciever")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ReplyTo)
.HasColumnName("reply_to")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Sender)
.HasColumnName("sender")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.SenderType)
.HasColumnName("sender_type")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Subject)
.HasColumnName("subject")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TenantId).HasColumnName("tenant_id");
});

View File

@ -34,7 +34,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("login")
.HasColumnType("varchar(150)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.IsAdmin).HasColumnName("isAdmin");
@ -49,7 +49,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("password")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddResAuthors(this ModelBuilder modelBuilder)

View File

@ -34,7 +34,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("authorLogin")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.FileId).HasColumnName("fileid");

View File

@ -33,13 +33,13 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("authorLogin")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CultureTitle)
.HasColumnName("cultureTitle")
.HasColumnType("varchar(20)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddResAuthorsLang(this ModelBuilder modelBuilder)

View File

@ -33,7 +33,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("title")
.HasColumnType("varchar(120)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Available).HasColumnName("available");
@ -47,7 +47,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("value")
.HasColumnType("varchar(120)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddResCultures(this ModelBuilder modelBuilder)

View File

@ -52,13 +52,13 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("cultureTitle")
.HasColumnType("varchar(20)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Title)
.HasColumnName("title")
.HasColumnType("varchar(120)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.AuthorLogin)
.IsRequired()
@ -66,13 +66,13 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnType("varchar(50)")
.HasDefaultValueSql("'Console'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Description)
.HasColumnName("description")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Flag).HasColumnName("flag");
@ -84,19 +84,19 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("link")
.HasColumnType("varchar(120)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ResourceType)
.HasColumnName("resourceType")
.HasColumnType("varchar(20)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TextValue)
.HasColumnName("textValue")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TimeChanges)
.HasColumnName("timeChanges")

View File

@ -53,21 +53,21 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("moduleName")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ProjectName)
.IsRequired()
.HasColumnName("projectName")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ResName)
.IsRequired()
.HasColumnName("resName")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddResFiles(this ModelBuilder modelBuilder)

View File

@ -44,13 +44,13 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("title")
.HasColumnType("varchar(120)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CultureTitle)
.HasColumnName("cultureTitle")
.HasColumnType("varchar(20)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Flag).HasColumnName("flag");
@ -62,7 +62,7 @@ namespace ASC.Core.Common.EF.Model.Resource
.HasColumnName("textValue")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddResReserve(this ModelBuilder modelBuilder)

View File

@ -41,7 +41,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("portal_user_id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TelegramUserId).HasColumnName("telegram_user_id");
});

View File

@ -1,4 +1,5 @@
using ASC.Core.Common.EF.Model;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF
@ -39,14 +40,14 @@ namespace ASC.Core.Common.EF
.HasColumnName("partner_id")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ButtonUrl)
.IsRequired()
.HasColumnName("button_url")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddDbButton(this ModelBuilder modelBuilder)

View File

@ -52,19 +52,19 @@ namespace ASC.Core.Common.EF
.HasColumnName("avangate_id")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Description)
.HasColumnName("description")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Features)
.HasColumnName("features")
.HasColumnType("text")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.MaxFileSize).HasColumnName("max_file_size");
@ -74,7 +74,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("name")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Price)
.HasColumnName("price")

View File

@ -44,7 +44,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("path")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Counter).HasColumnName("counter");
@ -57,7 +57,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("tag")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddDbQuotaRow(this ModelBuilder modelBuilder)

View File

@ -40,7 +40,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("comment")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CreateOn)
.HasColumnName("create_on")

View File

@ -85,7 +85,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("alias")
.HasColumnType("varchar(100)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Calls)
.HasColumnName("calls")
@ -103,7 +103,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnType("char(10)")
.HasDefaultValueSql("'en-US'")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnName("last_modified")
@ -114,26 +114,26 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("mappeddomain")
.HasColumnType("varchar(100)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Name)
.IsRequired()
.HasColumnName("name")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.OwnerId)
.HasColumnName("owner_id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.PaymentId)
.HasColumnName("payment_id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Public).HasColumnName("public");
@ -141,7 +141,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("publicvisibleproducts")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Spam)
.HasColumnName("spam")
@ -157,13 +157,13 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("timezone")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TrustedDomains)
.HasColumnName("trusteddomains")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.TrustedDomainsEnabled)
.HasColumnName("trusteddomainsenabled")

View File

@ -33,7 +33,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("address")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}
public static void PgSqlAddDbTenantForbiden(this ModelBuilder modelBuilder)

View File

@ -35,19 +35,19 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("affiliate_id")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Campaign)
.HasColumnName("campaign")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.PartnerId)
.HasColumnName("partner_id")
.HasColumnType("varchar(36)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
});
}

View File

@ -36,14 +36,14 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("url")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Version)
.IsRequired()
.HasColumnName("version")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Visible).HasColumnName("visible");
});

View File

@ -35,7 +35,7 @@ namespace ASC.Core.Common.EF.Model
.HasColumnName("ip")
.HasColumnType("varchar(50)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
});

View File

@ -1,5 +1,7 @@
using System;
using ASC.Core.Common.EF.Model;
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF
@ -45,13 +47,13 @@ namespace ASC.Core.Common.EF
.HasColumnName("id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CategoryId)
.HasColumnName("categoryid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnName("last_modified")
@ -63,13 +65,13 @@ namespace ASC.Core.Common.EF
.HasColumnName("name")
.HasColumnType("varchar(128)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ParentId)
.HasColumnName("parentid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Removed).HasColumnName("removed");
@ -77,7 +79,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("sid")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
});

View File

@ -88,7 +88,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("id")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.ActivationStatus).HasColumnName("activation_status");
@ -100,7 +100,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("contacts")
.HasColumnType("varchar(1024)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.CreateOn)
.HasColumnName("create_on")
@ -111,21 +111,21 @@ namespace ASC.Core.Common.EF
.HasColumnName("culture")
.HasColumnType("varchar(20)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Email)
.HasColumnName("email")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.FirstName)
.IsRequired()
.HasColumnName("firstname")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnName("last_modified")
@ -136,25 +136,25 @@ namespace ASC.Core.Common.EF
.HasColumnName("lastname")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Location)
.HasColumnName("location")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Notes)
.HasColumnName("notes")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Phone)
.HasColumnName("phone")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.PhoneActivation).HasColumnName("phone_activation");
@ -166,19 +166,19 @@ namespace ASC.Core.Common.EF
.HasColumnName("sid")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.SsoNameId)
.HasColumnName("sso_name_id")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.SsoSessionId)
.HasColumnName("sso_session_id")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Status)
.HasColumnName("status")
@ -194,14 +194,14 @@ namespace ASC.Core.Common.EF
.HasColumnName("title")
.HasColumnType("varchar(64)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.UserName)
.IsRequired()
.HasColumnName("username")
.HasColumnType("varchar(255)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.WorkFromDate)
.HasColumnName("workfromdate")

View File

@ -56,13 +56,13 @@ namespace ASC.Core.Common.EF
.HasColumnName("userid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.GroupId)
.HasColumnName("groupid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.RefType).HasColumnName("ref_type");

View File

@ -41,7 +41,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("userid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Photo)
.IsRequired()

View File

@ -55,7 +55,7 @@ namespace ASC.Core.Common.EF
.HasColumnName("userid")
.HasColumnType("varchar(38)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.LastModified)
.HasColumnType("timestamp")
@ -66,13 +66,13 @@ namespace ASC.Core.Common.EF
.HasColumnName("pwdhash")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.PwdHashSha512)
.HasColumnName("pwdhashsha512")
.HasColumnType("varchar(512)")
.HasCharSet("utf8")
.HasCollation("utf8_general_ci");
.UseCollation("utf8_general_ci");
entity.Property(e => e.Tenant).HasColumnName("tenant");
});

View File

@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

View File

@ -28,10 +28,11 @@ using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common.Threading.Progress;
using ASC.Common.Threading;
using ASC.Core.Users;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives;
namespace ASC.Data.Reassigns
@ -43,24 +44,27 @@ namespace ASC.Data.Reassigns
return httpRequest?.Headers;
}
}
public class QueueWorker<T> where T : class, IProgressItem
public class QueueWorker<T> where T : DistributedTaskProgress
{
protected readonly ProgressQueue<T> Queue;
protected readonly DistributedTaskQueue Queue;
protected IHttpContextAccessor HttpContextAccessor { get; }
protected IServiceProvider ServiceProvider { get; }
public object SynchRoot = new object();
public QueueWorker(
IHttpContextAccessor httpContextAccessor,
IServiceProvider serviceProvider,
ProgressQueueOptionsManager<T> optionsQueue)
DistributedTaskQueueOptionsManager options)
{
HttpContextAccessor = httpContextAccessor;
ServiceProvider = serviceProvider;
Queue = optionsQueue.Value;
Queue = options.Get<T>();
}
public string GetProgressItemId(int tenantId, Guid userId)
public static string GetProgressItemId(int tenantId, Guid userId)
{
return string.Format("{0}_{1}_{2}", tenantId, userId, typeof(T).Name);
}
@ -68,7 +72,7 @@ namespace ASC.Data.Reassigns
public T GetProgressItemStatus(int tenantId, Guid userId)
{
var id = GetProgressItemId(tenantId, userId);
return Queue.GetStatus(id);
return Queue.GetTask<T>(id);
}
public void Terminate(int tenantId, Guid userId)
@ -76,30 +80,29 @@ namespace ASC.Data.Reassigns
var item = GetProgressItemStatus(tenantId, userId);
if (item != null)
Queue.Remove(item);
{
Queue.CancelTask(item.Id);
}
}
protected IProgressItem Start(int tenantId, Guid userId, Func<T> constructor)
protected DistributedTaskProgress Start(int tenantId, Guid userId, Func<T> constructor)
{
lock (Queue.SynchRoot)
lock (SynchRoot)
{
var task = GetProgressItemStatus(tenantId, userId);
if (task != null && task.IsCompleted)
{
Queue.Remove(task);
Queue.RemoveTask(task.Id);
task = null;
}
if (task == null)
{
task = constructor();
Queue.Add(task);
Queue.QueueTask(task);
}
if (!Queue.IsStarted)
Queue.Start(x => x.RunJob());
return task;
}
}
@ -108,20 +111,22 @@ namespace ASC.Data.Reassigns
[Scope(Additional = typeof(ReassignProgressItemExtension))]
public class QueueWorkerReassign : QueueWorker<ReassignProgressItem>
{
private QueueWorkerRemove QueueWorkerRemove { get; }
public QueueWorkerReassign(
IHttpContextAccessor httpContextAccessor,
IServiceProvider serviceProvider,
QueueWorkerRemove queueWorkerRemove,
ProgressQueueOptionsManager<ReassignProgressItem> optionsQueue) :
base(httpContextAccessor, serviceProvider, optionsQueue)
DistributedTaskQueueOptionsManager options) :
base(httpContextAccessor, serviceProvider, options)
{
QueueWorkerRemove = queueWorkerRemove;
}
public ReassignProgressItem Start(int tenantId, Guid fromUserId, Guid toUserId, Guid currentUserId, bool deleteProfile)
{
return Start(tenantId, fromUserId, () => new ReassignProgressItem(ServiceProvider, HttpContextAccessor.HttpContext, this, QueueWorkerRemove, tenantId, fromUserId, toUserId, currentUserId, deleteProfile)) as ReassignProgressItem;
return Start(tenantId, fromUserId, () =>
{
var result = ServiceProvider.GetService<ReassignProgressItem>();
result.Init(tenantId, fromUserId, toUserId, currentUserId, deleteProfile);
return result;
}) as ReassignProgressItem;
}
}
@ -131,14 +136,19 @@ namespace ASC.Data.Reassigns
public QueueWorkerRemove(
IHttpContextAccessor httpContextAccessor,
IServiceProvider serviceProvider,
ProgressQueueOptionsManager<RemoveProgressItem> optionsQueue) :
base(httpContextAccessor, serviceProvider, optionsQueue)
DistributedTaskQueueOptionsManager options) :
base(httpContextAccessor, serviceProvider, options)
{
}
public RemoveProgressItem Start(int tenantId, UserInfo user, Guid currentUserId, bool notify)
{
return Start(tenantId, user.ID, () => new RemoveProgressItem(ServiceProvider, HttpContextAccessor.HttpContext, this, tenantId, user, currentUserId, notify)) as RemoveProgressItem;
return Start(tenantId, user.ID, () =>
{
var result = ServiceProvider.GetService<RemoveProgressItem>();
result.Init(tenantId, user, currentUserId, notify);
return result;
}) as RemoveProgressItem;
}
}
}

View File

@ -26,11 +26,11 @@
using System;
using System.Collections.Generic;
using ASC.Common;
using ASC.Common;
using ASC.Common.Logging;
//using System.Web;
using ASC.Common.Threading.Progress;
using ASC.Common.Threading;
//using System.Web;
using ASC.Core;
using ASC.Core.Users;
using ASC.MessagingSystem;
@ -44,42 +44,42 @@ using ASC.Web.Studio.Core.Notify;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Microsoft.Extensions.Primitives;
namespace ASC.Data.Reassigns
{
public class ReassignProgressItem : IProgressItem
{
[Transient]
public class ReassignProgressItem : DistributedTaskProgress
{
private readonly IDictionary<string, StringValues> _httpHeaders;
private readonly int _tenantId;
private readonly Guid _currentUserId;
private readonly bool _deleteProfile;
private int _tenantId;
private Guid _currentUserId;
private bool _deleteProfile;
//private readonly IFileStorageService _docService;
//private readonly ProjectsReassign _projectsReassign;
//private readonly ProjectsReassign _projectsReassign;
public object Id { get; set; }
public object Status { get; set; }
public object Error { get; set; }
public double Percentage { get; set; }
public bool IsCompleted { get; set; }
public Guid FromUser { get; }
public Guid ToUser { get; }
public Guid FromUser { get; private set; }
public Guid ToUser { get; private set; }
private IServiceProvider ServiceProvider { get; }
private QueueWorkerRemove QueueWorkerRemove { get; }
public ReassignProgressItem(
IServiceProvider serviceProvider,
HttpContext context,
QueueWorkerReassign queueWorkerReassign,
QueueWorkerRemove queueWorkerRemove,
int tenantId, Guid fromUserId, Guid toUserId, Guid currentUserId, bool deleteProfile)
IHttpContextAccessor httpContextAccessor,
QueueWorkerRemove queueWorkerRemove)
{
ServiceProvider = serviceProvider;
QueueWorkerRemove = queueWorkerRemove;
_httpHeaders = QueueWorker.GetHttpHeaders(context.Request);
_httpHeaders = QueueWorker.GetHttpHeaders(httpContextAccessor.HttpContext.Request);
//_docService = Web.Files.Classes.Global.FileStorageService;
//_projectsReassign = new ProjectsReassign();
}
public void Init(int tenantId, Guid fromUserId, Guid toUserId, Guid currentUserId, bool deleteProfile)
{
_tenantId = tenantId;
FromUser = fromUserId;
ToUser = toUserId;
@ -89,16 +89,16 @@ namespace ASC.Data.Reassigns
//_docService = Web.Files.Classes.Global.FileStorageService;
//_projectsReassign = new ProjectsReassign();
Id = queueWorkerReassign.GetProgressItemId(tenantId, fromUserId);
Status = ProgressStatus.Queued;
Error = null;
Id = QueueWorkerReassign.GetProgressItemId(tenantId, fromUserId);
Status = DistributedTaskStatus.Created;
Exception = null;
Percentage = 0;
IsCompleted = false;
}
public void RunJob()
{
using var scope = ServiceProvider.CreateScope();
protected override void DoJob()
{
using var scope = ServiceProvider.CreateScope();
var scopeClass = scope.ServiceProvider.GetService<ReassignProgressItemScope>();
var (tenantManager, coreBaseSettings, messageService, studioNotifyService, securityContext, userManager, userPhotoManager, displayUserSettingsHelper, messageTarget, options) = scopeClass;
var logger = options.Get("ASC.Web");
@ -107,41 +107,45 @@ namespace ASC.Data.Reassigns
try
{
Percentage = 0;
Status = ProgressStatus.Started;
Status = DistributedTaskStatus.Running;
securityContext.AuthenticateMe(_currentUserId);
logger.InfoFormat("reassignment of data from {0} to {1}", FromUser, ToUser);
logger.Info("reassignment of data from documents");
logger.Info("reassignment of data from documents");
//_docService.ReassignStorage(_fromUserId, _toUserId);
Percentage = 33;
PublishChanges();
Percentage = 33;
//_docService.ReassignStorage(_fromUserId, _toUserId);
logger.Info("reassignment of data from projects");
Percentage = 66;
//_projectsReassign.Reassign(_fromUserId, _toUserId);
logger.Info("reassignment of data from projects");
//_projectsReassign.Reassign(_fromUserId, _toUserId);
Percentage = 66;
PublishChanges();
if (!coreBaseSettings.CustomMode)
{
logger.Info("reassignment of data from crm");
Percentage = 99;
//using (var scope = DIHelper.Resolve(_tenantId))
//{
// var crmDaoFactory = scope.Resolve<CrmDaoFactory>();
// crmDaoFactory.ContactDao.ReassignContactsResponsible(_fromUserId, _toUserId);
// crmDaoFactory.DealDao.ReassignDealsResponsible(_fromUserId, _toUserId);
// crmDaoFactory.TaskDao.ReassignTasksResponsible(_fromUserId, _toUserId);
// crmDaoFactory.CasesDao.ReassignCasesResponsible(_fromUserId, _toUserId);
//}
logger.Info("reassignment of data from crm");
//using (var scope = DIHelper.Resolve(_tenantId))
//{
// var crmDaoFactory = scope.Resolve<CrmDaoFactory>();
// crmDaoFactory.ContactDao.ReassignContactsResponsible(_fromUserId, _toUserId);
// crmDaoFactory.DealDao.ReassignDealsResponsible(_fromUserId, _toUserId);
// crmDaoFactory.TaskDao.ReassignTasksResponsible(_fromUserId, _toUserId);
// crmDaoFactory.CasesDao.ReassignCasesResponsible(_fromUserId, _toUserId);
//}
Percentage = 99;
PublishChanges();
}
SendSuccessNotify(userManager, studioNotifyService, messageService, messageTarget, displayUserSettingsHelper);
Percentage = 100;
Status = ProgressStatus.Done;
Status = DistributedTaskStatus.Completed;
if (_deleteProfile)
{
@ -151,15 +155,16 @@ namespace ASC.Data.Reassigns
catch (Exception ex)
{
logger.Error(ex);
Status = ProgressStatus.Failed;
Error = ex.Message;
Status = DistributedTaskStatus.Failted;
Exception = ex;
SendErrorNotify(userManager, studioNotifyService, ex.Message);
}
finally
{
logger.Info("data reassignment is complete");
IsCompleted = true;
}
}
PublishChanges();
}
public object Clone()
@ -206,7 +211,7 @@ namespace ASC.Data.Reassigns
messageService.Send(MessageAction.UserDeleted, messageTarget.Create(FromUser), userName);
}
}
[Scope]
public class ReassignProgressItemScope
{
@ -271,9 +276,9 @@ namespace ASC.Data.Reassigns
public class ReassignProgressItemExtension
{
public static void Register(DIHelper services)
{
services.TryAdd<ReassignProgressItemScope>();
services.AddProgressQueue<ReassignProgressItem>(1, (int)TimeSpan.FromMinutes(5).TotalMilliseconds, true, false, 0);
{
services.TryAdd<ReassignProgressItemScope>();
services.AddDistributedTaskQueueService<ReassignProgressItem>(1);
}
}
}

View File

@ -29,10 +29,10 @@ using System.Collections.Generic;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using ASC.Common;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Common.Threading.Progress;
using ASC.Common.Threading;
using ASC.Core;
using ASC.Core.Users;
using ASC.Data.Storage;
@ -46,55 +46,53 @@ using ASC.Web.Studio.Core.Notify;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Microsoft.Extensions.Primitives;
namespace ASC.Data.Reassigns
{
public class RemoveProgressItem : IProgressItem
{
[Transient]
public class RemoveProgressItem : DistributedTaskProgress
{
private readonly IDictionary<string, StringValues> _httpHeaders;
private readonly int _tenantId;
private readonly Guid _currentUserId;
private readonly bool _notify;
private int _tenantId;
private Guid _currentUserId;
private bool _notify;
//private readonly IFileStorageService _docService;
//private readonly MailGarbageEngine _mailEraser;
public object Id { get; set; }
public object Status { get; set; }
public object Error { get; set; }
public double Percentage { get; set; }
public bool IsCompleted { get; set; }
public Guid FromUser { get; }
public Guid FromUser { get; private set; }
private IServiceProvider ServiceProvider { get; }
public UserInfo User { get; }
public UserInfo User { get; private set; }
public RemoveProgressItem(
IServiceProvider serviceProvider,
HttpContext context,
QueueWorkerRemove queueWorkerRemove,
int tenantId, UserInfo user, Guid currentUserId, bool notify)
IHttpContextAccessor httpContextAccessor)
{
_httpHeaders = QueueWorker.GetHttpHeaders(context.Request);
ServiceProvider = serviceProvider;
_httpHeaders = QueueWorker.GetHttpHeaders(httpContextAccessor.HttpContext.Request);
ServiceProvider = serviceProvider;
//_docService = Web.Files.Classes.Global.FileStorageService;
//_mailEraser = new MailGarbageEngine();
}
public void Init(int tenantId, UserInfo user, Guid currentUserId, bool notify)
{
_tenantId = tenantId;
User = user;
FromUser = user.ID;
_currentUserId = currentUserId;
_notify = notify;
//_docService = Web.Files.Classes.Global.FileStorageService;
//_mailEraser = new MailGarbageEngine();
Id = queueWorkerRemove.GetProgressItemId(tenantId, FromUser);
Status = ProgressStatus.Queued;
Error = null;
_notify = notify;
Id = QueueWorkerRemove.GetProgressItemId(tenantId, FromUser);
Status = DistributedTaskStatus.Created;
Exception = null;
Percentage = 0;
IsCompleted = false;
}
IsCompleted = false;
}
public void RunJob()
protected override void DoJob()
{
using var scope = ServiceProvider.CreateScope();
var scopeClass = scope.ServiceProvider.GetService<RemoveProgressItemScope>();
@ -106,7 +104,7 @@ namespace ASC.Data.Reassigns
try
{
Percentage = 0;
Status = ProgressStatus.Started;
Status = DistributedTaskStatus.Running;
securityContext.AuthenticateMe(_currentUserId);
@ -117,52 +115,58 @@ namespace ASC.Data.Reassigns
logger.Info("deleting of data from documents");
Percentage = 25;
//_docService.DeleteStorage(_userId);
Percentage = 25;
PublishChanges();
if (!coreBaseSettings.CustomMode)
{
logger.Info("deleting of data from crm");
Percentage = 50;
//using (var scope = DIHelper.Resolve(_tenantId))
//{
// var crmDaoFactory = scope.Resolve<CrmDaoFactory>();
crmSpace = 0;// crmDaoFactory.ReportDao.GetFiles(_userId).Sum(file => file.ContentLength);
// crmDaoFactory.ReportDao.DeleteFiles(_userId);
//}
crmSpace = 0;// crmDaoFactory.ReportDao.GetFiles(_userId).Sum(file => file.ContentLength);
// crmDaoFactory.ReportDao.DeleteFiles(_userId);
//}
Percentage = 50;
}
else
{
crmSpace = 0;
}
}
PublishChanges();
logger.Info("deleting of data from mail");
Percentage = 75;
//_mailEraser.ClearUserMail(_userId);
Percentage = 75;
PublishChanges();
logger.Info("deleting of data from talk");
Percentage = 99;
DeleteTalkStorage(storageFactory);
Percentage = 99;
PublishChanges();
SendSuccessNotify(studioNotifyService, messageService, messageTarget, userName, docsSpace, crmSpace, mailSpace, talkSpace);
Percentage = 100;
Status = ProgressStatus.Done;
Status = DistributedTaskStatus.Completed;
}
catch (Exception ex)
{
logger.Error(ex);
Status = ProgressStatus.Failed;
Error = ex.Message;
Status = DistributedTaskStatus.Failted;
Exception = ex;
SendErrorNotify(studioNotifyService, ex.Message, userName);
}
finally
{
logger.Info("data deletion is complete");
IsCompleted = true;
IsCompleted = true;
PublishChanges();
}
}
@ -243,9 +247,9 @@ namespace ASC.Data.Reassigns
if (!_notify) return;
studioNotifyService.SendMsgRemoveUserDataFailed(_currentUserId, User, userName, errorMessage);
}
}
}
[Scope]
public class RemoveProgressItemScope
{
@ -315,9 +319,9 @@ namespace ASC.Data.Reassigns
public static class RemoveProgressItemExtension
{
public static void Register(DIHelper services)
{
services.TryAdd<RemoveProgressItemScope>();
services.AddProgressQueue<RemoveProgressItem>(1, (int)TimeSpan.FromMinutes(5).TotalMilliseconds, true, false, 0);
{
services.TryAdd<RemoveProgressItemScope>();
services.AddDistributedTaskQueueService<RemoveProgressItem>(1);
}
}
}

View File

@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

View File

@ -30,9 +30,8 @@ using System.Linq;
using System.Threading.Tasks;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Common.Logging;
using ASC.Common.Threading.Progress;
using ASC.Common.Threading;
using ASC.Core;
using ASC.Core.Encryption;
using ASC.Core.Tenants;
@ -43,9 +42,9 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace ASC.Data.Storage.Encryption
{
{
[Transient(Additional = typeof(EncryptionOperationExtension))]
public class EncryptionOperation : ProgressBase
public class EncryptionOperation : DistributedTaskProgress
{
private const string ConfigPath = "";
private bool HasErrors = false;
@ -63,8 +62,9 @@ namespace ASC.Data.Storage.Encryption
ServiceProvider = serviceProvider;
}
public void Init(EncryptionSettingsProto encryptionSettingsProto)
{
public void Init(EncryptionSettingsProto encryptionSettingsProto, string id)
{
Id = id;
EncryptionSettings = new EncryptionSettings(encryptionSettingsProto);
IsEncryption = EncryptionSettings.Status == EncryprtionStatus.EncryptionStarted;
ServerRootPath = encryptionSettingsProto.ServerRootPath;
@ -74,14 +74,15 @@ namespace ASC.Data.Storage.Encryption
{
using var scope = ServiceProvider.CreateScope();
var scopeClass = scope.ServiceProvider.GetService<EncryptionOperationScope>();
var (log, encryptionSettingsHelper, tenantManager, notifyHelper, coreBaseSettings, storageFactoryConfig, storageFactory, progressEncryption, configuration) = scopeClass;
var (log, encryptionSettingsHelper, tenantManager, notifyHelper, coreBaseSettings, storageFactoryConfig, storageFactory, configuration) = scopeClass;
notifyHelper.Init(ServerRootPath);
Tenants = tenantManager.GetTenants(false);
Modules = storageFactoryConfig.GetModuleList(ConfigPath, true);
UseProgressFile = Convert.ToBoolean(configuration["storage:encryption:progressfile"] ?? "true");
Percentage = 10;
GetProgress(progressEncryption);
PublishChanges();
try
{
if (!coreBaseSettings.Standalone)
@ -93,9 +94,11 @@ namespace ASC.Data.Storage.Encryption
{
log.Debug("Storage already " + EncryptionSettings.Status);
return;
}
}
Percentage = 30;
GetProgress(progressEncryption);
PublishChanges();
foreach (var tenant in Tenants)
{
var dictionary = new Dictionary<string, DiscDataStore>();
@ -107,23 +110,28 @@ namespace ASC.Data.Storage.Encryption
{
EncryptStore(tenant, elem.Key, elem.Value, storageFactoryConfig, log);
});
}
}
Percentage = 70;
GetProgress(progressEncryption);
PublishChanges();
if (!HasErrors)
{
DeleteProgressFiles(storageFactory);
SaveNewSettings(encryptionSettingsHelper, log);
}
}
Percentage = 90;
GetProgress(progressEncryption);
ActivateTenants(tenantManager, log, notifyHelper);
PublishChanges();
ActivateTenants(tenantManager, log, notifyHelper);
Percentage = 100;
GetProgress(progressEncryption);
PublishChanges();
}
catch (Exception e)
{
Error = e;
Exception = e;
log.Error(e);
}
}
@ -164,13 +172,13 @@ namespace ASC.Data.Storage.Encryption
{
using var stream = store.GetReadStream(string.Empty, ProgressFileName);
using var reader = new StreamReader(stream);
string line;
while ((line = reader.ReadLine()) != null)
{
encryptedFiles.Add(line);
}
}
string line;
while ((line = reader.ReadLine()) != null)
{
encryptedFiles.Add(line);
}
}
else
{
store.GetWriteStream(string.Empty, ProgressFileName).Close();
@ -179,15 +187,6 @@ namespace ASC.Data.Storage.Encryption
return encryptedFiles;
}
public void GetProgress(ICacheNotify<ProgressEncryption> progress)
{
var progressEncryption = new ProgressEncryption()
{
Progress = Percentage
};
progress.Publish(progressEncryption, CacheNotifyAction.Insert);
}
private IEnumerable<string> GetFiles(List<string> domains, List<string> progress, DiscDataStore targetStore, string targetDomain)
{
IEnumerable<string> files = targetStore.ListFilesRelative(targetDomain, "\\", "*.*", true);
@ -255,8 +254,8 @@ namespace ASC.Data.Storage.Encryption
using var stream = store.GetWriteStream(string.Empty, ProgressFileName, FileMode.Append);
using var writer = new StreamWriter(stream);
writer.WriteLine(file);
}
writer.WriteLine(file);
}
private void DeleteProgressFiles(StorageFactory storageFactory)
{
@ -334,7 +333,7 @@ namespace ASC.Data.Storage.Encryption
}
}
}
[Scope]
public class EncryptionOperationScope
{
@ -345,7 +344,6 @@ namespace ASC.Data.Storage.Encryption
private CoreBaseSettings CoreBaseSettings { get; set; }
private StorageFactoryConfig StorageFactoryConfig { get; set; }
private StorageFactory StorageFactory { get; set; }
private ICacheNotify<ProgressEncryption> ProgressEncryption { get; }
private IConfiguration Configuration { get; }
public EncryptionOperationScope(IOptionsMonitor<ILog> options,
@ -355,8 +353,7 @@ namespace ASC.Data.Storage.Encryption
CoreBaseSettings coreBaseSettings,
NotifyHelper notifyHelper,
EncryptionSettingsHelper encryptionSettingsHelper,
IConfiguration configuration,
ICacheNotify<ProgressEncryption> progressEncryption)
IConfiguration configuration)
{
Log = options.CurrentValue;
StorageFactoryConfig = storageFactoryConfig;
@ -365,11 +362,10 @@ namespace ASC.Data.Storage.Encryption
CoreBaseSettings = coreBaseSettings;
NotifyHelper = notifyHelper;
EncryptionSettingsHelper = encryptionSettingsHelper;
ProgressEncryption = progressEncryption;
Configuration = configuration;
}
public void Deconstruct(out ILog log, out EncryptionSettingsHelper encryptionSettingsHelper, out TenantManager tenantManager, out NotifyHelper notifyHelper, out CoreBaseSettings coreBaseSettings, out StorageFactoryConfig storageFactoryConfig, out StorageFactory storageFactory, out ICacheNotify<ProgressEncryption> progressEncryption, out IConfiguration configuration)
public void Deconstruct(out ILog log, out EncryptionSettingsHelper encryptionSettingsHelper, out TenantManager tenantManager, out NotifyHelper notifyHelper, out CoreBaseSettings coreBaseSettings, out StorageFactoryConfig storageFactoryConfig, out StorageFactory storageFactory, out IConfiguration configuration)
{
log = Log;
encryptionSettingsHelper = EncryptionSettingsHelper;
@ -378,7 +374,6 @@ namespace ASC.Data.Storage.Encryption
coreBaseSettings = CoreBaseSettings;
storageFactoryConfig = StorageFactoryConfig;
storageFactory = StorageFactory;
progressEncryption = ProgressEncryption;
configuration = Configuration;
}
}

Some files were not shown because too many files have changed in this diff Show More