[Unit]
Description=MongoDB Database Server for Tractatus
Documentation=https://docs.mongodb.org/manual
After=network.target

[Service]
Type=forking
User=theflow
Group=theflow

# MongoDB executable and configuration
ExecStart=/home/theflow/projects/mongodb/mongodb-server/bin/mongod \
    --port 27017 \
    --dbpath /home/theflow/projects/tractatus/data/mongodb \
    --logpath /home/theflow/projects/tractatus/logs/mongodb.log \
    --fork \
    --quiet

ExecStop=/home/theflow/projects/mongodb/mongodb-server/bin/mongod \
    --port 27017 \
    --dbpath /home/theflow/projects/tractatus/data/mongodb \
    --shutdown

# Restart policy
Restart=on-failure
RestartSec=5

# Security settings
PrivateTmp=true
NoNewPrivileges=true
LimitNOFILE=64000

# Working directory
WorkingDirectory=/home/theflow/projects/tractatus

[Install]
WantedBy=multi-user.target
