Coder Social home page Coder Social logo

Comments (4)

soxft avatar soxft commented on May 12, 2024 1

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

from busuanzi_backend_self.

Hscpro avatar Hscpro commented on May 12, 2024

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

from busuanzi_backend_self.

zkeq avatar zkeq commented on May 12, 2024

本项目内的 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 的适配

from busuanzi_backend_self.

Hscpro avatar Hscpro commented on May 12, 2024

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

from busuanzi_backend_self.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.