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 the ability to build packages in a parameterized way #204

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions install/common/systemd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ while [ "$1" != "" ]; do
shift
fi
;;

-p | --product )
if [ "$2" != "" ]; then
PRODUCT=$2
shift
fi
;;

-ps | --productsysname )
if [ "$2" != "" ]; then
PRODUCT_SYSNAME=$2
shift
fi
;;

-? | -h | --help )
echo " Usage: bash build.sh [PARAMETER] [[PARAMETER], ...]"
Expand All @@ -40,11 +54,12 @@ while [ "$1" != "" ]; do
shift
done

PRODUCT="docspace"
PRODUCT="${PRODUCT:-"docspace"}"
PRODUCT_SYSNAME="${PRODUCT_SYSNAME:-"onlyoffice"}"
BASE_DIR="/var/www/${PRODUCT}"
PATH_TO_CONF="/etc/onlyoffice/${PRODUCT}"
STORAGE_ROOT="/var/www/onlyoffice/Data"
LOG_DIR="/var/log/onlyoffice/${PRODUCT}"
PATH_TO_CONF="/etc/${PRODUCT_SYSNAME}/${PRODUCT}"
STORAGE_ROOT="/var/www/${PRODUCT_SYSNAME}/Data"
LOG_DIR="/var/log/${PRODUCT_SYSNAME}/${PRODUCT}"
DOTNET_RUN="/usr/bin/dotnet"
NODE_RUN="/usr/bin/node"
APP_URLS="http://127.0.0.1"
Expand Down
2 changes: 1 addition & 1 deletion install/deb/debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

* Initial Release.

-- Ascensio System SIA <[email protected]> Fri, 19 Mar 2021 18:39:30 +0300
-- {{vendor}} <{{support_email}}> Fri, 19 Mar 2021 18:39:30 +0300
10 changes: 5 additions & 5 deletions install/deb/debian/control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source: {{product}}
Section: web
Priority: optional
Maintainer: Ascensio System SIA <[email protected]>
Maintainer: {{vendor}} <{{support_email}}>
Build-Depends: debhelper (>= 10), po-debconf, nodejs (>=18), dotnet-sdk-8.0, yarn
Standards-Version: {{package_header_tag_version}}
Homepage: https://www.onlyoffice.com/
Homepage: https://www.{{url}}/
Architecture: all
Multi-Arch: foreign

Expand Down Expand Up @@ -33,7 +33,7 @@ Depends: debconf,
{{product}}-studio (= {{package_header_tag_version}}),
{{product}}-studio-notify (= {{package_header_tag_version}})
Description: {{product}}
ONLYOFFICE {{product}} is a new way to collaborate on documents with teams,
{{product_sysname^^}} {{product}} is a new way to collaborate on documents with teams,
clients, partners, etc., based on the concept of rooms - special spaces with
predefined permissions. Dependency package.

Expand Down Expand Up @@ -82,7 +82,7 @@ Depends: {{product}}-common (= {{package_header_tag_version}}), dotnet-sdk-8.0,
Recommends: ffmpeg, opensearch (= 2.11.1)
Description: {{product}}-notify
The service which launches additional services
related to notifications about DocSpace events:
related to notifications about {{product}} events:
NotifySenderService which sends messages from the base,
and NotifyCleanerService which removes messages

Expand Down Expand Up @@ -149,7 +149,7 @@ Depends: {{product}}-common (= {{package_header_tag_version}}), nodejs (>= 16),
Description: {{product}}-ssoauth
The service responsible for enabling and configuring
SAML-based single sign-on (SSO) authentication to provide a more quick,
easy and secure way to access DocSpace for users
easy and secure way to access {{product}} for users

Package: {{product}}-backup-background
Architecture: all
Expand Down
6 changes: 3 additions & 3 deletions install/deb/debian/copyright
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ONLYOFFICE-{{product}}
Source: http://onlyoffice.com
Upstream-Name: {{product_sysname^^}}-{{product}}
Source: http://{{url}}

Files: *
Copyright: 2023, Ascensio System SIA <[email protected]>
Copyright: 2023, {{vendor}} <{{support_email}}>
License: AGPL-3
This program is a free software product. You can redistribute it and/or
modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
6 changes: 3 additions & 3 deletions install/deb/debian/po/ru.po
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
msgid ""
msgstr ""
"Project-Id-Version: {{product}}\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"Report-Msgid-Bugs-To: {{support_email}}\n"
"POT-Creation-Date: 2023-01-24 18:30+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Ascensio System SIA <[email protected]>\n"
"Language-Team: Ascensio System SIA <[email protected]>\n"
"Last-Translator: {{vendor}} <{{support_email}}>\n"
"Language-Team: {{vendor}} <{{support_email}}>\n"
"Language: ru_RU\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down
2 changes: 1 addition & 1 deletion install/deb/debian/po/templates.pot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: {{product}}\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"Report-Msgid-Bugs-To: {{support_email}}\n"
"POT-Creation-Date: 2023-01-24 18:26+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Expand Down
6 changes: 3 additions & 3 deletions install/deb/debian/product-common.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

set -e

if ! cat /etc/passwd | grep -q "onlyoffice:"; then
adduser --quiet --home /var/www/{{product}} --system --group onlyoffice
if ! cat /etc/passwd | grep -q "{{product_sysname}}:"; then
adduser --quiet --home /var/www/{{product}} --system --group {{product_sysname}}
fi

if ! cat /etc/group | grep -q "nginx:"; then
Expand All @@ -17,6 +17,6 @@ if ! cat /etc/passwd | grep -q "nginx:"; then
usermod -aG nginx nginx
fi

usermod -aG onlyoffice,nginx onlyoffice
usermod -aG {{product_sysname}},nginx {{product_sysname}}

#DEBHELPER#
8 changes: 4 additions & 4 deletions install/deb/debian/product-proxy.install
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## COPY PUBLIC ##
debian/build/buildtools/install/common/{{product}}-ssl-setup usr/bin
debian/build/buildtools/install/docker/config/nginx/templates/*.template etc/onlyoffice/{{product}}/openresty
debian/build/buildtools/install/docker/config/nginx/templates/*.template etc/{{product_sysname}}/{{product}}/openresty
debian/build/buildtools/config/nginx/html/*.html etc/openresty/html
debian/build/buildtools/install/docker/config/nginx/onlyoffice* etc/openresty/conf.d
debian/build/buildtools/config/nginx/onlyoffice*.conf etc/openresty/conf.d
debian/build/buildtools/install/docker/config/nginx/{{product_sysname}}* etc/openresty/conf.d
debian/build/buildtools/config/nginx/{{product_sysname}}*.conf etc/openresty/conf.d
debian/build/buildtools/install/docker/config/nginx/letsencrypt* etc/openresty/includes
debian/build/buildtools/config/nginx/includes/onlyoffice*.conf etc/openresty/includes
debian/build/buildtools/config/nginx/includes/{{product_sysname}}*.conf etc/openresty/includes
debian/build/publish/web/public/* var/www/{{product}}/public
debian/build/publish/web/client/* var/www/{{product}}/client
4 changes: 2 additions & 2 deletions install/deb/debian/product-proxy.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -e

# (DS v1.1.3) Removing old nginx configs to prevent conflicts before upgrading on OpenResty.
if [ -f /etc/nginx/conf.d/onlyoffice.conf ]; then
rm -rf /etc/nginx/conf.d/onlyoffice*
if [ -f /etc/nginx/conf.d/{{product_sysname}}.conf ]; then
rm -rf /etc/nginx/conf.d/{{product_sysname}}*
systemctl reload nginx
fi

Expand Down
19 changes: 10 additions & 9 deletions install/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export DH_OPTIONS=-v
dh $@ --with=systemd

PRODUCT={{product}}
PRODUCT_SYSNAME={{product_sysname}}
SOURCE_PATH=${CURDIR}/debian/source
BUILD_PATH=${CURDIR}/debian/build
BUILDTOOLS_PATH=${BUILD_PATH}/buildtools
Expand Down Expand Up @@ -50,7 +51,7 @@ check_archives:

override_dh_auto_build: check_archives
cd ${BUILDTOOLS_PATH}/install/common/systemd; \
bash build.sh -bp "${CURDIR}/debian/"; \
bash build.sh -bp "${CURDIR}/debian/" -p ${PRODUCT} -ps ${PRODUCT_SYSNAME}; \
cd ${BUILDTOOLS_PATH}/install/common; \
bash build-frontend.sh -sp ${BUILD_PATH} -di "false"; \
bash build-backend.sh -sp ${BUILD_PATH}; \
Expand All @@ -61,11 +62,11 @@ override_dh_auto_build: check_archives
find ${BUILD_PATH}/**/publish/ \
-depth -type f -regex '.*\(eslintrc.*\|npmignore\|gitignore\|gitattributes\|gitmodules\|un~\|DS_Store\)' -exec rm -f {} \;

