Docker部署ServerStatus with tgbot

https://github.com/cppla/ServerStatus

服务端
mkdir /serverstatus
cd /serverstatus
mkdir plugin
cd plugin

curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/plugin/Dockerfile-telegram -O

curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/plugin/bot-telegram.py -O

cd /serverstatus

curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/Dockerfile -O

curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/docker-compose-telegram.yml -O

nano docker-compose-telegram.yml

 

version: "3"
services:
serverstatus:
build:
context: .
dockerfile: Dockerfile
image: serverstatus_server
container_name: serverstatus
restart: unless-stopped
networks:
serverstatus-network:
ipv4_address: 172.23.0.2
volumes:
- ./server/config.json:/ServerStatus/server/config.json
- ./web/json:/usr/share/nginx/html/json
- ./web:/usr/share/nginx/html
ports:
- 35601:35601
- 8080:80
bot:
build:
context: ./plugin
dockerfile: Dockerfile-telegram
image: serverstatus_bot
container_name: bot4sss
restart: unless-stopped
networks:
serverstatus-network:
ipv4_address: 172.23.0.3
environment:
- TG_CHAT_ID=${TG_CHAT_ID}
- TG_BOT_TOKEN=${TG_BOT_TOKEN}

networks:
serverstatus-network:
name: serverstatus-network
ipam:
config:
- subnet: 172.23.0.0/24

退出并保存,然后执行:

TG_CHAT_ID=1106xxxxxx TG_BOT_TOKEN=1799xxxxxx:AAHIoyPFzosWtLgWsoIzEPlR9Qp72xxxxxx /usr/local/bin/docker-compose -f docker-compose-telegram.yml up -d

客户端
wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python3 client-linux.py SERVER={$SERVER} USER={$USER} PASSWORD={$PASSWORD} >/dev/null 2>&1 &

#eg:
wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python3 client-linux.py SERVER=45.79.67.132 USER=s04 >/dev/null 2>&1 &

 

转载:https://www.uionm.com/2022/03/1076/

Tagged on: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.