【独立博客无力维护,博文搬到此处】
Redmine是非常好用的开源项目管理系统。公司的开发基本使用Python,所以选择了Trac。前一段时间接触Rails之后,发现Rails的部署也十分的简便,所以就抽空试用了一下垂涎已久的Redmine。
本文关注的是Unicorn和Nginx的部署方式,附件是最早的apache+passenger方式的部署。
安装ruby环境
1、下面是直接用Ubuntu提供的安装包来安装Ruby,不建议使用,产品环境下应该看这里:
apt-get install ruby rubygems
2、对比ruby与gem的版本满足Redmine的要求:
ruby -v gem -v
3、设置gem的默认源为taobao提供的RubyGems镜像,剔除国内访问RubyGems官方源不稳定带来的影响:
gem source --list gem source -r https://rubygems.org/ gem source -a http://ruby.taobao.org 安装bundler gem install bundler
安装并配置MySQL
创建Redmine的用户和数据库:
CREATE DATABASE redmine DEFAULT CHARACTER SET utf8; GRANT ALL ON redmine.* TO redmine@localhost IDENTIFIED BY 'redmine' WITH GRANT OPTION;
下载并安装Redmine依赖
1、下载Redmine并解压到目标路径下,比如/opt/redmine。
2、将redmine的gem源也改成taobao的:直接更改Gemfile内容即可。
3、安装ruby、rails依赖
apt-get install libruby ruby-dev libmagickcore-dev libmagickwand-dev libmysqlclient-dev libmysql-ruby
4、进入Redmine目录,用bundle安装Redmine依赖:
bundle install --without development test postgresql sqlite rmagick
如果抛如下错的话,应该安装libmysqlclient-dev和libmysql-ruby:
Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out An error occurred while installing mysql (2.8.1), and Bundler cannot continue. Make sure that `gem install mysql -v '2.8.1'` succeeds before bundling.
配置Redmine
1、数据库配置文件:config/database.yml。可将config/database.yml.example直接拷贝过来,然后直接去编辑。注意:根据配置文件顶部说明来确定adapter选mysql还是mysql2。
2、初始化配置和数据:
rake generate_secret_token RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
3、创建Redmine配置(这步不是必须,因为Redmine有默认配置):
cp config/configuration.yml.example config/configuration.yml
4、运行一下试试,正常的话你应该可以访问到Redmine了(默认用户和密码都是admin):
ruby script/rails server webrick -e production (redmine3以后rails命令不在这里了)
5、常用的Email配置:
### qq exmail email_delivery: delivery_method: :async_smtp async_smtp_settings: address: smtp.exmail.qq.com port: 25 domain: exmail.qq.com authentication: :login user_name: "redmine@xxx.com" password: "xxx" ###Gmail email_delivery: delivery_method: :async_smtp async_smtp_settings: address: "smtp.gmail.com" port: 587 domain: "smtp.gmail.com" authentication: :login user_name: "redmine@xxx.com" password: "xxx"
安装Unicorn
1、编辑Gemfile,增加unicorn依赖:
gem "unicorn"
2、安装unicorn:
gem install unicorn
3、创建unicorn配置:vi config/unicorn.rb,内容如下:
app_path = "/opt/redmine" worker_processes 2 working_directory = app_path listen app_path + "/tmp/sockets/unicorn.sock", :backlog => 64 listen "127.0.0.1:8082", :tcp_nopush => true # nuke workers after 30 seconds instead of 60 seconds (the default) timeout 30 # feel free to point this anywhere accessible on the filesystem pid app_path + "/tmp/pids/unicorn.pid" # By default, the Unicorn logger will write to stderr. # Additionally, ome applications/frameworks log to stderr or stdout, # so prevent them from going to /dev/null when daemonized here: stderr_path app_path + "/log/unicorn.stderr.log" stdout_path app_path + "/log/unicorn.stdout.log" # combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings # http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow preload_app true GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true check_client_connection false before_fork do |server, worker| # the following is highly recomended for Rails + "preload_app true" # as there's no need for the master process to hold a connection defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! # The following is only recommended for memory/DB-constrained # installations. It is not needed if your system can house # twice as many worker_processes as you have configured. # # # This allows a new master process to incrementally # # phase out the old master process with SIGTTOU to avoid a # # thundering herd (especially in the "preload_app false" case) # # when doing a transparent upgrade. The last worker spawned # # will then kill off the old master process with a SIGQUIT. # old_pid = "#{server.config[:pid]}.oldbin" # if old_pid != server.pid # begin # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU # Process.kill(sig, File.read(old_pid).to_i) # rescue Errno::ENOENT, Errno::ESRCH # end # end # # Throttle the master from forking too quickly by sleeping. Due # to the implementation of standard Unix signal handlers, this # helps (but does not completely) prevent identical, repeated signals # from being lost when the receiving process is busy. # sleep 1 end after_fork do |server, worker| # per-process listener ports for debugging/admin/migrations # addr = "127.0.0.1:#{9293 + worker.nr}" # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true) # the following is *required* for Rails + "preload_app true", defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection # if preload_app is true, then you may also want to check and # restart any other shared sockets/descriptors such as Memcached, # and Redis. TokyoCabinet file handles are safe to reuse # between any number of forked children (assuming your kernel # correctly implements pread()/pwrite() system calls) end
4、运行unicorn_rails:
RAILS_ENV=production unicorn_rails -c config/unicorn.rb -E prodcution -D
bundle exec unicorn -E production -c config/unicorn.rb
配置Nginx
1、设置redmine公共目录的权限:files/ log/ tmp/public/
2、配置Nginx:
upstream redmine_backend { server unix:/opt/redmine/tmp/sockets/unicorn.sock fail_timeout=0; } server { listen 80; ## listen for ipv4; this line is default and implied server_name redmine.h7sc.com red.man1dian.com; keepalive_timeout 5; root /opt/redmine/public; access_log /var/log/nginx/redmine-access.log ; error_log /var/log/nginx/redmine-error.log ; location ~* ^/(images|javascripts|stylesheets|img)/ { access_log off; log_not_found off; expires max; break; } location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffering on; if (!-f $request_filename) { proxy_pass http://redmine_backend; break; } } }
3、重启Nginx
开始使用
部署好Redmine之后,管理员应该去做好基本的设置,比如:站点名称、welcome信息、公司logo、匿名用户看不到内容、Email。
需要注意的是,Email设置时,改掉配置文件并重启后,需要admin在系统设置中再次设置from的邮件地址,填好之后页面右下角有测试的连接(这个忒不好找)。Redmine的邮件提醒值得赞一下,它提供了用户级别的5中不同选择:接收全部、只收与我相关、只收我创建、只收分配给我、完全不接收。与Trac相比起来就人性化了许多。
Redmine另一个很棒的地方是很容易更改系统的外观,同时有许多开源的、漂亮的theme供选择:
参考1:Rails的常用部署方式介绍
参考2:Redmine官方部署WIFI
相关推荐
Nginx、独角兽和 Sinatra 示例展示了如何使用 Unicorn 和 Nginx 部署一个简单的 Sinatra 应用程序。 动态内容通过 Unicorn 提供,而静态内容通过 Nginx 提供。 git clone ...
capistrano-unicorn-nginx, 自动和合理的unicorn Nginx 配置的Capistrano 任务 Capistrano::UnicornNginx注意:从版本 4.1.0中不再需要 below 指令。 如果缺少dhparam文件,将自动生成该文件。重要说明:升级到 ...
nginx 1.17.9.1 Unicorn.zip
nginx 服务器,支持windows服务器搭建,稳定,分布式,流媒体.
capistrano-nginx-unicorn, 从 Capistrano 创建和管理nginx unicorn配置 Capistrano-Nginx-Unicorn用于配置和管理nginx unicorn的Capistrano 任务 Rails 应用程序的零停机部署的组合。将 Capistrano 任务提供给:...
nginx + Unicorn服务器配置脚本 该脚本旨在提供和配置Digital Ocean Droplet。 它安装以下内容: Ruby和Ruby-dev Nginx的 独角兽 Postgres(创建根用户和数据库) 它还安装以下gem: pg json 最后,它为您创建...
包含模块nginx, nginx doc, Lua, Naxsi, Rtmp, HttpSubsModule,echo-nginx, lower_upper_case, headers-more,auth_ldap, set-misc, lua-upstream, encrypted-session,limit-traffic, AJP, form-input, upstream_...
Unicorn
使用Digialt Ocean,Ubuntu 14.04,Capistrano 2,Ruby 2.2.2,Nginx和Unicorn进行部署 创建服务器 登录到 用破折号创建一个名字铁洋生产 设定值 $ 5 /月 旧金山 Ubuntu 14.04 IPv6 用$ cat〜/ .ssh / id_rsa.pub...
在这个例子中,我们将添加一个 Redmine 和一个 GitLab 安装: unicorn_enable="YES" unicorn_children="redmine gitlab" #redmine unicorn_redmine_enable="YES" unicorn_redmine_directory="/var/...
Docker Rails + Nginx + Unicorn(来自Ubuntu 16.04和Ruby 2.4.0) 易于使用的docker导轨。 较少的配置,负担得起的生产。 包括什么 独角兽,nginx,领班 mysql,PostgreSQL库 用法 在您的项目中创建Dockerfile并...
Unicorn Admin是一款优秀的前端开发框架
Magic Unicorn is a simple tool for using a PowerShell downgrade attack and inject shellcode straight into memory. Based on Matthew Graeber's powershell attacks and the powershell bypass technique ...
Unicorn - Admin Template 是一款支持视网膜屏幕、完全响应式布局,可用于任何应用程序的管理模板。该面板适应任何宽度的设备。无论是智能手机、平板电脑或桌面浏览器都能完美适应。最新版本基于 Bootstrap 3 构建。
unicorn 一个不错的后台管理界面.清测有效
前端项目-unicorn.js,Unicorn CPU emulator framework port for JavaScript
用于创建,处理,测试和部署项目的工具。 执照 版权所有2019 Unicorn 根据Apache许可版本2.0(“许可”)许可; 除非遵守许可,否则不得使用此文件。 您可以在以下位置获得许可的副本: 除非适用法律要求或以书面...
基于Unicorn和LibFuzzer的模拟执行fuzzing