Bug 268526 - databases/neo4j: port partially broken and does not separate installation from runtime data
Summary: databases/neo4j: port partially broken and does not separate installation fro...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Wen Heping
URL:
Keywords: needs-qa
Depends on: 228532
Blocks:
  Show dependency treegraph
 
Reported: 2022-12-23 13:20 UTC by Michael Osipov
Modified: 2023-01-19 10:55 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (wen)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2022-12-23 13:20:04 UTC
I don't know where to start, there are several issues where I have a problem to use this port, likely I need to break up in several tickets later. (note: I have gone through this with devel/nexus2-oss as a maintainer).

* It does not start, JAVA_HOME is not set in neo4j.sh since JAVA_HOME is only set when the java(1) wrapper is called which isn't done in neo4j.sh:
===
# service neo4j start
Error: JAVA_HOME is not defined correctly.
  We cannot execute
===
This I had to work around in rc.conf first (neo4j_env)
* The service runs as root which is a no-go. You must reverse a uid/gid in UIDs/GIDs files.
* The neo4j.conf file is never used due to misconfiguration:
* Lack of separation between read-only installation and runtime data:
===
# service neo4j start
Directories in use:
home:         /usr/local/neo4j
config:       /usr/local/neo4j/conf
logs:         /usr/local/neo4j/logs
plugins:      /usr/local/neo4j/plugins
import:       /usr/local/neo4j
data:         /usr/local/neo4j/data
certificates: /usr/local/neo4j/certificates
licenses:     /usr/local/neo4j/licenses
run:          /usr/local/neo4j/run
===
because of
===
# procstat penv 43356 | grep ENV
envp[13]: NEO4J_CONF_ENV=NEO4J_CONF=/usr/local/etc
===
does not work and does not exist: https://github.com/neo4j/neo4j/search?q=NEO4J_CONF_ENV
This I had to work around in rc.conf first (neo4j_env).
Then
===
Directories in use:
home:         /usr/local/neo4j
config:       /usr/local/etc
logs:         /var/log/neo4j
plugins:      /usr/local/neo4j/plugins
import:       /usr/local/neo4j/import
data:         /var/db/neo4j
certificates: /usr/local/neo4j/certificates
licenses:     /usr/local/neo4j/licenses
run:          /var/run
===
Still, certificates doe not correspond to pkg-plist, likely licenes should be in ETCDIR as well.
* post-patch either too many vars which aren't even defined or patch-* don't add them. See missing JAVA_HOME. This is actually rooted in a bad script of the appassembler-maven-plugin which I might address upstream somewhere in the future.

Maybe even more things I haven't taken care of/noticed ATM.

I used this for reference for dirs/files and ro vs rw: https://neo4j.com/docs/operations-manual/4.4/configuration/file-locations/

I am not the target neo4j user, but just the sysadmin and software developer.

Ideally, this would would install configure

/usr/local/share/java/neo4j (owned by root)
===== (owned by neo4j:neo4j)
/var/db/neo4j/data
/var/run/neo4j (can't be run/ because service user cannot write to run/)
/var/log/neo4j
/var/db/neo4j/metrics
/var/db/neo4j/import
===== (owned by root)
/usr/local/etc/neo4j/
/usr/local/etc/neo4j/neo4j.conf
/usr/local/etc/neo4j/licenses
/usr/local/etc/neo4j/certificates
=====

At least this is basically how I have taken devel/nexus2-oss apart and upgrading is a snap.


I'd be happy to engage into a discussion to make this right according to hier(7).
Comment 1 Michael Osipov 2022-12-23 13:52:02 UTC
Alternatively:

===== (owned by neo4j:neo4j)
/var/neo4j/data
/var/run/neo4j (can't be run/ because service user cannot write to run/)
/var/log/neo4j
/var/neo4j/metrics
/var/neo4j/import

which makes more sense IMHO.
Comment 2 Wen Heping freebsd_committer freebsd_triage 2022-12-28 00:08:07 UTC
Thank your message.

I shall fix the NEO4J_CONF problem in next commit.
But I can start the neo4j server with `neo4j start`.

Any improvement patch welcomed !
Comment 3 Michael Osipov 2022-12-28 18:52:46 UTC
(In reply to Wen Heping from comment #2)

I will work on a complete patch next year in a seperate jail and poudriere also.
Comment 4 Michael Osipov 2023-01-01 22:16:56 UTC
Can this be reviewed before I start on a patch: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228532?
Comment 5 Borja Marcos 2023-01-19 10:55:26 UTC
I have a working installation and I solved some issues. So, let me know how I can help.