mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 11:29:38 +08:00
run in this docker-compose.yml
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -139,3 +139,6 @@ logs/*
|
||||
/yyetsweb/builds/
|
||||
/builds/checksum-sha256sum.txt
|
||||
/yyetsweb/1.html
|
||||
!/env/
|
||||
!/mongo_data/
|
||||
/env/yyets.env
|
||||
|
||||
@@ -12,53 +12,47 @@ services:
|
||||
restart: always
|
||||
volumes:
|
||||
- ./mongo_data/mongodb:/data/db
|
||||
command: --quiet
|
||||
logging:
|
||||
driver: none
|
||||
|
||||
yyets-web:
|
||||
image: bennythink/yyetsbot
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- mongo=mongo
|
||||
- redis=redis
|
||||
working_dir: /YYeTsBot/yyetsweb/
|
||||
command: [ "python3","server.py","-h=0.0.0.0" ]
|
||||
ports:
|
||||
- "127.0.0.1:8888:8888"
|
||||
- "127.0.0.1:27017:27017"
|
||||
|
||||
socat:
|
||||
image: alpine/socat
|
||||
image: bennythink/socat
|
||||
restart: always
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
entrypoint: [ "socat", "tcp-listen:2375,fork,reuseaddr","unix-connect:/var/run/docker.sock" ]
|
||||
|
||||
yyets-bot:
|
||||
image: bennythink/yyetsbot
|
||||
depends_on:
|
||||
- redis
|
||||
- socat
|
||||
- mongo
|
||||
restart: on-failure
|
||||
env_file:
|
||||
- env/yyets.env
|
||||
logging:
|
||||
driver: none
|
||||
|
||||
mailhog:
|
||||
image: cd2team/mailhog
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8025:8025"
|
||||
logging:
|
||||
driver: none
|
||||
|
||||
nginx:
|
||||
bot:
|
||||
image: bennythink/yyetsbot
|
||||
depends_on:
|
||||
- redis
|
||||
- mongo
|
||||
- socat
|
||||
restart: always
|
||||
image: nginx:stable-alpine
|
||||
volumes:
|
||||
- ./conf:/etc/nginx/conf.d
|
||||
- /home/photos:/usr/share/nginx/html/photos
|
||||
- ./certs/:/etc/nginx/certs/
|
||||
- ./logs:/var/log/nginx/
|
||||
env_file:
|
||||
- env/yyets.env
|
||||
|
||||
web:
|
||||
image: bennythink/yyetsbot
|
||||
restart: always
|
||||
env_file:
|
||||
- env/yyets.env
|
||||
depends_on:
|
||||
- mongo
|
||||
- redis
|
||||
working_dir: /YYeTsBot/yyetsweb/
|
||||
command: [ "python3","server.py","-h=0.0.0.0" ]
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
- "127.0.0.1:8888:8888"
|
||||
- "172.17.0.1:8888:8888"
|
||||
|
||||
@@ -23,7 +23,7 @@ function prepare() {
|
||||
function prepare_compose() {
|
||||
echo "[2/5] 下载docker-compose.yml"
|
||||
curl -o docker-compose.yml https://raw.githubusercontent.com/tgbot-collection/YYeTsBot/master/docker-compose.yml
|
||||
sed -ie '31,67d' docker-compose.yml
|
||||
sed -ie '58,59d' docker-compose.yml
|
||||
}
|
||||
|
||||
function import_db() {
|
||||
|
||||
@@ -40,17 +40,15 @@ BD2020_SEARCH = "https://v.bd2020.me/search.jspx?q={}"
|
||||
XL720_SEARCH = "https://www.xl720.com/?s={}"
|
||||
|
||||
# authentication config
|
||||
TOKEN = os.getenv("TOKEN") or "TOKEN"
|
||||
USERNAME = os.getenv("USERNAME") or "USERNAME"
|
||||
PASSWORD = os.getenv("PASSWORD") or "password"
|
||||
TOKEN = os.getenv("TOKEN")
|
||||
|
||||
# network and server config
|
||||
PROXY = os.getenv("PROXY")
|
||||
REDIS = os.getenv("REDIS") or "redis"
|
||||
MONGO = os.getenv("MONGO") or "mongo"
|
||||
REDIS = os.getenv("REDIS", "redis")
|
||||
MONGO = os.getenv("MONGO", "mongo")
|
||||
|
||||
# other
|
||||
MAINTAINER = os.getenv("MAINTAINER")
|
||||
REPORT = os.getenv("REPORT") or False
|
||||
MAINTAINER = os.getenv("OWNER")
|
||||
REPORT = os.getenv("REPORT", False)
|
||||
# This name must match class name, other wise this bot won't running.
|
||||
FANSUB_ORDER: str = os.getenv("ORDER") or 'YYeTsOffline,ZimuxiaOnline,NewzmzOnline,ZhuixinfanOnline,XL720,BD2020'
|
||||
|
||||
@@ -48,7 +48,6 @@ from fansub import BD2020, XL720, NewzmzOnline, ZhuixinfanOnline, ZimuxiaOnline
|
||||
|
||||
logging.info("Loading fansub...%s", (BD2020, XL720, NewzmzOnline, ZhuixinfanOnline, ZimuxiaOnline))
|
||||
|
||||
mongo_host = os.getenv("mongo") or "localhost"
|
||||
DOUBAN_SEARCH = "https://www.douban.com/search?cat=1002&q={}"
|
||||
DOUBAN_DETAIL = "https://movie.douban.com/subject/{}/"
|
||||
cf = Cloudflare()
|
||||
@@ -56,7 +55,7 @@ cf = Cloudflare()
|
||||
|
||||
class Mongo:
|
||||
def __init__(self):
|
||||
self.client = pymongo.MongoClient(host=mongo_host, connect=False,
|
||||
self.client = pymongo.MongoClient(host=os.getenv("MONGO", "localhost"), connect=False,
|
||||
connectTimeoutMS=5000, serverSelectionTimeoutMS=5000)
|
||||
self.db = self.client["zimuzu"]
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import pymongo
|
||||
|
||||
class Mongo:
|
||||
def __init__(self):
|
||||
self.client = pymongo.MongoClient(host=os.getenv("mongo") or "localhost", connect=False,
|
||||
self.client = pymongo.MongoClient(host=os.getenv("MONGO", "localhost"), connect=False,
|
||||
connectTimeoutMS=5000, serverSelectionTimeoutMS=5000)
|
||||
self.db = self.client["zimuzu"]
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ predefined_str = re.sub(r"[1l0oOI]", "", string.ascii_letters + string.digits)
|
||||
|
||||
class Redis:
|
||||
def __init__(self):
|
||||
self.r = redis.StrictRedis(host=os.getenv("redis") or "localhost", decode_responses=True)
|
||||
self.r = redis.StrictRedis(host=os.getenv("REDIS", "localhost"), decode_responses=True)
|
||||
try:
|
||||
self.r.ping()
|
||||
except redis.exceptions.ConnectionError:
|
||||
|
||||
@@ -37,7 +37,7 @@ def SQLite():
|
||||
|
||||
|
||||
def MySQL():
|
||||
return pymysql.connect(host='mysql', user='root', passwd='root', charset='utf8mb4')
|
||||
return pymysql.connect(host='172.17.0.1', user='root', passwd='root', charset='utf8mb4')
|
||||
|
||||
|
||||
def MongoDB():
|
||||
|
||||
@@ -51,9 +51,9 @@ def generate_body(context):
|
||||
def send_mail(to: str, subject: str, context: dict):
|
||||
user = os.getenv("email_user")
|
||||
password = os.getenv("email_password")
|
||||
host = os.getenv("email_host") or "localhost"
|
||||
port = os.getenv("email_port") or "1025" # mailhog
|
||||
from_addr = os.getenv("from_addr") or "yyets@dmesg.app"
|
||||
host = os.getenv("email_host", "localhost")
|
||||
port = os.getenv("email_port", "1025") # mailhog
|
||||
from_addr = os.getenv("from_addr", "yyets@dmesg.app")
|
||||
|
||||
msg = MIMEText(generate_body(context), 'html', 'utf-8')
|
||||
msg['From'] = _format_addr('YYeTs <%s>' % from_addr)
|
||||
|
||||
Reference in New Issue
Block a user