跳转至

安装部署

1. 快速体验

建议手动跑一遍这个,了解一下基本安装部署流程

# for CentOS/Debian/Ubuntu x86_64
mkdir -p /opt/ServerStatus && cd /opt/ServerStatus
# apt install -y unzip / yum install -y unzip
wget --no-check-certificate -qO one-touch.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/one-touch.sh'
bash -ex one-touch.sh
# 部署完毕,打开 http://127.0.0.1:8080/ 或 http://<你的IP>:8080/
# 自定义部署可参照 scripts/one-touch.sh 脚本

2. 一键部署客户端

版本要求 >= 1.5.0

参见 快速部署

3. 服务管理脚本部署,感谢 @Colsro 提供

# 下载脚本
wget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/status.sh'

# 安装 服务端
bash status.sh -i -s

# 安装 客户端
bash status.sh -i -c
# or
bash status.sh -i -c protocol://username:password@master:port
# eg:
bash status.sh -i -c grpc://h1:p1@127.0.0.1:9394
bash status.sh -i -c http://h1:p1@127.0.0.1:8080

# 更多用法:
 bash status.sh

help:
    -i,--install    安装 Status
        -i -s           安装 Server
        -i -c           安装 Client
        -i -c conf      自动安装 Client
    -u,--uninstall  卸载 Status
        -u -s           卸载 Server
        -u -c           卸载 Client
    -r,--reset      更改 Status 配置
        -r          更改 Client 配置
        -r conf         自动更改 Client配置
    -s,--server     管理 Status 运行状态
        -s {start|stop|restart}
    -c,--client     管理 Client 运行状态
        -c {start|stop|restart}

若无法访问 Github:
    CN=true bash status.sh args
# 可能有点用

4. Railway 部署

懒得配置 NginxSSL 证书?试试

在 Railway 部署 Server

在 Railway 部署 Server (WIKI)

Deploy on Railway

5. 前后端分离部署

这种方式是将前端主题部分单独部署在 vercel.app ,前后端分离部署,使用 routes 指向后端,功能类似 nginx 反代,好处是主题保持在自己的库中,主题随便修改而无需改动 server。目前 tz-rust.vercel.app 也是使用这种方式。#37

# 1. 参照前面先把 Server 部署好
# 2. 复制 web 目录,新建一个代码库,工程目录结构如下

~$ tree .
.
├── README.md
├── css
   ├── bootstrap-theme.min.css
   ├── bootstrap-theme.min.css.map
   ├── bootstrap.min.css
   ├── bootstrap.min.css.map
   └── dark.css
├── favicon.ico
├── img
   └── dark.png
├── index.html
├── js
   ├── bootstrap.min.js
   ├── jquery.min.js
   └── serverstatus.js
├── netlify.toml
└── vercel.json

# 3. 在工程目录添加 vercel.json 文件来指定路由,指向你的 Server,内容如下

{
  "routes": [
    {
      "src": "/json/stats.json",
      "dest": "http://tz.xxx.com:8080/json/stats.json"
    },
    {
      "src": "/detail",
      "dest": "http://tz.xxx.com:8080/detail"
    },
    {
      "src": "/map",
      "dest": "http://tz.xxx.com:8080/map"
    },
    {
      "src": "/i",
      "dest": "http://tz.xxx.com:8080/i"
    }
  ]
}

# 4. 最后将这个静态站点部署到 vercel.com
# 部署教程参照 =》 google 搜索 "vercel.com 部署静态站点"