I'd like to run MongoDB on my development machine whenever the Port 27017 requested but not before that. I already got parts of the file /usr/lib/systemd/system/mongodb.socket but now I'm stuck what else goes in there and I don't know if this is the right directory.
[Unit]
Description=High-performance, schema-free document-oriented database Socket
[Socket]
ListenStream=27017
[Install]
WantedBy=sockets.target
My question is basically: What else do I need to write in the file, where do I place this file and do I have to do more than run systemctl enable mongodb.socket
after that?
Services need special support to work with systemd's socket activation. The connection is passed via file handles at startup and the service should check if environment variable LISTEN_FDS is set. At the moment mongodb does not support this kind of invocation. The path /usr/lib/systemd/system/mongodb.socket would be technically correct, but for custom unit files /etc/systemd/system/mongodb.socket should be preferred.