Friday, May 27, 2022

Re: [help wanted] productivity/monica initial setup needs some handling

On 22/05/27 06:31PM, A Tammy wrote:
> Hi,
>
> ?? I found that the port for monica needed a symlink
> `/var/www/var/www/monica -> /var/www/monica` (which I had setup on my server
> but forgot to add to PLIST).
>
> The reason this is needed is because the initial setup for monica needs to
> run the command `cd /var/www/monica && php-8.0 artisan setup:production`,
> which sets up a few configuration files which hardcode paths to locations
> for storage and cache and things. Now these locations are absolute, so they
> look like `/var/www/monica/xxx/yyy`, which php-fpm can't find when running
> in the chroot. The simplest solution is the one mentioned above, to create a
> symlink, and things work perfectly. I am not super sure how to replicate
> this inside the Makefile for the port.
>
> I'm thinking something like
>
> ln -s ${PREFIX}/www/${TRUEPREFIX}/www/monica -> ../../monica
>
> But I don't know how many levels that TRUEPREFIX can have.
> Maybe just use /var for PREFIX instead of LOCALSTATEDIR and make things
> easier ?
>
> Any suggestions?
>
> Aisha
>

patch attempting to fix this (also adds the README)


diff --git a/productivity/monica/Makefile b/productivity/monica/Makefile
index 2b0a16b7b99..8c43d40d2cf 100644
--- a/productivity/monica/Makefile
+++ b/productivity/monica/Makefile
@@ -3,6 +3,7 @@ COMMENT = self hosted personal CRM system
CATEGORIES = productivity

VERSION = 3.7.0
+REVISION = 0
PKGNAME = monica-${VERSION}

MASTER_SITES = https://github.com/monicahq/monica/releases/download/v${VERSION}/
@@ -32,12 +33,13 @@ RUN_DEPENDS = lang/php/${MODPHP_VERSION},-curl \
NO_TEST = Yes
NO_BUILD = Yes

-PREFIX = ${LOCALSTATEDIR}
+PREFIX = /var
INSTDIR = ${PREFIX}/www/monica

do-install:
- ${INSTALL_DATA_DIR} ${INSTDIR}
+ ${INSTALL_DATA_DIR} ${INSTDIR} ${PREFIX}/www/var/www
cp -a ${WRKSRC}/. ${INSTDIR}
rm ${INSTDIR}/vendor/sabre/dav/bin/googlecode_upload.py
+ ln -s ../../monica ${PREFIX}/www/var/www/monica

.include <bsd.port.mk>
diff --git a/productivity/monica/pkg/PLIST b/productivity/monica/pkg/PLIST
index d9600c56c9e..8c4cb65f611 100644
--- a/productivity/monica/pkg/PLIST
+++ b/productivity/monica/pkg/PLIST
@@ -717,7 +717,7 @@ www/monica/app/ViewHelpers/ContactHelper.php
www/monica/artisan
www/monica/bootstrap/
www/monica/bootstrap/app.php
-@mode 775
+@mode 770
@owner www
@group www
www/monica/bootstrap/cache/
@@ -20335,3 +20335,8 @@ www/monica/vendor/xantios/mimey/tests/src/MimeMappingGeneratorTest.php
www/monica/vendor/xantios/mimey/tests/src/MimeTypesTest.php
www/monica/webpack.mix.js
www/monica/yarn.lock
+www/var/
+www/var/www/
+www/var/www/monica
+@cwd ${LOCALBASE}
+share/doc/pkg-readmes/${PKGSTEM}

No comments:

Post a Comment