glzjin/CTFd-Whale

CTFd访问500错误

Closed this issue · 9 comments

在安装插件后,访问CTFd会频繁的500,js什么的经常调用不了
日志查看了一遍,没发现什么问题,最后查看了uwsgi.log,看到以下信息,不知道是否相关

Traceback (most recent call last):
File "wsgi.py", line 11, in
app = create_app()
File "./CTFd/init.py", line 281, in create_app
init_plugins(app)
File "./CTFd/plugins/init.py", line 196, in init_plugins
module.load(app)
File "./CTFd/plugins/ctfd-whale/init.py", line 216, in load
redis_util = RedisUtils(app=app)
File "./CTFd/plugins/ctfd-whale/redis_utils.py", line 9, in init
self.redis_client = FlaskRedis(app)
File "/opt/pyenv/versions/3.7.5/envs/ctfdenv/lib/python3.7/site-packages/flask_redis/client.py", line 16, in init
self.init_app(app)
File "/opt/pyenv/versions/3.7.5/envs/ctfdenv/lib/python3.7/site-packages/flask_redis/client.py", line 38, in init_app
redis_url, **self.provider_kwargs
File "/opt/pyenv/versions/3.7.5/envs/ctfdenv/lib/python3.7/site-packages/redis/client.py", line 638, in from_url
connection_pool = ConnectionPool.from_url(url, db=db, **kwargs)
File "/opt/pyenv/versions/3.7.5/envs/ctfdenv/lib/python3.7/site-packages/redis/connection.py", line 999, in from_url
'schemes (%s)' % valid_schemes)
ValueError: Redis URL must specify one of the followingschemes (redis://, rediss://, unix://)

请问这个该怎么解决

image
请在此处填写docker api的访问url。一般来说是unix:///var/run/docker.sock
如果你的CTFd运行在docker里,你需要将主机的/var/run/docker.sock文件映射到容器内

@frankli0324 docker api 这里我使用tcp://192.168.66.12:2375,这个不可以吗?必须本机上的吗?

我看错了,是redis的问题,与docker无关,可以使用远程的docker。
能看一眼compose file么?或者说你的部署方式?

我用nginx-uwsgi部署的,没有搭建在docker里面 @frankli0324

那你可能需要再部署一份redis emmmm
CTFd单独不需要(会fallback到filesystem cache),但是whale需要(用于分配端口、子网,进行请求频率限制)
建议不要折腾直接用compose(((

@frankli0324 明白了,谢谢

没关系 不谢(

btw,如果单独部署redis,启动CTFd时记得加上REDIS_URL环境变量

好的