Currently unifi starts mongodb with the symlink from bin/mongodb. This approach has several drawbacks. It is also possible to use the system mongodb startet as a system service. Which could be achieved with the following steps: 1. replace bin/mongodb from unifi directory with symlink to '/dev/null' 2. Move database from 'data/db' to mongo db path, usually '/var/lib/mongodb' and change ownership of the files to 'mongodb' 3. Start mongodb via systemd 4. Add to 'data/system.properties': db.mongo.local=false db.mongo.uri=mongodb\://127.0.0.1\:27017/ace statdb.mongo.uri=mongodb\://127.0.0.1\:27017/ace_stat unifi.db.name=ace 5. Start unifi service it should work as expected. 6. Modify SystemD Service unit to depend on mongodb Reproducible: Always
Sorry, but I am going to say NACK here. Such configuration is officially not supported by upstream and I do want to stick to upstream default behauvior. The only thing, I guess, we could do, would be some additional use flag 'external-mongodb', which does symlink mongodb to null, so you can use your own service for mongodb.
The possibility is given by the official UI-TEAM here https://community.ui.com/questions/External-MongoDB-Server/d311a8f8-43b6-4aeb-859d-eefec9dc1bbc?page=3.
When introducing a 'system mongodb' use flag is it possible to get this behaviour: 1. to add the dependency in the systemd service file for mongodb 2. to add the necessary entries to data/system.properties 3. not create the mongodb symlink or remove it
IMHO possible, if controlled by a separate use flag and not being default, I would ack. If you have something, PR are welcome. I am currently on holiday, so can't to anything for the next two weeks.
In tree.