Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.
Redmine是基于Ruby on Rails框架支持跨平台、跨数据库的一款灵活的项目管理web应用程序。
特性
支持多项目管理;
灵活的基于角色的访问控制;
灵活的问题跟踪系统;
通过甘特图和日历追踪事务;
新闻、文档和文件管理;
feeds和邮件通知;
依附于项目的wiki;
项目论坛;
简单实时跟踪功能;
自定义字段的问题,时间项,项目和用户;
SCM in集成 (SVN, CVS, Git, Mercurial, Bazaar and Darcs)
安装Redmine:
$ wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz $ tar zxvf redmine-3.4.6.tar.gz
创建数据库(使用单独的数据库服务器:192.168.228.129):
$ mysql -uroot -p123456 mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4; mysql> CREATE USER 'redmine'@'192.168.228.130' IDENTIFIED BY '123456'; mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'192.168.228.130'; # 在host3测试连通性,保证数据库能正常访问 $ mysql -uredmine -h192.168.228.129 -P3306 -p123456 MySQL [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | redmine | | test | +--------------------+ 3 rows in set (0.00 sec)
冲突解决(首先确保数据库字符集为utf8mb4):
# 冲突1:key太长 Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE INDEX `wiki_pages_wiki_id_title` ON `wiki_pages` (`wiki_id`, `title`) # 解决办法: $ vim config/initializers/ar_innodb_row_format.rb ActiveSupport.on_load :active_record do module ActiveRecord::ConnectionAdapters class AbstractMysqlAdapter def create_table_with_innodb_row_format(table_name, options = {}) table_options = options.reverse_merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC') create_table_without_innodb_row_format(table_name, table_options) do |td| yield td if block_given? end end alias_method_chain :create_table, :innodb_row_format end end end # 更改mysql配置: $ mysql -uroot -p123456 set global innodb_large_prefix = 1 set global innodb_file_format = barracuda set global innodb_file_per_table = 1 # 然后重新导入数据即可!!! # 参考: # http://www.redmine.org/issues/23586 (个人使用方法1) # 类似问题:http://www.redmine.org/boards/2/topics/54308?r=54309
Note: 数据库相关配置写入/etc/my.cnf下,避免服务重启后配置被还原。
$ mkdir -p /usr/local/src/tmp/pdf /usr/local/src/public/plugin_assets $ chown -R redmine:redmine /usr/local/src/redmine-3.4.6 $ cd /usr/local/src/redmine-3.4.6 # 执行以下操作前请先备份/usr/local/src/redmine-3.4.6 $ chmod -R 755 files log tmp public/plugin_assets # 官方Note: If you have files in these directories (e.g. restore files from backup), make sure these files are not executable.(如果这些目录下有文件,需要去除其执行权限!!!) $ find files log tmp public/plugin_assets -type f -exec chmod -x {} +
测试(该测试不支持生产环境):
$ bundle exec rails server webrick -e production
启动Redmine:
/usr/local/rvm/rubies/ruby-2.3.3/bin/ruby /usr/local/src/redmine-3.4.6/bin/rails server webrick -e production -d
加入systemctl管理:
$ vim /usr/lib/systemd/system/redmine.service [Unit] Description=Redmine Control After=syslog.target After=network.target [Service] User=redmine Group=redmine WorkingDirectory=/usr/local/src/redmine-3.4.6/ ExecStart=/usr/local/rvm/rubies/ruby-2.3.3/bin/ruby /usr/local/src/redmine-3.4.6/bin/rails server webrick -e production server webrick -e production Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target # 启动Redmine: $ systemctl start redmine
冲突解决:
# 冲突: Sep 26 00:06:24 host3 ruby: /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/spec_set.rb:91:in `block in material ize': Could not find rmagick-2.16.0 in any of the sources (Bundler::GemNotFound) # 原因:在本地找不到gem文件 # 解决办法: $ bundle install --path vendor/cache # 将gem缓存到本地
检查Redmine运行状态:
Note: Due to a change in Rack,
rails server now listens on localhost instead of 0.0.0.0 by default. This
should have minimal impact on the standard development workflow as both
http://127.0.0.1:3000 and http://localhost:3000 will continue to work as before
on your own machine.
However, with this change you will no longer be able to access the Rails
server from a different machine, for example if your development environment
is in a virtual machine and you would like to access it from the host machine.
In such cases, please start the server with rails server -b 0.0.0.0 to
restore the old behavior.
即, 新版本的Redmine启动后默认监听localhost,如果要通过外网访问,需要在启动时指定其监听的ip。如果不指定,需要在本机配置代理(nginx/httpd)。
本文来源: vendor/cache/ruby/2.3.0/gems/rails-4.2.8/guides/source/4_2_release_notes.md
# 检测方法1: $ curl http://192.168.228.130:3000 -I # 返回200状态码 # 检测方法2:配置代理,通过浏览器访问 ## nginx相关配置如下: $ cat /usr/local/nginx/conf/servers/redmine/upstream.conf upstream backserver { server 127.0.0.1:3000; } $ cat /usr/local/nginx/conf/servers/redmine/site.conf server { listen 80; server_name redmine.localhost.com; location / { #配置代理 proxy_pass http://backserver; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } # 在浏览器访问192.168.228.130 (注意,在测试环境使用该方法测试的前提是保证该虚拟主机为当前nginx服务器的默认虚拟主机,否则需要配置独立域名),结果如下: