www/hedgedoc: NEW PORT web-hosted markdown doc editor

Reviewed by:	Mina Galić <me@igalic.co>
Sponsored by:	SkunkWerks, GmbH
Differential Revision:	https://reviews.freebsd.org/D38058
This commit is contained in:
Dave Cottlehuber 2023-01-19 10:27:18 +00:00
parent 42c3a1cef8
commit bf62ddf259
9 changed files with 16501 additions and 2 deletions

2
GIDs
View File

@ -257,7 +257,7 @@ _fastdfs:*:313:
promscale:*:314:
lavinmq:*:315:
nut:*:316:
# free: 317
hedgedoc:*:317:
# free: 318
# free: 319
# free: 320

2
UIDs
View File

@ -262,7 +262,7 @@ _fastdfs:*:313:313::0:0:FastDFS Owner:/nonexistent:/usr/sbin/nologin
promscale:*:314:314::0:0:Promscale:/nonexistent:/usr/sbin/nologin
lavinmq:*:315:315::0:0:LavinMQ user:/nonexistent:/usr/sbin/nologin
nut:*:316:316::0:0:Network UPS Tools user:/nonexistent:/usr/sbin/nologin
# free: 317
hedgedoc:*:317:317::0:0:HedgeDoc user:/nonexistent:/usr/sbin/nologin
# free: 318
# free: 319
# free: 320

View File

@ -218,6 +218,7 @@
SUBDIR += h2o
SUBDIR += h2o-devel
SUBDIR += habari
SUBDIR += hedgedoc
SUBDIR += hiawatha
SUBDIR += hiawatha-monitor
SUBDIR += horde-ansel

117
www/hedgedoc/Makefile Normal file
View File

