Ubuntu で Unicorn で動かす Redmine を 2.6 にアップデートしたときのメモ

RMagickに必要なパッケージインストール RMagick系のパッケージが要るといわれたので入れておく。 # apt-get install graphicsmagick-libmagick-dev-compat libmagickcore-dev libmagickwand-dev 新しい Redmine の展開 新しい Redmine のパッケージをダウンロードして展開する。 前の場所から以下のファイルをコピーする。 Gemfile.local config.ru config/unicorn.rb config/configuration.yml config/database.yml 以下のディレクトリ内のファイルを移動する。 plugins files public/themes お約束の手順 $ bundle install --path vendor/bundler $ rake generate_secret_token $ RAILS_ENV=production rake db:migrate $ rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production $ rake db:migrate_plugins RAILS_ENV=production $ rake tmp:cache:clear $ rake tmp:sessions:clear 起動 $ bundle exec unicorn_rails -D -E production -c $APP_ROOT/config/unicorn.rb

2014年10月28日 · Toshimitsu Takahashi

Redmine を Nginx + Unicorn へ移行

Apache + Passenger で動かしていた Redmine を Nginx + Unicorn に移行したのでそのメモ。 設定した環境 フロントの Nginx は https である。 Redmine は /var/redmine にインストールされている。 URL はドメイン/redmine で受ける. VPS 環境でUbuntu でスペックは低め。 Unicorn のインストール Redmine ディレクトリのルートに Gemfile.local を作る。 # Gemfile.local gem “unicorn” bundler で Unicorn をインストール $ bundle install Unicorn の設定スクリプト Redmine ディレクトリの config に unicorn.rb を下記のとおり作成する。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 worker_processes 1 timeout 60 listen File.expand_path("tmp/sockets/unicorn.sock", ENV['RAILS_ROOT']) pid File.expand_path("tmp/pids/unicorn.pid", ENV['RAILS_ROOT']) preload_app true stderr_path File.expand_path("log/unicorn.stderr.log", ENV['RAILS_ROOT']) stdout_path File.expand_path("log/unicorn.stdout.log", ENV['RAILS_ROOT']) GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! 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 sleep 1 end after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end 初回アクセス時にタイムアウトしないように 60 秒に増やす。 数人しかアクセスしないのでワーカーは 1 つにする。 Nginx の設定 upstream redmine { server unix:/var/redmine/tmp/sockets/unicorn.sock; } … location /redmine { root /var/redmine/public; if ( -f $request_filename ) { break; } proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_pass http://redmine; } … Unicorn 起動 Unicorn で Redmine を起動 ...

2013年6月17日 · Toshimitsu Takahashi

Ubuntu 12.04 に Redmine 2.0.3 を構築した時の Apache + Passenger の設定

Ruby 1.9 で Passenger を動かすために試行錯誤したのでメモしておく。基本的には、アップグレード — Redmine Guide 日本語訳 などを参考にする。 Passenger のインストール $ sudo apt-get install libcurl4-openssl-dev $ sudo apt-get install apache2-prefork-dev $ sudo gem1.9.1 install passenger $ cd /var/lib/gems/1.9.1/gems/passenger-3.0.13 $ sudo ./passenger-install-apache2-module Apache + Passenger の設定 /etc/apache2/mods-available/passenger.load LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so #LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so /etc/apache2/mods-available/passenger.conf PassengerRoot /var/lib/gems/1.9.1/gems/passenger-3.0.13 PassengerRuby /usr/bin/ruby1.9.1 #PassengerRoot /usr #PassengerRuby /usr/bin/ruby PassengerDefaultUser www-data VirtualHostの設定 $ ln -s /web/example.local/redmine /web/redmine-2.0.3 上記のようにシンボリックリンクが張ってある。 <VirtualHost *:80> ServerName example.local DocumentRoot /web/example.local RailsBaseURI /redmine <Directory /web/example.local/redmine/public> PassengerAppRoot /web/redmine-2.0.3 ...

2012年8月3日 · Toshimitsu Takahashi

Ubuntu の Redmine を 1.3.0 にアップグレードした

Redmine 1.2.0 から 1.3.0 アップデートするのに色々とハマったのでメモしておく。 Redmine 1.3.x で必要となる Rails などの依存バージョンは以下の通りです。 Ruby 1.8.7 Rails 2.3.14 Rack 1.1.1 参照)Redmineのインストール — Redmine Guide 日本語訳 Ruby と Rails バージョン $ /usr/bin/ruby -v ruby 1.8.7 (2011-06-30 patchlevel 352) \[i686-linux\] $ /usr/bin/rails -v Rails 2.3.14 以上は、Debian Package(apt-get)で入れたもの。 Rubygems をダウンクレード Rubygems のバージョンが 1.8.13 だったが、Rails が対応していないため Rails 2.3.14が対応している 1.5系の 1.5.3 に替える。 $ sudo gem install rubygems-update -v 1.5.3 Fetching: rubygems-update-1.5.3.gem (100%) Successfully installed rubygems-update-1.5.3 1 gem installed Installing ri documentation for rubygems-update-1.5.3... Installing RDoc documentation for rubygems-update-1.5.3... $ sudo gem uninstall rubygems-update Select gem to uninstall: 1\. rubygems-update-1.5.3 2\. rubygems-update-1.8.13 3\. All versions \> 2 Successfully uninstalled rubygems-update-1.8.13 $ sudo update_rubygems RubyGems 1.5.3 installed &#65279;=== 1.5.3 / 2011-02-26 NOTE: RubyGems 1.5.0 and 1.5.1 have a broken <tt>gem update --system</tt>. To upgrade you'll need to use the manual upgrade recipe. Using sudo/su as appropriate: $ gem install rubygems-update $ update_rubygems Bug Fixes: \* Fix for a bug in Syck which causes install failures for gems packaged with Psych. Bug #28965 by Aaron Patterson. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- RubyGems installed the following executables: /usr/bin/gem1.8 Rack, Rake, RDoc をインストール $ sudo gem install rack -v=1.1.2 $ sudo gem install rake -v=0.8.7 $ sudo gem install rdoc -v=2.4.3 新 Redmine の展開 RubyForge: Redmine: Project Filelist から 1.3.0 の tar.gz をダウンロードして展開。 ...

2011年12月29日 · Toshimitsu Takahashi