您的位置:首页 > 运维架构 > Docker

SUSE Linux + Docker + Discourse

2016-04-27 10:46 726 查看


Install Docker:

Install the Docker package:

     $ sudo zypper in docker

 

Start the Docker daemon:

$ sudo systemctl start docker

 

Test the Docker installation:

$ sudo docker run hello-world



Install Discourse:

Create a folder for Discourse:

$ mkdir  /var/discourse

 

Download discourse file:

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

 

Copy standalone.yml  to containers/app.yml

$ cd  /var/discourse

$ cp samples/standalone.yml  containers/app.yml

 

Edit Discourse configuration:

$ vi containters/app.yml

templates:

 
- "templates/postgres.template.yml"

 
- "templates/redis.template.yml"

 
- "templates/sshd.template.yml"

 
- "templates/web.template.yml"

 
- "templates/web.ratelimited.template.yml"

 
- "templates/web.socketed.template.yml"

expose:

  
# base on actualsituation

 
- "8080:6379" 
 # fwd host port 8080 to container port 6379(http)

 
- "2222:22"

params:

 
db_default_text_search_config:
"pg_catalog.english"

env:

 
LANG: en_US.UTF-8

 
DISCOURSE_DEFAULT_LOCALE: en

 
DISCOURSE_DEVELOPER_EMAILS:'shijian.zou@ericsson.com'

# base on actual situation

 
DISCOURSE_HOSTNAME:
'150.236.39.111:8081'

# base on actual situation

 
DISCOURSE_SMTP_ADDRESS: 150.236.39.117
#(mandatory)

 
DISCOURSE_SMTP_PORT:
25    # (optional)

 
HTTP_PROXY: 153.88.253.150:8080

 
HTTPS_PROXY: 153.88.253.150:8080

volumes:

 
- volume:

     
host: /var/discourse/shared/standalone

     
guest: /shared

 
- volume:

     
host: /var/discourse/shared/standalone/log/var-log

     
guest: /var/log

hooks:

 
after_code:

   
- exec:

       
cd: $home/plugins

       
cmd:

         
- mkdir-p plugins

         
- gitclone https://github.com/discourse/docker_manager.git
         
- gitclone https://github.com/discourse/discourse-solved.git
         
- gitclone https://github.com/Jake-Shadle/discourse_jira.git
         
- gitclone https://github.com/PoloGT/abbreviation-discourse-plugin.git
run:

 
- exec: echo
"Beginning of custom commands"

  -
exec: /usr/sbin/usermod -p
'PASSWORD_HASH'root

 
- exec:/usr/sbin/usermod -p
"$(mkpasswd -m sha-256'RAW_PASSWORD')" root

 
- exec: echo
"End of custom commands"

 

More details about the meaningof node please see the note in app.yml file.

 

Save the app.yml file, and begin bootstrappingDiscourse(between 2-8 minutes):

$./launcher bootstrap app

 

Start Discourse:

$./launcher start app

If all goes well, you can see the belowinformation.

HTTP Proxy Settings(opti
9323
onal):

Install nginx

Refer to install nginx on suse

Configure nginx

$ vi/usr/local/nginx/conf/nginx.conf

Add a server
 block as below:

server {

# base on actual situation

listen 8081;
#listen[::]:8081;

server_name forum.jcat.com;

 

location / {

proxy_pass                                      http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
proxy_set_header Host $http_host;

proxy_http_version 1.1;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

 

Reload ngnix:

$ cd/usr/local/nginx/sbin

$  ./nginx -s reload

Congratulations! 
YourDiscourse should be accessible in your web browser by http://ip:8081.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: