Systemd Service
Service file
Section titled “Service file”Create /etc/systemd/system/rcommerce.service:
[Unit]Description=rCommerce API ServerAfter=network.target postgresql.service
[Service]Type=simpleUser=rcommerceGroup=rcommerceExecStart=/usr/local/bin/rcommerce serve -c /etc/rcommerce/config.tomlRestart=alwaysRestartSec=5Environment=RUST_LOG=infoEnvironment=STOREFRONT_URL=https://your-store.com
[Install]WantedBy=multi-user.target# Create usersudo useradd -r -s /bin/false rcommerce
# Set permissionssudo chown rcommerce:rcommerce /usr/local/bin/rcommercesudo chown -R rcommerce:rcommerce /etc/rcommerce
# Enable and startsudo systemctl daemon-reloadsudo systemctl enable rcommercesudo systemctl start rcommerce
# Check statussudo systemctl status rcommerce# View logssudo journalctl -u rcommerce -f
# Last 100 linessudo journalctl -u rcommerce -n 100Restart
Section titled “Restart”sudo systemctl restart rcommerceEnvironment variables
Section titled “Environment variables”Set in the [Service] section:
RUST_LOG— log levelSTOREFRONT_URL— storefront URL for email linksRCOMMERCE_CONFIG— config file path (alternative to-cflag)