aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Urankar <mikael@FreeBSD.org>2022-02-18 14:13:57 +0000
committerMikael Urankar <mikael@FreeBSD.org>2022-02-18 14:13:57 +0000
commitd8171126acd5a857c056959218c8401743971444 (patch)
tree3314de320a8ec41bdfef23bd57b513a7ffcca761
parentd7a04a034021616f80b06ce22332769a37e1799b (diff)
downloadports-d8171126acd5a857c056959218c8401743971444.tar.gz
ports-d8171126acd5a857c056959218c8401743971444.zip
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
-rw-r--r--www/onlyoffice-documentserver/Makefile22
-rw-r--r--www/onlyoffice-documentserver/files/onlyoffice.newsyslog.sample.in3
-rw-r--r--www/onlyoffice-documentserver/files/patch-document-server-package_Makefile6
-rw-r--r--www/onlyoffice-documentserver/files/pkg-message.in42
-rw-r--r--www/onlyoffice-documentserver/pkg-plist2
5 files changed, 54 insertions, 21 deletions
diff --git a/www/onlyoffice-documentserver/Makefile b/www/onlyoffice-documentserver/Makefile
index d8b498b36c48..54b084dc3d05 100644
--- a/www/onlyoffice-documentserver/Makefile
+++ b/www/onlyoffice-documentserver/Makefile
@@ -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 \
diff --git a/www/onlyoffice-documentserver/files/onlyoffice.newsyslog.sample.in b/www/onlyoffice-documentserver/files/onlyoffice.newsyslog.sample.in
new file mode 100644
index 000000000000..f532e5cec13b
--- /dev/null
+++ b/www/onlyoffice-documentserver/files/onlyoffice.newsyslog.sample.in
@@ -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
diff --git a/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile b/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
index ce2721b5599d..a358d4276f1b 100644
--- a/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
+++ b/www/onlyoffice-documentserver/files/patch-document-server-package_Makefile
@@ -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)
diff --git a/www/onlyoffice-documentserver/files/pkg-message.in b/www/onlyoffice-documentserver/files/pkg-message.in
index 5e639fc9e1f1..80fa664caa16 100644
--- a/www/onlyoffice-documentserver/files/pkg-message.in
+++ b/www/onlyoffice-documentserver/files/pkg-message.in
@@ -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.
@@ -63,4 +71,10 @@ files = %%ETCDIR%%/documentserver/supervisor/*.conf
EOM
}
+{ type: upgrade
+ message: <<EOM
+After each update, you have to generate the fonts and presentation themes:
+ # %%PREFIX%%/bin/documentserver-generate-allfonts.sh
+EOM
+}
]
diff --git a/www/onlyoffice-documentserver/pkg-plist b/www/onlyoffice-documentserver/pkg-plist
index 982087994b22..e0d2329e3500 100644
--- a/www/onlyoffice-documentserver/pkg-plist
+++ b/www/onlyoffice-documentserver/pkg-plist
@@ -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