Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis-server: No such file or directory #3

Closed
Hscpro opened this issue Jul 5, 2022 · 4 comments
Closed

redis-server: No such file or directory #3

Hscpro opened this issue Jul 5, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@Hscpro
Copy link

Hscpro commented Jul 5, 2022

hi~ 在自建时日志报错 redis-server: No such file or directory

redis-server不是个可执行文件?

image

@Hscpro
Copy link
Author

Hscpro commented Jul 5, 2022

Dockerfile 文件

FROM python:3.9.5-alpine

WORKDIR /home/busuanzi

RUN pip install "redis==4.1.4"
RUN pip install "uvicorn==0.17.6"
RUN pip install "fastapi==0.75.0"
RUN pip install "requests==2.25.1"


ENTRYPOINT ["python3", "main.py"]

EXPOSE 4000
CMD ["/bin/sh"]

docker 内的日志
image

@zkeq
Copy link
Owner

zkeq commented Jul 5, 2022

本项目内的 redis-server 是适配的 replit 的架构...

如果是自己服务器部署的话,自行启动一个 redis 并注释相关代码吧

print("chmod redis")
subprocess.run(chmod_redis, shell=True)
print("start redis")
subprocess.Popen(start_redis, shell=True)

本项目近期将增加对于 docker 的支持...

不清楚这个报错什么原因...我电脑带不起来 docker

我的服务器是直接跑在 screen 里面的...

服务器的 redis 直接用

https://redis.io/docs/getting-started/installation/install-redis-on-linux/#install-on-ubuntudebian

sudo apt-get update
sudo apt-get install redis

等新电脑到了我支持一下对于 docker 的适配

@soxft
Copy link
Collaborator

soxft commented Jul 5, 2022

可以尝试再开一个 redis 的容器, 使用 --link 将其进行关联, 修改下main.py 删除 启动redis相关的命令,并修改 redis连接至 启动的容器就行了

@Hscpro
Copy link
Author

Hscpro commented Jul 7, 2022

Dockerfile:

FROM python:3.9.5-alpine
WORKDIR /home/busuanzi
RUN pip install "redis==4.1.4"
RUN pip install "uvicorn==0.17.6"
RUN pip install "fastapi==0.75.0"
RUN pip install "requests==2.25.1"
ENTRYPOINT ["python3", "main.py"]
EXPOSE 4000
CMD ["/bin/sh"]

docker-compose:

version: "3"
services:

  bsz_redis:
    image: redis:latest
    container_name: bsz_redis
    restart: always
    networks:
      - bsz_net
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - "/root/docker/busuanzi/data:/data"

  busuanzi:
    image: busuanzi:latest
    container_name: busuanzi
    restart: always
    networks:
      - bsz_net
    ports:
      - 0.0.0.0:22322:8080/tcp
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - "/root/docker/busuanzi:/home/busuanzi"

networks:
  bsz_net:
    driver: "bridge"

按以上方案,并将main.py内的redis服务器地址改为bsz_redis,正常启动。

image

@zkeq zkeq added the good first issue Good for newcomers label Jul 11, 2022
Repository owner locked and limited conversation to collaborators Jul 11, 2022
@zkeq zkeq converted this issue into discussion #4 Jul 11, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants