二进制部署
从 git 仓库的 dist/ 目录
获取对应平台的二进制——完整平台对照表见安装指南。
创建 /etc/rcommerce/config.toml:
[server]host = "0.0.0.0"port = 8080
[database]db_type = "Postgres"host = "localhost"port = 5432database = "rcommerce"username = "rcommerce"password = "your_password"
[security.jwt]secret = "change-this-to-a-random-string"rcommerce server -c /etc/rcommerce/config.toml迁移在启动时自动执行。
Systemd 服务
Section titled “Systemd 服务”创建 /etc/systemd/system/rcommerce.service:
[Unit]Description=rCommerce API ServerAfter=network.target postgresql.service
[Service]Type=simpleUser=rcommerceExecStart=/usr/local/bin/rcommerce server -c /etc/rcommerce/config.tomlRestart=alwaysRestartSec=5Environment=RUST_LOG=info
[Install]WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl enable rcommercesudo systemctl start rcommerce在二进制前面使用 Caddy、Nginx 或 Traefik:
api.example.com { reverse_proxy localhost:8080}健康检查端点:GET /health
指标(如启用):GET /metrics(Prometheus 格式)
一个二进制可以服务任意数量的店铺——各有自己的端口、配置和 数据库。见 多店铺运维。