diff --git a/README-EN.md b/README-EN.md index 4448726..9478c14 100644 --- a/README-EN.md +++ b/README-EN.md @@ -2,6 +2,7 @@ #### Text-to-Speech Service (Supports CORS, Authentication) + ### Environment Setup Install [deno](https://docs.deno.com/runtime/manual/), [pnpm](https://pnpm.io/installation) @@ -21,6 +22,7 @@ pnpm compile:linux ``` [Reference Compilation Documentation](https://docs.deno.com/runtime/manual/tools/compiler/) + ### Environment Variables ```text TTS_PORT The default startup port is 8901 @@ -28,11 +30,13 @@ TTS_PORT The default startup port is 8901 TTS_AUTH_TOKEN Authentication token (if set to TestToken, the Authorization field must be added in the headers when calling the interface) ``` + ### Deployment (Examples for Arch, Debian) -##### Method 1. Register as a service +##### Method 1. Install `tzfe-tts.service` Service and Manage with `systemctl` +```shell +curl -fsSL https://tts.tzmf.xyz/install.sh | sh +``` ```shell -sudo sh ./install.sh - # Check service status systemctl status tzfe-tts @@ -41,11 +45,16 @@ tail -F /var/log/tzfe-tts/tzfe-tts.log ``` ##### Method 2. Docker Image -~_~ +- == ### Uninstall ```shell -sudo sh ./uninstall.sh +curl -fsSL https://tts.tzmf.xyz/uninstall.sh | sh +``` + +### Configuring Log Rotation (Optional) +```shell +curl -fsSL https://tts.tzmf.xyz/logrotate.sh | sh ``` ### Usage @@ -66,5 +75,4 @@ fetch('http://0.0.0.0:8901/v1/audio/speech', { const audio = new Audio(audioUrl); audio.play(); }); -``` - +``` \ No newline at end of file diff --git a/README.md b/README.md index 3c02dd8..4431699 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,11 @@ TTS_AUTH_TOKEN 鉴权token (如设置为TestToken,调用接口时需在heade ### 部署(以 Arch、Debian 为例) -##### 方式1. 注册 service 服务 +##### 方式1. 安装 tzfe-tts.service 服务,使用 systemctl 进行管理 +```shell +curl -fsSL https://tts.tzmf.xyz/install.sh | sh +``` ```shell -sudo sh ./install.sh - # 查看服务状态 systemctl status tzfe-tts @@ -44,11 +45,16 @@ tail -F /var/log/tzfe-tts/tzfe-tts.log ``` ##### 方式2. Docker镜像 -~_~ +- == ### 卸载 ```shell -sudo sh ./uninstall.sh +curl -fsSL https://tts.tzmf.xyz/uninstall.sh | sh +``` + +### 配置日志轮转(可选) +```shell +curl -fsSL https://tts.tzmf.xyz/logrotate.sh | sh ``` ### 调用 diff --git a/logrotate.sh b/logrotate.sh index d3b2fa0..b068ab9 100755 --- a/logrotate.sh +++ b/logrotate.sh @@ -1,21 +1,21 @@ #!/bin/bash -# 日志轮换 -touch /etc/logrotate.d/tzfe-tts - - -#/var/log/tzfe-tts/tzfe-tts.log { -# size 200M -# rotate 10 -# compress -# delaycompress -# notifempty -# create 0640 root root -# sharedscripts -# postrotate -# systemctl reload tzfe-tts.service > /dev/null 2>&1 || true -# endscript -#} +# 日志轮转配置文件 +CONFIG_FILE="/etc/logrotate.d/tzfe-tts" +cat < $CONFIG_FILE +/var/log/tzfe-tts/tzfe-tts.log { + size 200M + rotate 10 + compress + delaycompress + notifempty + create 0640 root root + sharedscripts + postrotate + systemctl reload tzfe-tts.service > /dev/null 2>&1 || true + endscript +} +EOL echo 'done' \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh index 4f55f70..64948cd 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -6,7 +6,6 @@ SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service" BIN_PATH="/usr/local/bin/$SERVICE_NAME" LOG_DIR="/var/log/$SERVICE_NAME" -# 启动服务 echo "Removing $SERVICE_NAME service..." systemctl stop $SERVICE_NAME systemctl disable $SERVICE_NAME