@ -0,0 +1,117 @@
PORTNAME= hedgedoc
DISTVERSION= 1.9.6
CATEGORIES= www editors
MASTER_SITES= https://github.com/${PORTNAME}/${PORTNAME}/releases/download/${DISTVERSION}/ \
https://nodejs.org/download/release/v${NODEJS_VERSION}/:node \
LOCAL/dch:yarn
DISTFILES+= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} \
${_YARN_TARBALL}:yarn \
node-v${NODEJS_VERSION}-headers.tar.gz:node
MAINTAINER= dch@FreeBSD.org
COMMENT= Web-based online collaborative editor using your preferred SQL DB
WWW= https://hedgedoc.org/
LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= git:devel/git \
npm:www/npm-node16 \
sqlite3:databases/sqlite3 \
yarn:www/yarn-node16
USES= nodejs:16,run,build python:build shebangfix
USE_RC_SUBR= ${PORTNAME}
SHEBANG_FILES= ${WRKSRC}/bin/*
PORTSCOUT= site:https://github.com/${PORTNAME}/${PORTNAME}/releases
USERS= hedgedoc
GROUPS= hedgedoc
PLIST_SUB+= ARCH=${ARCH:S/aarch64/arm64/:S/amd64/x64/}
OPTIONS_DEFINE= DOCS
OPTIONS_SUB= yes
NODEJS_VERSION= 16.19.0
_YARNRC= ${_YARN_HOME}/yarnrc
_YARN_BIN= ${LOCALBASE}/bin/yarn
_YARN_CACHE= ${_YARN_HOME}/.cache
_YARN_CMD= ${SETENV} ${_YARN_ENV} ${_YARN_BIN} ${_YARN_FLAGS}
_YARN_CWD= ${WRKSRC}
_YARN_ENV= HOME=${_YARN_HOME} NODE_ENV=production \
NPM_CONFIG_TARBALL=${DISTDIR}/node-v${NODEJS_VERSION}-headers.tar.gz \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true PYTHON=${PYTHON_CMD}
_YARN_FLAGS= --skip-integrity-check --noninteractive --no-node-version-check \
--no-default-rc --cwd ${_YARN_CWD} --cache-folder \
${_YARN_CACHE} --use-yarnrc ${_YARNRC} --no-progress --silent \
--frozen-lockfile
_YARN_HOME= ${WRKDIR}/yarn
_YARN_MIRROR= ${_YARN_HOME}/mirror
_YARN_TARBALL= ${DISTNAME}-yarn-cache.txz
# helper creates a tarball that pre-populates the yarn cache
# upload to your freefall public_distfiles/ location
tarball: patch
@${RM} -r ${_YARN_MIRROR}
(cd ${WRKSRC} && \
${_YARN_CMD} --ignore-scripts)
(cd ${WRKDIR} && \
${TAR} cvaf ${_YARN_TARBALL} yarn/mirror)
rsync: tarball
@rsync -Phivl --inplace ${WRKDIR}/${_YARN_TARBALL} freefall:public_distfiles/
post-extract:
@${MV} ${WRKDIR}/${PORTNAME} \
${WRKSRC}
post-patch:
@${MKDIR} ${_YARN_MIRROR}
@${ECHO_CMD} 'yarn-offline-mirror "${_YARN_MIRROR}"' > ${_YARNRC}
do-build:
(cd ${WRKSRC} && \
${_YARN_CMD} --offline install)
# remove temporary build garbage and unnecessary runtime files
(cd ${WRKSRC} && \
${RM} -r .babelrc .editorconfig .eslint* .mailmap .remarkrc \
.yarn* node_modules/*/deps node_modules/*/man node_modules/.bin \
node_modules/.yarn* node_modules/@mapbox/node-pre-gyp/node_modules/.bin \
node_modules/bufferutil/binding.gyp node_modules/bufferutil/build/Makefile \
node_modules/bufferutil/build/Release/.deps node_modules/bufferutil/build/Release/obj.target \
node_modules/bufferutil/build/config.gypi node_modules/bufferutil/build/node_gyp_bins \
node_modules/bufferutil/node_modules node_modules/bufferutil/prebuilds \
node_modules/bufferutil/src node_modules/node-addon-api \
node_modules/node-gyp* node_modules/sqlite3/build-tmp-napi-v6 \
node_modules/sqlite3/deps node_modules/sqlite3/node-addon-api \
node_modules/sqlite3/node_modules node_modules/sqlite3/src \
node_modules/utf-8-validate/binding.gyp node_modules/utf-8-validate/build/Makefile \
node_modules/utf-8-validate/build/Release/.deps node_modules/utf-8-validate/prebuilds/ \
node_modules/utf-8-validate/build/Release/obj.target \
node_modules/utf-8-validate/build/config.gypi node_modules/utf-8-validate/build/node_gyp_bins \
node_modules/utf-8-validate/node_modules node_modules/utf-8-validate/src \
renovate.json test webpack.*)
${FIND} -E ${WRKSRC}/node_modules -regex '.+\.(Makefile|mk|\.d|targ|info|gyp)$$' \
-print -delete
${FIND} ${WRKSRC}/node_modules -name '*.node' -print -exec ${STRIP_CMD} \
{} +
${MV} ${WRKSRC}/docs ${WRKDIR}/docs
do-install:
${MKDIR} ${STAGEDIR}${ETCDIR} \
${STAGEDIR}${DOCSDIR} \
${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/bin \
${STAGEDIR}/var/db/hedgedoc/uploads
(cd ${WRKSRC} && \
${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/libexec/${PORTNAME})
(cd ${WRKSRC} && \
${COPYTREE_BIN} bin ${STAGEDIR}${PREFIX}/libexec/${PORTNAME})
(cd ${WRKDIR}/docs && \
${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})
${INSTALL_DATA} ${WRKSRC}/config.json.example \
${STAGEDIR}${ETCDIR}/config.json.sample
.include <bsd.port.mk>

7
www/hedgedoc/distinfo Normal file
View File

@ -0,0 +1,7 @@
TIMESTAMP = 1673868019
SHA256 (hedgedoc-1.9.6.tar.gz) = dfd0fca006f9075f072df058476ea542adb32b63964afb2985211e1114ab333e
SIZE (hedgedoc-1.9.6.tar.gz) = 61081612
SHA256 (hedgedoc-1.9.6-yarn-cache.txz) = e281c71d06c226b8c67aee842d845a2fa148ffc8b1654753c383774d05c8ca80
SIZE (hedgedoc-1.9.6-yarn-cache.txz) = 181553780
SHA256 (node-v16.19.0-headers.tar.gz) = d0b02ce3d1198d41127daf64f204195252abff6a22da70830aaed846ba6ad864
SIZE (node-v16.19.0-headers.tar.gz) = 568145

View File

@ -0,0 +1,54 @@
#!/bin/sh
# PROVIDE: hedgedoc
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable hedgedoc
#
# hedgedoc_enable (bool): set to NO by default
# hedgedoc_config (string): optional full path to config.json
# hedgedoc_port (string): optional HTTP port
# hedgedoc_user (string): optional user to run as
# hedgedoc_group (string): optional user to run as
. /etc/rc.subr
name="hedgedoc"
rcvar="hedgedoc_enable"
load_rc_config $name
: ${hedgedoc_enable="NO"}
: ${hedgedoc_config:="%%ETCDIR%%/config.json"}
: ${hedgedoc_port:="3000"}
: ${hedgedoc_user:="hedgedoc"}
: ${hedgedoc_group:="hedgedoc"}
: ${hedgedoc_chdir="%%LOCALBASE%%/libexec/hedgedoc"}
: ${hedgedoc_opts="NODE_ENV=production \
HOME=/var/db/hedgedoc \
CMD_PORT=${hedgedoc_port} \
CMD_CONFIG_FILE=${hedgedoc_config}"}
pidfile="/var/run/${name}/${name}.pid"
hedgedoc_nodejs_pidfile="/var/run/${name}/${name}.node"
start_precmd="hedgedoc_start_precmd"
required_files="${hedgedoc_config}"
hedgedoc_start_precmd()
{
if [ ! -d "/var/run/${name}" ]; then
install -d -m 0750 -o ${hedgedoc_user} -g ${hedgedoc_group} "/var/run/${name}"
install -o ${hedgedoc_user} /dev/null ${pidfile}
install -o ${hedgedoc_user} /dev/null ${hedgedoc_nodejs_pidfile}
fi
}
command="/usr/sbin/daemon"
command_args="-t hedgedoc -T hedgedoc \
-P ${pidfile} \
-p ${hedgedoc_nodejs_pidfile} \
-r -R 15 \
/usr/bin/env ${hedgedoc_opts} /usr/local/bin/node app.js"
run_rc_command "$1"

View File

@ -0,0 +1,40 @@
[
{ type: install
message: <<EOM
Congratulations, you have installed Hedgedoc!
To enable hedgedoc you need to add following to your /etc/rc.conf:
hedgedoc_enable=YES
# hedgedoc_port=3000
- config samples are located in %%PREFIX%%/etc/hedgedoc/
- customise config.json before running %%PORTNAME%%
- most settings can be provided in the json file, or via env vars
- the sqlite database option stores files in /var/db/%%PORTNAME%%
- using a reverse proxy in front of %%PORTNAME%% is strongly advised;
see https://docs.hedgedoc.org/guides/reverse-proxy/ for details
- the default HTTP port is 3000
After installation, modify config.json to match your site, referring
to docs or to the community support forums:
https://docs.hedgedoc.org/
https://community.hedgedoc.org/
In most cases, it is sufficient to trim out all settings you do not
require, set allowOrigin, domain, host, DB, and any third-pary auth
such as ldap or github, that you require.
See https://sequelize.org/v5/manual/dialects.html for details on
configuring DB access, this port supports PostgreSQL and SQLite.
EOM
}
{ type: remove
message: <<EOM
If you wish to delete hedgedoc data, remove /var/db/hedgedoc and
%%PREFIX%%/etc/hedgedoc/ contents.
EOM
}
]

8
www/hedgedoc/pkg-descr Normal file
View File

@ -0,0 +1,8 @@
The best platform to write and share markdown.
HedgeDoc (formerly known as CodiMD) is an open-source, web-based,
self-hosted, collaborative markdown editor.
You can use it to easily collaborate on notes, graphs and even
presentations in real-time. All you need to do is to share your
note-link to your co-workers and they're ready to go.

16272
www/hedgedoc/pkg-plist Normal file

File diff suppressed because it is too large Load Diff