在thin上运行redmine

1. 安装thin

gem install thin

2. 安装thin到系统自启动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ thin install
    Installing thin service at /etc/rc.d/thin ...
    mkdir -p /etc/rc.d
    writing /etc/rc.d/thin
    chmod +x /etc/rc.d/thin
    mkdir -p /etc/thin

    To configure thin to start at system boot:
    on RedHat like systems:
      sudo /sbin/chkconfig --level 345 thin on
    on Debian-like systems (Ubuntu):
      sudo /usr/sbin/update-rc.d -f thin defaults
    on Gentoo:
      sudo rc-update add thin default

    Then put your config files in /etc/thin

2.1. 设置 thin 随系统启动

1
$ chkconfig --list thin

可能会提醒找不到文件,将启动脚本拷贝到init.d下面

1
$ mv /etc/rc.d/thin /etc/rc.d/init.d/thin

再设置下启动的run-level

1
2
3
$ chkconfig --list thin
$ chkconfig --level 345 thin on
$ chkconfig --list thin

3. 配置thin

1
$ thin config -C /etc/thin/redmine-2.4.2.yml -c /opt/server/redmine-2.4.2 --servers 2 --port 3000 -e production --log log/thin.log

该命令按要求生成 redmine-2.4.2.yml 配置文件,内容如下:

chdir: /opt/server/redmine-2.4.2
environment: production
address: 0.0.0.0
port: 3000
timeout: 30
log: /opt/server/redmine-2.4.2/log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
threadpool_size: 20
servers: 2
daemonize: true

4. 在redmine项目中引用thin

修改 /opt/server/redmine-2.4.2/Gemfile

添加: gem “thin”

TODO:不知道问什么要加,否则启动就报错:

1
2
3
4
5
    Thin web server (v1.6.3 codename Protein Powder)
    Maximum connections set to 1024
    Listening on 0.0.0.0:3000, CTRL+C to stop
    Exiting!
    /usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.6.3/lib/thin/backends/tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)

5. 启动thin

1
2
$ /etc/init.d/thin start
$ ps -ef | grep thin

或者,

1
service thin start

如果没启动,到redmine-home/log/ 下面查下日志

按照之前配置,thin将启动2个实例,分别在端口 3000, 3001。下面用apache或者nigix做个负载均衡就好。

5.1. 报错:/usr/bin/env: ruby_executable_hooks: No such file or directory

1
2
$ ln -s `which ruby_executable_hooks` /usr/bin/ruby_executable_hooks
$ ln -s `which ruby` /usr/bin/ruby

6. 设置相对路径

修改 redmine-home/config/environment.rb

添加:

1
2
3
4
5
6
7
    # Add by wi
    # set relative path for redmine
    #
    # --prefix /redmine  shall adds to startup arguments
    # e.g.
    # thin config -C /etc/thin/redmine-2.4.2.yml -c /opt/server/redmine-2.4.2 --servers 2 --port 3000 -e production --log log/thin.log --prefix /redmine
Redmine::Utils::relative_url_root = "/redmine"

更新配置文件后重启

1
thin config -C /etc/thin/redmine-2.4.2.yml -c /opt/server/redmine-2.4.2 --servers 2 --port 3000 -e production --log log/thin.log --prefix /redmine

7. Apache的负载均衡配置

查看下apache的module目录,负载均衡的module是否安装,一般都装了。

1
$ ls /usr/lib64/httpd/modules/*proxy*

添加如下设置到httpd.conf

1
2
3
4
5
6
7
8
# Add by wi : Redmine balancer
<IfModule proxy_balancer_module>
    <Proxy balancer://redminecluster>
        BalancerMember http://127.0.0.1:3000/redmine
        BalancerMember http://127.0.0.1:3001/redmine
    </Proxy>
    ProxyPass /redmine balancer://redminecluster
</IfModule>

8. 配置邮件

8.1. 在服务器上配置

cp config/configuration.yml.example configuration.yml

在 /config/configuration.yml 中修改成如下设置(以126邮箱为例):

1
2
3
4
5
6
7
8
9
10
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.126.com
      port: 25
      enable_starttls_auto: true
      domain: 126.com
      authentication: :login
      user_name: 'your-mail@126.com'
      password: 'your-mail-password'

8.2. 在redmine网页上配置

Administration > Settings > Email Notifications

“Emission email address”: your-mail@126.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值