easychen / CookieCloud

CookieCloud是一个和自架服务器同步浏览器Cookie和LocalStorage的小工具,支持端对端加密,可设定同步时间间隔。本仓库包含了插件和服务器端源码。CookieCloud is a small tool for synchronizing browser cookies and LocalStorage with a self-hosted server. It supports end-to-end encryption and allows for setting the synchronization interval. This repository contains both the plugin and the server-side source code
GNU General Public License v3.0
1.95k stars 164 forks source link

nodejs安装并使用systemd配置进程守护应该怎么设置二级目录(API_ROOT=$PATH)? #82

Open tareny opened 1 month ago

tareny commented 1 month ago

这样对吗?但是我应该怎么配置二级目录(API_ROOT=$PATH)?

# 克隆储存库到本地
git clone https://github.com/easychen/CookieCloud.git

# 将主文件夹复制到工作目录
mkdir -p /data/cookiecloud ; cp -r ./CookieCloud /data/CookieCloud

# 安装依赖文件
npm install --prefix /data/CookieCloud/api

# 设置进程守护(systemd)
cat > /usr/lib/systemd/system/cookiecloud.service << EOF
[Unit]
Description=CookieCloud
Documentation=https://github.com/easychen/CookieCloud
After=network.target

[Service]
WorkingDirectory=/data/CookieCloud/api
ExecStart=/usr/bin/node /data/CookieCloud/api/app.js
Restart=on-abnormal
RestartSec=5s
StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target
EOF

# 更新配置
systemctl daemon-reload

# 启动服务
systemctl start cookiecloud

# 设置开机启动
systemctl enable cookiecloud