さて、これでrbenvも設定し、Rubyも2.3が動くようになったので、やっとRedmine 3.2のInstallへ。
pkg install nginx ImageMagick mariadb100-clientgem install bundler –no-rdoc –no-ricurl http://www.redmine.org/releases/redmine-3.2.0.tar.gz > redmine-3.2.0.tar.gz mkdir /usr/local/wwwcd /usr/local/wwwtar xzf redmine-3.2.0.tar.gzln -s redmine-3.2.0 redminecp redmine/config/database.yml.example redmine/config/database.ymlvi redmine/config/database.ymlproduction: adapter: mysql2 database: redminedb host: xxx.xxx.xxx.xxx username: redmine_user password: "UltraSecret" encoding: utf8
gem "unicorn"
bundle install –without development test postgresql sqlitesudo -u redmine /bin/shbundle exec rake generate_secret_tokenRAILS_ENV=production bundle exec rake db:migrateRAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data# cat config/unicorn.rb
# -*- coding: utf-8 -*-
# Unicorn Configuration File for Redmine
# http://unicorn.bogomips.org/examples/unicorn.conf.rb
$unicorn_user = "redmine"
$unicorn_group = "redmine"
@dir = "/home/www/rrrm.rusty-raven.net/redmine"
working_directory @dir
worker_processes 2
listen "/var/run/unicorn_rrrm.sock", :backlog => 32
# listen 8282, :tcp_nopush => true
timeout 30
pid "/var/run/unicorn.pid"
stdout_path File.expand_path("log/unicorn.stdout.log", @dir)
stderr_path File.expand_path("log/unicorn.stderr.log", @dir)
preload_app true
check_client_connection false
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
end
after_fork do |server, worker|
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
begin
worker.user($unicorn_user,$unicorn_group)
rescue => ex
STDERR.puts "could not change user, oh well"
STDERR.puts ex.to_s
raise ex
end
end
#
upstream REDMINE {
server unix:/var/run/unicorn.sock;
}
server {
listen 80 sndbuf=16k
server_name redmine.example.net;
location / {
proxy_pass http://REDMINE;
}
}
これで、とりあえず、Redmineまでは動くはず。