docker搭建serverstatus.md 2.0 KB


title: Docker搭建ServerStatus tags: [] id: '1997' categories:

  • - uncategorized date: 2022-08-27 13:39:23 ---

服务端

version: '3.3'
services:
    serverstatus:
        restart: always
        container_name: serverstatus
        volumes:
            - './serverstatus-config.json:/ServerStatus/server/config.json'
            - './serverstatus-monthtraffic:/usr/share/nginx/html/json'
        ports:
            - '8001:80'
            - '35601:35601'
        image: 'cppla/serverstatus:latest'

客户端

{
"servers": [
{
"username": "ld_rasp4",
"name": "ld_rasp4",
"type": "arm",
"host": "LD",
"location": "CN",
"password": "DEFAULT_PASSWORD",
"monthstart": 1
},
{
"username": "oc_blog",
"name": "oc_blog",
"type": "amd",
"host": "🇸🇬",
"location": "US",
"password": "DEFAULT_PASSWORD",
"monthstart": 1
}
],
"watchdog": [
]
}
  • 编辑 serverstatus-config.json
  • 重启服务端 sudo docker-compose restart
  • wget --no-check-certificate -qO client-linux.py 'https://gogs.frp.limour.top/limour/ServerStatus/raw/master/clients/client-linux.py'
  • chmod +x client-linux.py
  • 测试一下:/home/pi/client-linux.py SERVER=45.79.67.132 USER=ld_rasp4 PASSWORD=DEFAULT_PASSWORD INTERVAL=10
  • 创建system服务
  • sudo nano /etc/systemd/system/ssc.service
  • sudo systemctl enable ssc
  • sudo systemctl start ssc
  • sudo systemctl status ssc

    [Unit]
    Description=ServerStatus-Client
    After=network.target
    [Service]
    ExecStart=/home/pi/client-linux.py SERVER=45.79.67.132 USER=ld_rasp4 PASSWORD=DEFAULT_PASSWORD INTERVAL=10
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target