[Unit] Description=Foxhunt Backtesting Service Documentation=https://github.com/foxhunt/trading-system After=network.target docker.service foxhunt-database-stack.service Wants=network.target Requires=foxhunt-database-stack.service [Service] Type=exec User=foxhunt Group=foxhunt WorkingDirectory=/opt/foxhunt Environment=RUST_LOG=info Environment=FOXHUNT_CONFIG_PATH=/opt/foxhunt/config Environment=FOXHUNT_BACKTEST_DATA_DIR=/opt/foxhunt/data/backtests EnvironmentFile=-/opt/foxhunt/config/.env ExecStart=/opt/foxhunt/bin/backtesting-service --config /opt/foxhunt/config/backtesting.toml ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=10 StandardOutput=journal StandardError=journal SyslogIdentifier=foxhunt-backtesting # Security settings NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/opt/foxhunt/logs /opt/foxhunt/data CapabilityBoundingSet=CAP_NET_BIND_SERVICE # Resource limits (higher for backtesting workloads) LimitNOFILE=65536 LimitNPROC=8192 MemoryHigh=4G MemoryMax=8G CPUQuota=400% # Performance settings for compute-intensive backtesting OOMScoreAdjust=-50 IOSchedulingClass=2 IOSchedulingPriority=7 [Install] WantedBy=multi-user.target