Skip to content

Systemd Service

Create /etc/systemd/system/rcommerce.service:

[Unit]
Description=rCommerce API Server
After=network.target postgresql.service
[Service]
Type=simple
User=rcommerce
Group=rcommerce
ExecStart=/usr/local/bin/rcommerce serve -c /etc/rcommerce/config.toml
Restart=always
RestartSec=5
Environment=RUST_LOG=info
Environment=STOREFRONT_URL=https://your-store.com
[Install]
WantedBy=multi-user.target
Terminal window
# Create user
sudo useradd -r -s /bin/false rcommerce
# Set permissions
sudo chown rcommerce:rcommerce /usr/local/bin/rcommerce
sudo chown -R rcommerce:rcommerce /etc/rcommerce
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable rcommerce
sudo systemctl start rcommerce
# Check status
sudo systemctl status rcommerce
Terminal window
# View logs
sudo journalctl -u rcommerce -f
# Last 100 lines
sudo journalctl -u rcommerce -n 100
Terminal window
sudo systemctl restart rcommerce

Set in the [Service] section:

  • RUST_LOG — log level
  • STOREFRONT_URL — storefront URL for email links
  • RCOMMERCE_CONFIG — config file path (alternative to -c flag)