1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-27 10:03:20 +00:00

www/onlyoffice-documentserver: Improve port.

- Option'ify the database backend and add MySQL
  - Add a newsyslog sample file (pr 261514, submitted by Martin Waschbüsch)
  - Add a missing nginx sample file (ds-ssl.conf)
  - Fix an hardcoded /usr/local in files/patch-document-server-package_Makefile
  - Improve pkg-message:
    - Add an 'upgrade' note (suggested by bapt@)
    - Add instructions to use MySQL as a database server
    - Pass the erlang-cookie option when invoking rabbitmqctl

PR:		261514
This commit is contained in:
Mikael Urankar 2022-02-18 15:13:57 +01:00
parent d7a04a0340
commit d8171126ac
5 changed files with 54 additions and 21 deletions

View File

@ -1,6 +1,7 @@
PORTNAME= onlyoffice-documentserver
DISTVERSIONPREFIX= v
DISTVERSION= 7.0.0.133
PORTREVISION= 1
CATEGORIES= www
MASTER_SITES+= LOCAL/mikael/v8/:source1 \
LOCAL/mikael/onlyoffice/:source2 \
@ -37,11 +38,10 @@ LIB_DEPENDS= libboost_regex.so:devel/boost-libs \
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}supervisor>0:sysutils/py-supervisor@${PY_FLAVOR} \
gsed:textproc/gsed \
nginx:www/nginx \
pg_dump:databases/postgresql${PGSQL_VER_NODOT}-server \
rabbitmq>0:net/rabbitmq \
webfonts>=0:x11-fonts/webfonts
USES= autoreconf:build dos2unix fakeroot gmake gnome iconv nodejs:16,build pgsql pkgconfig \
USES= autoreconf:build dos2unix fakeroot gmake gnome iconv nodejs:16,build pkgconfig \
python:3.7+,build qt:5
USE_QT= qmake_build
USE_GITHUB= yes
@ -73,6 +73,14 @@ GH_TUPLE= ONLYOFFICE:core:v${DISTVERSION}:core/core \
hackers-painters:katana-parser:499118d3:hackers_painters_katana/core/Common/3dParty/html/katana-parser \
google:gumbo-parser:aa91b27:google_gumbo/core/Common/3dParty/html/gumbo-parser
OPTIONS_SINGLE= DB
OPTIONS_SINGLE_DB= MYSQL PGSQL
OPTIONS_DEFAULT= PGSQL
MYSQL_USES+= mysql:server
PGSQL_USES+= pgsql
PGSQL_VARS= WANT_PGSQL=server
BINARY_ALIAS= python=${PYTHON_CMD}
USE_LDCONFIG= yes
@ -87,7 +95,8 @@ GROUPS= ${DS_GROUPNAME}
PLIST_SUB= DS_GROUPNAME=${DS_GROUPNAME} \
DS_USERNAME=${DS_USERNAME}
SUB_FILES= pkg-message
SUB_FILES= pkg-message \
onlyoffice.newsyslog.sample
SUB_LIST= ETCDIR=${ETCDIR} \
PREFIX=${PREFIX} \
WWWDIR=${WWWDIR}
@ -150,6 +159,8 @@ post-patch:
${WRKSRC}/document-server-package/common/documentserver/bin/documentserver-update-securelink.sh.m4
@${REINPLACE_CMD} 's|%%DISTDIR%%|${DISTDIR}|' \
${WRKSRC}/web-apps/build/patches/optipng-bin+5.1.0.patch
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' -e 's|%%ETCDIR%%|${ETCDIR}|' \
${WRKSRC}/document-server-package/Makefile
@${RM} ${WRKSRC}/web-apps/build/patches/optipng-bin+5.1.0.patch.orig
@${FIND} ${WRKSRC}/server -type f -name npm-shrinkwrap.json -delete
@ -194,12 +205,15 @@ do-install:
${RM} ${WRKSRC}/document-server-package/common/documentserver/config/*-mac.json ${WRKSRC}/document-server-package/common/documentserver/config/*-windows.json
cd ${WRKSRC}/document-server-package/common/documentserver/supervisor && ${COPYTREE_SHARE} . ${STAGEDIR}${ETCDIR}/documentserver/supervisor "-name *\.conf"
cd ${WRKSRC}/document-server-package/common/documentserver/logrotate && ${COPYTREE_SHARE} . ${STAGEDIR}${ETCDIR}/documentserver/logrotate "-name *\.conf"
.for f in ds.conf includes/http-common.conf includes/ds-common.conf includes/ds-docservice.conf includes/ds-letsencrypt.conf
@${CP} ${WRKSRC}/document-server-package/common/documentserver/nginx/ds-ssl.conf.tmpl ${WRKSRC}/document-server-package/common/documentserver/nginx/ds-ssl.conf
.for f in ds.conf ds-ssl.conf includes/http-common.conf includes/ds-common.conf includes/ds-docservice.conf includes/ds-letsencrypt.conf
${INSTALL_DATA} ${WRKSRC}/document-server-package/common/documentserver/nginx/${f} ${STAGEDIR}${ETCDIR}/documentserver/nginx/${f}.sample
.endfor
cd ${WRKSRC}/document-server-package/common/documentserver/nginx/includes && ${COPYTREE_SHARE} . ${STAGEDIR}${ETCDIR}/documentserver/nginx/includes "-name *\.conf"
cd ${WRKSRC}/document-server-package/common/documentserver/config && ${COPYTREE_SHARE} . ${STAGEDIR}${ETCDIR}/documentserver
${INSTALL_DATA} ${FILESDIR}/local.json.sample ${STAGEDIR}${ETCDIR}/documentserver
${MKDIR} ${STAGEDIR}/${ETCDIR}/documentserver/newsyslog.conf.d
${INSTALL_DATA} ${WRKDIR}/onlyoffice.newsyslog.sample ${STAGEDIR}/${ETCDIR}/documentserver/newsyslog.conf.d
# create missing dir
${MKDIR} ${STAGEDIR}/var/log/onlyoffice/documentserver/docservice \

View File

@ -0,0 +1,3 @@
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/onlyoffice/documentserver/{converter,docservice,metrics}/*.log %%DS_USERNAME%%:%%DS_GROUPNAME%% 644 7 * @T00 BGJ /var/run/supervisor/supervisord.pid
/var/log/onlyoffice/documentserver/nginx.error.log root:wheel 644 7 * @T00 BGJ /var/run/nginx.pid

View File

@ -12,11 +12,11 @@
+ AR := 7z a -y
+ PACKAGES = tar
+ DS_PREFIX := $(COMPANY_NAME_LOW)/$(PRODUCT_SHORT_NAME_LOW)
+ NGINX_CONF := /usr/local/etc/nginx/includes
+ NGINX_CONF := %%ETCDIR%%/documentserver/nginx/includes
+ NGINX_LOG := /var/log/$(DS_PREFIX)
+ DS_ROOT := /usr/local/www/$(DS_PREFIX)
+ DS_ROOT := %%LOCALBASE%%/www/$(DS_PREFIX)
+ DS_FILES := /var/db/$(DS_PREFIX)
+ DS_EXAMLE := /usr/local/www/$(DS_PREFIX)-example
+ DS_EXAMLE := %%LOCALBASE%%/www/$(DS_PREFIX)-example
+ DEV_NULL := /dev/null
+ endif
ifeq ($(UNAME_S),Darwin)

View File

@ -19,25 +19,33 @@ upgrade Document Server to a new version and all your changes will be lost.
Optionally in case of a jail with local IP and no internet access:
update /etc/hosts in order to resolve your nextcloud server to its local IP
2. Configure PostgreSQL server (don't forget to change the password):
# service postgresql initdb
# service postgresql start
# psql -U postgres -c "CREATE DATABASE onlyoffice;"
# psql -U postgres -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
# psql -U postgres -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
# psql -hlocalhost -Uonlyoffice -d onlyoffice -f %%WWWDIR%%/documentserver/server/schema/postgresql/createdb.sql
2. Set up the database (either PostgreSQL or MySQL):
For PostgreSQL (don't forget to change the password):
# service postgresql initdb
# service postgresql start
# psql -U postgres -c "CREATE DATABASE onlyoffice;"
# psql -U postgres -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
# psql -U postgres -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
# psql -hlocalhost -Uonlyoffice -d onlyoffice -f %%WWWDIR%%/documentserver/server/schema/postgresql/createdb.sql
Optionally in case of a jail with local IP:
update /var/db/postgres/data13/pg_hba.conf accordingly
Optionally in case of a jail with local IP:
update /var/db/postgres/data13/pg_hba.conf accordingly
For MySQL don't forget to change the password):
# service mysql-server start
# mysql -u root -p -e "CREATE DATABASE onlyoffice DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
# mysql -u root -p -e "CREATE USER 'onlyoffice'@'localhost' IDENTIFIED BY 'onlyoffice';"
# mysql -u root -p -e mysql -u root -p -e "GRANT ALL privileges ON onlyoffice.* TO 'onlyoffice'@'localhost';"
# mysql -u onlyoffice -p < %%WWWDIR%%/documentserver/server/schema/mysql/createdb.sql
3. Create a new rabbitmq user for the ONLYOFFICE Document Server configuration (don't forget to change the password):
# service rabbitmq start
# rabbitmqctl add_user onlyoffice password
# rabbitmqctl set_user_tags onlyoffice administrator
# rabbitmqctl set_permissions -p / onlyoffice ".*" ".*" ".*"
# rabbitmqctl --erlang-cookie `cat /var/db/rabbitmq/.erlang.cookie` add_user onlyoffice password
# rabbitmqctl --erlang-cookie `cat /var/db/rabbitmq/.erlang.cookie` set_user_tags onlyoffice administrator
# rabbitmqctl --erlang-cookie `cat /var/db/rabbitmq/.erlang.cookie` set_permissions -p / onlyoffice ".*" ".*" ".*"
and change it in %%ETCDIR%%/documentserver/local.json accordingly.
4. Setup supervisord in order to execute documentserver services:
4. Set up supervisord in order to execute documentserver services:
- let supervisord.conf load files contained in this directory by adding to
%%PREFIX%%/etc/supervisord.conf:
[include]
@ -46,7 +54,7 @@ files = %%ETCDIR%%/documentserver/supervisor/*.conf
- start supervisord:
# service supervisord start
5. Setup nginx:
5. Set up nginx:
- nginx sample configuration files are located in: %%ETCDIR%%/documentserver/nginx
Do not edit them as they will be restored everytime the port is updated.
@ -61,6 +69,12 @@ files = %%ETCDIR%%/documentserver/supervisor/*.conf
8. Enjoy.
EOM
}
{ type: upgrade
message: <<EOM
After each update, you have to generate the fonts and presentation themes:
# %%PREFIX%%/bin/documentserver-generate-allfonts.sh
EOM
}
]

View File

@ -8,7 +8,9 @@ bin/documentserver-update-securelink.sh
%%ETCDIR%%/documentserver/log4js/development.json
%%ETCDIR%%/documentserver/log4js/production.json
%%ETCDIR%%/documentserver/logrotate/ds.conf
@sample %%ETCDIR%%/documentserver/newsyslog.conf.d/onlyoffice.newsyslog.sample
@sample %%ETCDIR%%/documentserver/nginx/ds.conf.sample
@sample %%ETCDIR%%/documentserver/nginx/ds-ssl.conf.sample
@sample %%ETCDIR%%/documentserver/nginx/includes/ds-common.conf.sample
@sample %%ETCDIR%%/documentserver/nginx/includes/ds-docservice.conf.sample
@sample %%ETCDIR%%/documentserver/nginx/includes/ds-letsencrypt.conf.sample