rm -f ${BUILDTOOLS_PATH}/config/nginx/onlyoffice-login.conf
rm -f ${BUILDTOOLS_PATH}/config/nginx/${PRODUCT_SYSNAME}-login.conf

if ! grep -q 'var/www/${PRODUCT}' ${BUILDTOOLS_PATH}/config/nginx/*.conf; then find ${BUILDTOOLS_PATH}/config/nginx/ -name "*.conf" -exec sed -i "s@\(var/www/\)@\1${PRODUCT}/@" {} +; fi

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

find ${BUILDTOOLS_PATH}/config/ -type f -regex '.*\.\(test\|dev\).*' -delete
Expand All @@ -74,21 +75,21 @@ override_dh_auto_build: check_archives
sed 's_\(minlevel=\)"[^"]*"_\1"Warn"_g' -i ${BUILDTOOLS_PATH}/config/nlog.config

sed -e 's_etc/nginx_etc/openresty_g' -e 's/listen\s\+\([0-9]\+\);/listen 127.0.0.1:\1;/g' -i ${BUILDTOOLS_PATH}/config/nginx/*.conf
sed -i "s#\$$public_root#/var/www/${PRODUCT}/public/#g" ${BUILDTOOLS_PATH}/config/nginx/onlyoffice.conf
sed 's/teamlab.info/onlyoffice.com/g' -i ${BUILDTOOLS_PATH}/config/autofac.consumers.json
sed -i "s#\$$public_root#/var/www/${PRODUCT}/public/#g" ${BUILDTOOLS_PATH}/config/nginx/${PRODUCT_SYSNAME}.conf
sed 's/teamlab.info/{{url}}/g' -i ${BUILDTOOLS_PATH}/config/autofac.consumers.json
json -I -f ${CLENT_PATH}/public/scripts/config.json -e "this.wrongPortalNameUrl=\"\""
sed -e 's/$$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy*.conf
sed -e 's/$$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy*.conf
sed "s_\(.*root\).*;_\1 \"/var/www/${PRODUCT}\";_g" -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/letsencrypt.conf
sed -e '/.pid/d' -e '/temp_path/d' -e 's_etc/nginx_etc/openresty_g' -e 's/\.log/-openresty.log/g' -i ${BUILDTOOLS_PATH}/install/docker/config/nginx/templates/nginx.conf.template
mv -f ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy-ssl.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy-ssl.conf.template
cp -rf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/onlyoffice-proxy.conf.template
mv -f ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy-ssl.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy-ssl.conf.template
cp -rf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy.conf ${BUILDTOOLS_PATH}/install/docker/config/nginx/${PRODUCT_SYSNAME}-proxy.conf.template

for i in ${PRODUCT} $$(ls ${CURDIR}/debian/*.install | grep -oP 'debian/\K.*' | grep -o '^[^.]*'); do \
cp ${CURDIR}/debian/source/lintian-overrides ${CURDIR}/debian/$$i.lintian-overrides; \
done

execute_after_dh_fixperms:
chmod o-rwx ${CURDIR}/debian/${PRODUCT}-common/etc/onlyoffice/${PRODUCT}/*
chmod o-rwx ${CURDIR}/debian/${PRODUCT}-common/etc/${PRODUCT_SYSNAME}/${PRODUCT}/*

override_dh_auto_install:
dh_systemd_enable --no-enable
Expand Down
12 changes: 6 additions & 6 deletions install/rpm/SPECS/build.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

cd %{_builddir}/buildtools

bash install/common/systemd/build.sh -pm "rpm"
bash install/common/systemd/build.sh -pm "rpm" -p %{product} -ps %{product_sysname}

bash install/common/build-frontend.sh --srcpath %{_builddir} -di "false"
bash install/common/build-backend.sh --srcpath %{_builddir}
bash install/common/publish-backend.sh --srcpath %{_builddir}/server

rename -f -v "s/product([^\/]*)$/%{product}\$1/g" install/common/*

rm -f config/nginx/onlyoffice-login.conf
rm -f config/nginx/%{product_sysname}-login.conf
find config/ -type f -regex '.*\.\(test\|dev\).*' -delete

if ! grep -q 'var/www/%{product}' config/nginx/*.conf; then find config/nginx/ -name "*.conf" -exec sed -i "s@\(var/www/\)@\1%{product}/@" {} +; fi

json -I -f config/appsettings.services.json -e "this.logPath=\"/var/log/onlyoffice/%{product}\"" -e "this.socket={ 'path': '../ASC.Socket.IO/' }" \
json -I -f config/appsettings.services.json -e "this.logPath=\"/var/log/%{product_sysname}/%{product}\"" -e "this.socket={ 'path': '../ASC.Socket.IO/' }" \
-e "this.ssoauth={ 'path': '../ASC.SsoAuth/' }" -e "this.logLevel=\"warning\"" -e "this.core={ 'products': { 'folder': '%{buildpath}/products', 'subfolder': 'server'} }"
json -I -f config/appsettings.json -e "this.core.notify.postman=\"services\"" -e "this['debug-info'].enabled=\"false\"" -e "this.web.samesite=\"None\""
json -I -f config/apisystem.json -e "this.core.notify.postman=\"services\""
json -I -f %{_builddir}/publish/web/public/scripts/config.json -e "this.wrongPortalNameUrl=\"\""

sed 's_\(minlevel=\)"[^"]*"_\1"Warn"_g' -i config/nlog.config
sed 's/teamlab.info/onlyoffice.com/g' -i config/autofac.consumers.json
sed 's/teamlab.info/%{product_sysname}.com/g' -i config/autofac.consumers.json

sed -e 's_etc/nginx_etc/openresty_g' -e 's/listen\s\+\([0-9]\+\);/listen 127.0.0.1:\1;/g' -i config/nginx/*.conf
sed -i "s#\$public_root#/var/www/%{product}/public/#g" config/nginx/onlyoffice.conf
sed -e 's/$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i install/docker/config/nginx/onlyoffice-proxy*.conf
sed -i "s#\$public_root#/var/www/%{product}/public/#g" config/nginx/%{product_sysname}.conf
sed -e 's/$router_host/127.0.0.1/g' -e 's/this_host\|proxy_x_forwarded_host/host/g' -e 's/proxy_x_forwarded_proto/scheme/g' -e 's/proxy_x_forwarded_port/server_port/g' -e 's_includes_/etc/openresty/includes_g' -i install/docker/config/nginx/%{product_sysname}-proxy*.conf
sed -e '/.pid/d' -e '/temp_path/d' -e 's_etc/nginx_etc/openresty_g' -e 's/\.log/-openresty.log/g' -i install/docker/config/nginx/templates/nginx.conf.template
sed -i "s_\(.*root\).*;_\1 \"/var/www/%{product}\";_g" -i install/docker/config/nginx/letsencrypt.conf

Expand Down
Loading