Skip to content

Commit

Permalink
Update nginx configs from document-server-package (#79)
Browse files Browse the repository at this point in the history
* Update nginx configs from document-server-package

* Remove escess files

* Small changes

* Update config version from archive
  • Loading branch information
romandemidov authored Sep 15, 2021
1 parent 7d63d6c commit 528b6fc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 243 deletions.
193 changes: 0 additions & 193 deletions config/ds-ssl.conf.tmpl

This file was deleted.

47 changes: 0 additions & 47 deletions config/ds.conf.tmpl

This file was deleted.

45 changes: 42 additions & 3 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ parts:
/usr/lib/update-notifier/package-data-downloader
fi
cp -r /usr/share/fonts/truetype/msttcorefonts $SNAPCRAFT_PART_INSTALL/usr/share/fonts/truetype
#temporary
rm -r $SNAPCRAFT_PART_INSTALL/core-fonts
rm -r $SNAPCRAFT_PART_INSTALL/sdkjs
rm -r $SNAPCRAFT_PART_INSTALL/sdkjs-plugins
rm -r $SNAPCRAFT_PART_INSTALL/server
rm -r $SNAPCRAFT_PART_INSTALL/web-apps
rm -r $SNAPCRAFT_PART_INSTALL/example
#
DIR="$SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver"
rm -r $DIR/server/welcome
DIR_ETC="$SNAPCRAFT_PART_INSTALL/etc/onlyoffice/documentserver"
Expand All @@ -120,6 +128,10 @@ parts:
ln -s -f $OUTDIR/sdkjs/slide/themes $DIR/sdkjs/slide/themes
ln -s -f $OUTDIR/sdkjs/common/Images/themes_thumbnail.png $DIR/sdkjs/common/Images/themes_thumbnail.png
ln -s -f $OUTDIR/sdkjs/common/Images/[email protected] $DIR/sdkjs/common/Images/[email protected]
#package version
BUILD_VERSION=`cat var/www/onlyoffice/documentserver/server/Common/sources/commondefines.js | grep "const buildVersion" | grep -o "[0-9.]*"`
BUILD_NUMBER=`cat var/www/onlyoffice/documentserver/server/Common/sources/commondefines.js | grep "const buildNumber" | grep -o "[0-9]*"`
echo $BUILD_VERSION-$BUILD_NUMBER > $SNAPCRAFT_STAGE/version
node:
plugin: dump
Expand Down Expand Up @@ -271,11 +283,14 @@ parts:
source: src/common/

ds-package:
after:
- server
plugin: nil
source: https://github.com/ONLYOFFICE/document-server-package.git
source-type: git
override-build: |
snapcraftctl build
PACKAGE_VERSION=`cat $SNAPCRAFT_STAGE/version`
#welcome page
mkdir -p $SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver/server/welcome
cp -r common/documentserver-example/welcome/css $SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver/server/welcome
Expand All @@ -284,7 +299,33 @@ parts:
sed -i -e 's/sudo supervisorctl start ds:example/sudo snap set onlyoffice-ds onlyoffice.example-enabled=true/' $SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver/server/welcome/index.html
sed -i -e '/<h3>Add it to the autostart/d' $SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver/server/welcome/index.html
sed -i -e '/<pre>sudo sed/d' $SNAPCRAFT_PART_INSTALL/var/www/onlyoffice/documentserver/server/welcome/index.html
#nginx configs
NGINX_DIR=$SNAPCRAFT_PART_INSTALL/etc/onlyoffice/documentserver/nginx
mkdir -p $NGINX_DIR/includes
##ds.conf.tmpl
cp common/documentserver/nginx/ds.conf.tmpl.m4 $NGINX_DIR/ds.conf.tmpl
sed -i -e 's/M4_NGINX_CONF/\/snap\/onlyoffice-ds\/current\/etc\/onlyoffice\/documentserver\/nginx\/includes/' $NGINX_DIR/ds.conf.tmpl
sed -i -e 's/80/DS_PORT/' $NGINX_DIR/ds.conf.tmpl
##ds-ssl.conf.tmpl
cp common/documentserver/nginx/ds-ssl.conf.tmpl.m4 $NGINX_DIR/ds-ssl.conf.tmpl
sed -i -e 's/M4_NGINX_CONF/\/snap\/onlyoffice-ds\/current\/etc\/onlyoffice\/documentserver\/nginx\/includes/' $NGINX_DIR/ds-ssl.conf.tmpl
sed -i -e 's/80/DS_PORT/' $NGINX_DIR/ds-ssl.conf.tmpl
sed -i -e 's/443/DSS_PORT/' $NGINX_DIR/ds-ssl.conf.tmpl
##ds-common.conf
cp common/documentserver/nginx/includes/ds-common.conf.m4 $NGINX_DIR/includes/ds-common.conf
sed -i -e 's/M4_NGINX_LOG/\/var\/snap\/onlyoffice-ds\/current\/var\/log\/nginx/' $NGINX_DIR/includes/ds-common.conf
##ds-docservice.conf
cp common/documentserver/nginx/includes/ds-docservice.conf.m4 $NGINX_DIR/includes/ds-docservice.conf
sed -i -e 's/M4_DS_ROOT/\/snap\/onlyoffice-ds\/current\/var\/www\/onlyoffice\/documentserver/' $NGINX_DIR/includes/ds-docservice.conf
sed -i -e "s/M4_PACKAGE_VERSION/$PACKAGE_VERSION/" $NGINX_DIR/includes/ds-docservice.conf
sed -i -e 's/M4_DEV_NULL/\/dev\/null/' $NGINX_DIR/includes/ds-docservice.conf
sed -i -e 's/M4_DS_FILES/\/var\/snap\/onlyoffice-ds\/common\/var\/lib\/onlyoffice\/documentserver/' $NGINX_DIR/includes/ds-docservice.conf
##http-common.conf
cp common/documentserver/nginx/includes/http-common.conf.m4 $NGINX_DIR/includes/http-common.conf
##ds-example.conf
cp common/documentserver-example/nginx/includes/ds-example.conf.m4 $NGINX_DIR/includes/ds-example.conf
sed -i -e 's/M4_PLATFORM/index/' $NGINX_DIR/includes/ds-example.conf
sed -i -e 's/M4_DS_EXAMLE/\/snap\/onlyoffice-ds\/current\/var\/www\/onlyoffice\/documentserver\/server/' $NGINX_DIR/includes/ds-example.conf
starter:
plugin: dump
Expand All @@ -296,8 +337,6 @@ parts:
ds-converter.conf: etc/supervisor/conf.d/ds-converter.conf
ds-example.conf: etc/supervisor/conf.d/ds-example.conf
ds.conf: etc/supervisor/conf.d/ds.conf
ds.conf.tmpl: etc/onlyoffice/documentserver/nginx/ds.conf.tmpl
ds-ssl.conf.tmpl: etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl

bin:
plugin: dump
Expand Down

0 comments on commit 528b6fc

Please sign in to comment.