摸索出的单个VPS上安装多个discourse方法


(mangogeek) #1

个人野路子,如有错误希望大家指出来啊。
理论上来说discourse既然运行在docker内部、docker外的数据保存位置仅仅在/var/discourse/shared/下边的某个目录,再有就是端口。从这些地方来看,多个discourse和单个的区别就在于:端口号、docker外数据保存位置、仅此而已。
单个vps上安装好的两个discourse:forum.widora.io cnforum.widora.io
做法:
1、复制一份app.yml为app2.yml
2、修改docker外的端口号避免重复,比如app里用880,4443,那么app2里改成881,4444。反正别重复,vps主机靠nginx反代
3、修改docker挂在盘,避免重复,比如app默认使用了:

volumes:

  • volume:
    host: /var/discourse/shared/standalone
    guest: /shared
  • volume:
    host: /var/discourse/shared/standalone/log/var-log
    guest: /var/log

    app2就修改为:

    volumes:
  • volume:
    host: /var/discourse/shared/standalone2
    guest: /shared
  • volume:
    host: /var/discourse/shared/standalone2/log/var-log
    guest: /var/log

    4、执行./launcher bootstrap app2
    5、运行./launcher start app2
    6、此时看到docker ps如下:
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    028f1c38e741 local_discourse/app2 “/sbin/boot” 7 minutes ago Up 7 minutes 0.0.0.0:881->80/tcp, 0.0.0.0:4444->443/tcp app2
    e8d057b35fe5 local_discourse/app “/sbin/boot” 43 hours ago Up 43 hours 0.0.0.0:880->80/tcp, 0.0.0.0:4443->443/tcp app

(mangogeek) #2

暂时没发现哪里有不对的地方 :grinning: