害虫
hi,bug....

安装环境

  系统:centos7

  需安装docker-ce-17以上版本,git等。

安装步骤

  前往docker官方教程,安装docker-ce,安装完启动

    service docker start

  安装git

    yum install -y git

  创建discourse文件夹

    mkdir /var/discourse

  拉代码

    git clone https://github.com/discourse/discourse_docker.git /var/discourse

  配置文件(直接copy现成的app.xml)

    cd /var/discourse
    cp samples/standalone.yml containers/app.yml
    vi containers/app.yml

  拉取discourse镜像,从daocloud上查,并配置daocloud加速器。

    curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://adaa78cc.m.daocloud.io

    docker pull discourse/base:2.0.20180306  (用官方的 discourse/base源,下最新的版本,然后更改/var/discourse/launcher中的版本号。)

  等待pull结束。

    ./discourse-setup   (完成后即可访问)

    ./launcher bootstrap app  (初始化app)

    ./launcher app start  (重启app)

  

    初始化过程中不能识别github.com需要添加dns。

    打开ipv4 forward.

              # vi /etc/sysctl.conf
    添加如下代码:
          net.ipv4.ip_forward=1
    重启network服务
    # systemctl restart network
    查看是否修改成功
    # sysctl net.ipv4.ip_forward
    如果返回为“net.ipv4.ip_forward = 1”则表示成功了,这时,重启容器即可。
 

    126邮箱,需要登录邮箱设置授权码,并在app.yml里使用授权码登录,不用原来的邮箱密码。

    rebuild时需要访问GitHub,部分连接被墙,需要vpn。

    发邮件时提示邮件链接被主机封锁,重启网络服务试一下,也许可以解决。

    service network restart

    推荐一个免费流量的vpn地址:

    https://kejibear.xyz/  

    需要邀请码请回复。

附上app.xml

 1 ## this is the all-in-one, standalone Discourse Docker container template
 2 ##
 3 ## After making changes to this file, you MUST rebuild
 4 ## /var/discourse/launcher rebuild app
 5 ##
 6 ## BE *VERY* CAREFUL WHEN EDITING!
 7 ## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
 8 ## visit http://www.yamllint.com/ to validate this file as needed
 9 
10 templates:
11   - "templates/postgres.template.yml"
12   - "templates/redis.template.yml"
13   - "templates/web.template.yml"
14   - "templates/web.ratelimited.template.yml"
15   - "templates/web.china.template.yml"
16 ## Uncomment these two lines if you wish to add Lets Encrypt (https)
17   #- "templates/web.ssl.template.yml"
18   #- "templates/web.letsencrypt.ssl.template.yml"
19  
20 
21 ## which TCP/IP ports should this container expose?
22 ## If you want Discourse to share a port with another webserver like Apache or nginx,
23 ## see https://meta.discourse.org/t/17247 for details
24 expose:
25   - "80:80"   # http
26   - "443:443" # https
27 
28 params:
29   db_default_text_search_config: "pg_catalog.english"
30 
31   ## Set db_shared_buffers to a max of 25% of the total memory.
32   ## will be set automatically by bootstrap based on detected RAM, or you can override
33   #db_shared_buffers: "256MB"
34 
35   ## can improve sorting performance, but adds memory usage per-connection
36   #db_work_mem: "40MB"
37 
38   ## Which Git revision should this container use? (default: tests-passed)
39   #version: tests-passed
40 
41 env:
42   LANG: en_US.UTF-8
43   # DISCOURSE_DEFAULT_LOCALE: en
44 
45   ## How many concurrent web requests are supported? Depends on memory and CPU cores.
46   ## will be set automatically by bootstrap based on detected CPUs, or you can override
47   #UNICORN_WORKERS: 3
48 
49   ## TODO: The domain name this Discourse instance will respond to
50   DISCOURSE_HOSTNAME: '192.168.233.128'
51 
52   ## Uncomment if you want the container to be started with the same
53   ## hostname (-h option) as specified above (default "$hostname-$config")
54   #DOCKER_USE_HOSTNAME: true
55 
56   ## TODO: List of comma delimited emails that will be made admin and developer
57   ## on initial signup example 'user1@example.com,user2@example.com'
58   DISCOURSE_DEVELOPER_EMAILS: '*********44@126.com'
59 
60   ## TODO: The SMTP mail server used to validate new accounts and send notifications
61   DISCOURSE_SMTP_ADDRESS: smtp.126.com         # required
62   DISCOURSE_SMTP_PORT: 25                        # (optional, default 587)
63   DISCOURSE_SMTP_USER_NAME: *********44@126.com      # required
64   DISCOURSE_SMTP_PASSWORD: *********               # required, WARNING the char '#' in pw can cause problems!
65   DISCOURSE_SMTP_ENABLE_START_TLS: false          # (optional, default true)
66 
67   ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
68   #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
69 
70   ## The CDN address for this Discourse instance (configured to pull)
71   ## see https://meta.discourse.org/t/14857 for details
72   #DISCOURSE_CDN_URL: //discourse-cdn.example.com
73 
74 ## The Docker container is stateless; all data is stored in /shared
75 volumes:
76   - volume:
77       host: /var/discourse/shared/standalone
78       guest: /shared
79   - volume:
80       host: /var/discourse/shared/standalone/log/var-log
81       guest: /var/log
82 
83 ## Plugins go here
84 ## see https://meta.discourse.org/t/19157 for details
85 hooks:
86   after_code:
87     - exec:
88         cd: $home/plugins
89         cmd:
90           - git clone https://github.com/discourse/docker_manager.git
91 
92 ## Any custom commands to run after building
93 run:
94   - exec: echo "Beginning of custom commands"
95   ## If you want to set the 'From' email address for your first registration, uncomment and change:
96   ## After getting the first signup email, re-comment the line. It only needs to run once.
97   - exec: rails r "SiteSetting.notification_email='*********44@126.com'"
98   - exec: echo "End of custom commands"

 2018-03-14 16:41:16

 

贴个效果图,已个性化处理过css。

posted on 2018-03-14 16:41  Hi,虫  阅读(1257)  评论(0编辑  收藏  举报