Instantly share code, notes, and snippets.

Embed
What would you like to do?
Redmine構築のためのitamaeレシピ
%w(ruby ruby-devel mariadb-devel mariadb-server ImageMagick ImageMagick-devel ipa-pgothic-fonts).each do |pkg|
package pkg
end
%w(bundler).each do |pkg|
execute "install #{pkg}" do
command "gem install #{pkg}"
not_if "gem list | grep #{pkg}"
end
end
service "mariadb" do
action [:start, :enable]
end
service "firewalld" do
action [:stop, :disable]
end
directory "/app" do
owner "vagrant"
action :create
end
execute "download redmine" do
cwd "/tmp"
user "vagrant"
command "curl -O http://www.redmine.org/releases/redmine-3.0.0.tar.gz"
not_if "test -e redmine-3.0.0.tar.gz"
end
execute "arrange redmine" do
cwd "/tmp"
user "vagrant"
command "tar xvf redmine-3.0.0.tar.gz && mv -f redmine-3.0.0 /app/redmine"
not_if "test -d /app/redmine"
end
template "/app/redmine/config/database.yml" do
user "vagrant"
action :create
source "conf/database.yml.erb"
end
execute "bundle install" do
user "vagrant"
command "/usr/local/bin/bundle install --without development test --path vendor/bundle"
cwd "/app/redmine"
end
execute "generate config/initializers/session_store.rb" do
user "vagrant"
cwd "/app/redmine"
command "/usr/local/bin/bundle exec rake generate_session_store"
end
execute "initialize database" do
user "vagrant"
cwd "/app/redmine"
command "/usr/local/bin/bundle exec rake db:create RAILS_ENV=production"
end
execute "migrate database" do
user "vagrant"
cwd "/app/redmine"
command "/usr/local/bin/bundle exec rake db:migrate RAILS_ENV=production; /usr/local/bin/bundle exec rake redmine:load_default_data REDMINE_LANG=ja RAILS_ENV=production"
end
execute "start rails" do
user "vagrant"
cwd "/app/redmine"
command "RAILS_ENV=production /usr/local/bin/bundle exec rails s -d --bind=0.0.0.0"
not_if "test -e /app/redmine/tmp/pids/server.pid"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment