请教一下docker-compose单机部署的能不能拆成两个机子部署

我在甲骨文免费鸡里面部署了Awesome TTRSS,目前订阅了2691个源。

最近更新到最新版本后老是占用过高导致卡顿,数据库从13降级到9.3 + Nginx更换到 cloudflared 后会好一点。

老哥们能不能帮忙看看docker-compose文件,看能不能把TTRSS和PostgreSQL分成两个机子部署。

version: "3.7"
services:
  service.rss:
    image: wangqiru/ttrss:latest-2021-01-01
    container_name: ttrss
    ports:
      - 8088:80
    environment:
      - SELF_URL_PATH=https://xxxx.xxx.xxx # please change to your own domain
      - DB_PASS=lalala # use the same password defined in `database.postgres`
      - PUID=1000
      - PGID=1000
#    deploy:
#      resources:
#        limits:
#          cpus: '0.80'
    volumes:
      - feed-icons:/var/www/feed-icons/
    networks:
      - public_access
      - service_only
      - database_only
    stdin_open: true
    tty: true
    restart: always

#  service.mercury: # set Mercury Parser API endpoint to `service.mercury:3000` on TTRSS plugin setting page
#    image: wangqiru/mercury-parser-api:latest
#    container_name: mercury
#    networks:
#      - public_access
#      - service_only
#    restart: always

#  service.opencc: # set OpenCC API endpoint to `service.opencc:3000` on TTRSS plugin setting page
#    image: wangqiru/opencc-api-server:latest
#    container_name: opencc
#    environment:
#      - NODE_ENV=production
#    networks:
#      - service_only
#    restart: always

  database.postgres:
    image: postgres:9.3-alpine
    container_name: postgres
    environment:
      - POSTGRES_PASSWORD=lalala # feel free to change the password
    volumes:
      - ~/postgres/data/:/var/lib/postgresql/data # persist postgres data to ~/postgres/data/ on the host
    networks:
      - database_only
    restart: always
    deploy:
      resources:
        limits:
          cpus: '0.90'

  # utility.watchtower:
  #   container_name: watchtower
  #   image: containrrr/watchtower:latest
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock
  #   environment:
  #     - WATCHTOWER_CLEANUP=true
  #     - WATCHTOWER_POLL_INTERVAL=86400
  #   restart: always

volumes:
  feed-icons:

networks:
  public_access: # Provide the access for ttrss UI
  service_only: # Provide the communication network between services only
    internal: true
  database_only: # Provide the communication between ttrss and database only
    internal: true
2 个赞

常规话题快问快答

你这不就是两个服务吗 你是想一个机器部署一个服务
还是两个机器都运行这个docker-compose做负载均衡

完全可以,这个问 GPT 就好了

一个鸡运行一个吧,反正2个鸡都是免费的。负载均衡应该用不上,这个就我一个人用。

1 个赞

这倒也是,我试试

自用的话,单点就够了,不想折腾

你把这两个服务拆开两个compose不就好了

Docker有一项技术叫Docker Swarm,效果跟k8s差不多,你可以认为它是轻型集群,是基于Docker Compose编排脚本的。我想这个可能是你需要的。

1 个赞

我会选择分开部署