Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to deb package #266

Merged
merged 68 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a31e244
Dep package create
sk81biz Jan 13, 2021
abc32bc
Deb appserver service modify
sk81biz Mar 1, 2021
2b761f5
Add deb conrol file
sk81biz Mar 2, 2021
cf1d0ec
Add deb config
sk81biz Mar 10, 2021
8331cc4
Merge branch 'develop' into feature/deb-support
sk81biz Apr 9, 2021
8a7cf3c
Merge branch 'develop' into feature/deb-support
sk81biz May 5, 2021
f2e27bb
Add build services
sk81biz May 17, 2021
7aa33b5
Delete package *.services
sk81biz May 19, 2021
bdde430
Add rules for common and proxy
sk81biz May 19, 2021
0fe0ba0
Fix build dh_strip
sk81biz May 20, 2021
c6dc7e5
Add postinst srcript
sk81biz May 26, 2021
64b9ce3
Add config files
sk81biz May 26, 2021
2a5c00b
Add proxy install
sk81biz May 28, 2021
05f9be5
Del build/config folder
sk81biz May 28, 2021
94e31cf
Cosmetic changes
sk81biz May 28, 2021
bc98dd4
Cosmetic changes
sk81biz May 28, 2021
868aeb5
Add files install packages
sk81biz Jun 1, 2021
dcd3561
Add package appserver-configuration
sk81biz Jun 2, 2021
a90c81e
Fix install files
sk81biz Jun 2, 2021
66509fa
Merge branch 'develop' into feature/deb-support
sk81biz Jun 28, 2021
87aab5c
Del DocStore
sk81biz Jun 29, 2021
4f9374e
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Jul 19, 2021
5c5192d
Fix build of deb packages
evgeniy-antonyuk Jul 20, 2021
1e7d15d
Add OneClick for deb
evgeniy-antonyuk Jul 20, 2021
05473bb
Fix for OneClick
evgeniy-antonyuk Jul 20, 2021
123edb5
Fix the configuration for debian
evgeniy-antonyuk Jul 20, 2021
cb75572
Move the appserver configuration
evgeniy-antonyuk Jul 21, 2021
cd3c153
Fix install files
evgeniy-antonyuk Jul 22, 2021
f327f3b
Add a user during installation
evgeniy-antonyuk Jul 22, 2021
271c4f6
Change systemd files installation to lib/systemd folder
evgeniy-antonyuk Jul 22, 2021
176cad2
Add cosmetic changes and add client apps to package
evgeniy-antonyuk Jul 22, 2021
35d99b0
Add packaging of DocStore service
evgeniy-antonyuk Jul 23, 2021
e5b274f
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Jul 23, 2021
c04f485
Configuration correction
evgeniy-antonyuk Jul 26, 2021
fdf9aa1
Update rules
evgeniy-antonyuk Jul 28, 2021
667bd56
Fix errors in oneclick
evgeniy-antonyuk Jul 29, 2021
8b97419
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Jul 30, 2021
6d9b8a4
Modify build scripts
evgeniy-antonyuk Jul 30, 2021
39b86af
Fix a build on rpm
evgeniy-antonyuk Aug 2, 2021
1bdb129
Correction of minor errors
evgeniy-antonyuk Aug 2, 2021
32d4f9f
Add a dlls to the packages
evgeniy-antonyuk Aug 3, 2021
46a34d9
Add a dlls to the packages
evgeniy-antonyuk Aug 3, 2021
94e737f
Add service ASC.SsoAuth
evgeniy-antonyuk Aug 3, 2021
a8bf4fc
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 3, 2021
47ad758
Correction of minor errors
evgeniy-antonyuk Aug 3, 2021
fbddd1f
Revert "Add a dlls to the packages"
evgeniy-antonyuk Aug 3, 2021
8d07f7e
Fix minor bugs
evgeniy-antonyuk Aug 4, 2021
47df455
Correction of minor errors
evgeniy-antonyuk Aug 6, 2021
ef20c6b
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 6, 2021
a2e0608
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 6, 2021
5c33284
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 9, 2021
4a17fc7
Delete .gitmodules
evgeniy-antonyuk Aug 9, 2021
a63a196
Revert "Delete .gitmodules"
evgeniy-antonyuk Aug 9, 2021
3aae2bb
Update .gitmodules
evgeniy-antonyuk Aug 9, 2021
4b9a6fa
Update .gitmodules
evgeniy-antonyuk Aug 10, 2021
49ac69e
Revert "Del DocStore"
evgeniy-antonyuk Aug 10, 2021
102bc5f
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 10, 2021
366f989
Fix the app update
evgeniy-antonyuk Aug 18, 2021
4225e30
Minor fix
evgeniy-antonyuk Aug 18, 2021
8ff5fa9
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 18, 2021
e6cf418
Fix errors during the update
evgeniy-antonyuk Aug 18, 2021
8924940
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Aug 24, 2021
1bf4834
Edit a variable
evgeniy-antonyuk Sep 3, 2021
a979e25
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Sep 3, 2021
8a12f6a
Fix the creation of topics and minor fixes
evgeniy-antonyuk Sep 6, 2021
a478920
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Sep 9, 2021
446b504
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Sep 13, 2021
fa9c6ae
Merge branch 'develop' into feature/deb-support
evgeniy-antonyuk Sep 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions build/install/OneClickInstall/install-Debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

set -e

package_sysname="onlyoffice";
DS_COMMON_NAME="onlyoffice";
product="appserver"
RES_APP_INSTALLED="is already installed";
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product^^}.";
RES_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
case $1 in

-u | --update )
if [ "$2" != "" ]; then
UPDATE=$2
shift
fi
;;

-ls | --local_scripts )
if [ "$2" != "" ]; then
LOCAL_SCRIPTS=$2
shift
fi
;;

-? | -h | --help )
echo " Usage $0 [PARAMETER] [[PARAMETER], ...]"
echo " Parameters:"
echo " -it, --installation_type installation type (COMMUNITY|ENTERPRISE|DEVELOPER)"
echo " -u, --update use to update existing components (true|false)"
echo " -ls, --local_scripts use 'true' to run local scripts (true|false)"
echo " -?, -h, --help this help"
echo
exit 0
;;

esac
shift
done

if [ -z "${UPDATE}" ]; then
UPDATE="false";
fi

if [ -z "${LOCAL_SCRIPTS}" ]; then
LOCAL_SCRIPTS="false";
fi

if [ $(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
apt-get update;
apt-get install -yq curl;
fi

DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}/develop/build/install/OneClickInstall/install-Debian"
if [ "${LOCAL_SCRIPTS}" == "true" ]; then
source install-Debian/bootstrap.sh
else
source <(curl ${DOWNLOAD_URL_PREFIX}/bootstrap.sh)
fi

# add onlyoffice repo
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
echo "deb http://static.teamlab.info.s3.amazonaws.com/repo/4testing/debian stable main" | sudo tee /etc/apt/sources.list.d/onlyoffice4testing.list

declare -x LANG="en_US.UTF-8"
declare -x LANGUAGE="en_US:en"
declare -x LC_ALL="en_US.UTF-8"

if [ "${LOCAL_SCRIPTS}" == "true" ]; then
source install-Debian/tools.sh
source install-Debian/check-ports.sh
source install-Debian/install-preq.sh
source install-Debian/install-app.sh
else
source <(curl ${DOWNLOAD_URL_PREFIX}/tools.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/check-ports.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/install-preq.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/install-app.sh)
fi
23 changes: 23 additions & 0 deletions build/install/OneClickInstall/install-Debian/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

cat<<EOF

#######################################
# BOOTSTRAP
#######################################

EOF

if ! dpkg -l | grep -q "sudo"; then
apt-get install -yq sudo
fi

if ! dpkg -l | grep -q "net-tools"; then
apt-get install -yq net-tools
fi

if ! dpkg -l | grep -q "dirmngr"; then
apt-get install -yq dirmngr
fi
39 changes: 39 additions & 0 deletions build/install/OneClickInstall/install-Debian/check-ports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -e

cat<<EOF

#######################################
# CHECK PORTS
#######################################

EOF

if dpkg -l | grep -q "${product}"; then
echo "${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 "${product} $RES_APP_CHECK_PORTS: 80, 8081, 8083, 5001, 5002";
echo "$RES_CHECK_PORTS"
exit
else
APPSERVER_INSTALLED="false";
fi

if dpkg -l | grep -q "${package_sysname}-documentserver"; then
echo "${package_sysname}-documentserver $RES_APP_INSTALLED"
DOCUMENT_SERVER_INSTALLED="true";
elif [ $UPDATE != "true" ] && netstat -lnp | awk '{print $4}' | grep -qE ":8083$|:5432$|:5672$|:6379$|:8000$|:8080$"; then
echo "${package_sysname}-documentserver $RES_APP_CHECK_PORTS: 8083, 5432, 5672, 6379, 8000, 8080";
echo "$RES_CHECK_PORTS"
exit
else
DOCUMENT_SERVER_INSTALLED="false";
fi

if [ "$APPSERVER_INSTALLED" = "true" ] || [ "$DOCUMENT_SERVER_INSTALLED" = "true" ]; then
if [ "$UPDATE" != "true" ]; then
exit;
fi
fi
144 changes: 144 additions & 0 deletions build/install/OneClickInstall/install-Debian/install-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/bin/bash

set -e

cat<<EOF

#######################################
# INSTALL APP
#######################################

EOF
apt-get -y update

if [ "$DOCUMENT_SERVER_INSTALLED" = "false" ]; then
DS_PORT=${DS_PORT:-8083};

DS_DB_HOST=localhost;
DS_DB_NAME=$DS_COMMON_NAME;
DS_DB_USER=$DS_COMMON_NAME;
DS_DB_PWD=$DS_COMMON_NAME;

DS_JWT_ENABLED=${DS_JWT_ENABLED:-true};
DS_JWT_SECRET="$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 12)";
DS_JWT_HEADER="AuthorizationJwt";

if ! su - postgres -s /bin/bash -c "psql -lqt" | cut -d \| -f 1 | grep -q ${DS_DB_NAME}; then
su - postgres -s /bin/bash -c "psql -c \"CREATE DATABASE ${DS_DB_NAME};\""
su - postgres -s /bin/bash -c "psql -c \"CREATE USER ${DS_DB_USER} WITH password '${DS_DB_PWD}';\""
su - postgres -s /bin/bash -c "psql -c \"GRANT ALL privileges ON DATABASE ${DS_DB_NAME} TO ${DS_DB_USER};\""
fi

echo ${package_sysname}-documentserver $DS_COMMON_NAME/ds-port select $DS_PORT | sudo debconf-set-selections
echo ${package_sysname}-documentserver $DS_COMMON_NAME/db-pwd select $DS_DB_PWD | sudo debconf-set-selections
echo ${package_sysname}-documentserver $DS_COMMON_NAME/db-user $DS_DB_USER | sudo debconf-set-selections
echo ${package_sysname}-documentserver $DS_COMMON_NAME/db-name $DS_DB_NAME | sudo debconf-set-selections
echo ${package_sysname}-documentserver-de $DS_COMMON_NAME/jwt-enabled select ${DS_JWT_ENABLED} | sudo debconf-set-selections
echo ${package_sysname}-documentserver-de $DS_COMMON_NAME/jwt-secret select ${DS_JWT_SECRET} | sudo debconf-set-selections
echo ${package_sysname}-documentserver-de $DS_COMMON_NAME/jwt-header select ${DS_JWT_HEADER} | sudo debconf-set-selections
echo ${package_sysname}-documentserver-ee $DS_COMMON_NAME/jwt-enabled select ${DS_JWT_ENABLED} | sudo debconf-set-selections
echo ${package_sysname}-documentserver-ee $DS_COMMON_NAME/jwt-secret select ${DS_JWT_SECRET} | sudo debconf-set-selections
echo ${package_sysname}-documentserver-ee $DS_COMMON_NAME/jwt-header select ${DS_JWT_HEADER} | sudo debconf-set-selections

apt-get install -yq ${package_sysname}-documentserver
elif [ "$UPDATE" = "true" ] && [ "$DOCUMENT_SERVER_INSTALLED" = "true" ]; then
apt-get install -y --only-upgrade ${package_sysname}-documentserver
fi

NGINX_ROOT_DIR="/etc/nginx"

NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-$(grep processor /proc/cpuinfo | wc -l)};
NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)};

sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_ROOT_DIR}/nginx.conf
sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_ROOT_DIR}/nginx.conf

if ! id "nginx" &>/dev/null; then
systemctl stop nginx

rm -dfr /var/log/nginx/*
rm -dfr /var/cache/nginx/*
useradd -s /bin/false nginx

systemctl start nginx
else
systemctl reload nginx
fi

APPSERVER_INSTALLED_VERSION=$(apt-cache policy ${product} | awk 'NR==2{print $2}')
APPSERVER_LATEST_VERSION=$(apt-cache policy ${product} | awk 'NR==3{print $2}')
if [ "$APPSERVER_INSTALLED_VERSION" != "$APPSERVER_LATEST_VERSION" ]; then
APPSERVER_NEED_UPDATE="true"
fi

if [ "$APPSERVER_INSTALLED" = "false" ]; then
apt-get install -y ${product} || true #Fix error 'Failed to fetch'
apt-get install -y ${product}
elif [ "$APPSERVER_NEED_UPDATE" = "true" ]; then
ENVIRONMENT="$(cat /lib/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_SERVER_PASS=$(echo $USER_CONNECTIONSTRING | grep -oP 'Password=\K.*' | grep -o '^[^;]*')

expect << EOF || true

set timeout -1
log_user 1

spawn apt-get install -y --only-upgrade ${product} elasticsearch=${ELASTIC_VERSION}

expect {
"*** elasticsearch.yml (Y/I/N/O/D/Z)" {
send "\025Y\r"
expect {
"*** jvm.options (Y/I/N/O/D/Z)" {
send "\025Y\r"
}
"/etc/elasticsearch/elasticsearch.yml" {}
}
}
"*** jvm.options (Y/I/N/O/D/Z)" {
send "\025Y\r"
}
}

expect eof

EOF
fi

if [ "${APPSERVER_INSTALLED}" = "false" ] || [ "${APPSERVER_NEED_UPDATE}" = "true" ]; then
expect << EOF
set timeout -1
log_user 1

if { "${UPDATE}" == "true" } {
spawn ${product}-configuration.sh -e ${ENVIRONMENT}
} else {
spawn ${product}-configuration.sh
}

expect -re "Database host:"
send "\025$MYSQL_SERVER_HOST\r"

expect -re "Database name:"
send "\025$MYSQL_SERVER_DB_NAME\r"

expect -re "Database user:"
send "\025$MYSQL_SERVER_USER\r"

expect -re "Database password:"
send "\025$MYSQL_SERVER_PASS\r"

expect eof
EOF
APPSERVER_INSTALLED="true";
fi

echo ""
echo "$RES_INSTALL_SUCCESS"
echo "$RES_QUESTIONS"
echo ""
Loading