add system
This commit is contained in:
35
README.md
35
README.md
@ -603,6 +603,41 @@ translation = true
|
||||
- Check AI provider configuration
|
||||
- Ensure sufficient context in memory system
|
||||
|
||||
## systemd
|
||||
|
||||
```sh
|
||||
# ファイルをsystemdディレクトリにコピー
|
||||
sudo cp ./systemd/system/ailog-stream.service /etc/systemd/system/
|
||||
sudo cp ./systemd/system/cloudflared-log.service /etc/systemd/system/
|
||||
|
||||
# 権限設定
|
||||
sudo chmod 644 /etc/systemd/system/ailog-stream.service
|
||||
sudo chmod 644 /etc/systemd/system/cloudflared-log.service
|
||||
|
||||
# systemd設定reload
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
# サービス有効化・開始
|
||||
sudo systemctl enable ailog-stream.service
|
||||
sudo systemctl enable cloudflared-log.service
|
||||
|
||||
sudo systemctl start ailog-stream.service
|
||||
sudo systemctl start cloudflared-log.service
|
||||
|
||||
# 状態確認
|
||||
sudo systemctl status ailog-stream.service
|
||||
sudo systemctl status cloudflared-log.service
|
||||
|
||||
# ログ確認
|
||||
journalctl -u ailog-stream.service -f
|
||||
journalctl -u cloudflared-log.service -f
|
||||
|
||||
設定のポイント:
|
||||
- User=syui でユーザー権限で実行
|
||||
- Restart=always で異常終了時自動再起動
|
||||
- After=network.target でネットワーク起動後に実行
|
||||
- StandardOutput=journal でログをjournalctlで確認可能
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
22
systemd/system/ailog-stream.service
Normal file
22
systemd/system/ailog-stream.service
Normal file
@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=ailog stream monitoring service
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=syui
|
||||
Group=syui
|
||||
WorkingDirectory=/home/syui/git/log
|
||||
ExecStart=/home/syui/.cargo/bin/ailog stream start my-blog
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# Environment variables if needed
|
||||
Environment=RUST_LOG=info
|
||||
Environment=AILOG_DEBUG_ALL=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
25
systemd/system/cloudflared-log.service
Normal file
25
systemd/system/cloudflared-log.service
Normal file
@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=Cloudflared tunnel for log.syui.ai
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=syui
|
||||
Group=syui
|
||||
WorkingDirectory=/home/syui/git/log
|
||||
ExecStart=/usr/bin/cloudflared tunnel --config /home/syui/git/log/cloudflared-config.yml run
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# Security hardening
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=read-only
|
||||
ReadWritePaths=/home/syui/git/log
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user