Fix the application resources to work on Chef 14

This commit is contained in:
Greg Karékinian 2019-04-10 11:48:47 +02:00
parent 126b5f8dd5
commit 919f5db431

View File

@ -99,10 +99,6 @@ application mastodon_path do
version ruby_version version ruby_version
end end
ruby_gem 'bundler' do
version "1.17.3" # 2.0 needs Ruby 2.6 or RubyGems 3.0
end
git do git do
user "mastodon" user "mastodon"
group "mastodon" group "mastodon"
@ -134,10 +130,11 @@ application mastodon_path do
db_pass: postgresql_data_bag_item['mastodon_user_password'] db_pass: postgresql_data_bag_item['mastodon_user_password']
end end
bundle_install do execute do
environment "HOME" => mastodon_path
user "mastodon" user "mastodon"
deployment true cwd mastodon_path
without %w(development test) command "/opt/ruby_build/builds/#{ruby_version}/bin/bundle install --without development,test --deployment"
end end
execute do execute do
@ -148,11 +145,19 @@ application mastodon_path do
end end
rails do rails do
migrate true migrate false
rails_env "production" rails_env "production"
precompile_assets false # buggy, done manually below precompile_assets false # buggy, done manually below
end end
execute 'rake db:migrate' do
environment "RAILS_ENV" => "production", "HOME" => mastodon_path
user "mastodon"
group "mastodon"
cwd mastodon_path
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" bundle exec rake db:migrate"
end
# This is the only way I could find that makes compiling the assets # This is the only way I could find that makes compiling the assets
# successfully for now. application_ruby's precompile_assets crashes because # successfully for now. application_ruby's precompile_assets crashes because
# it cannot find the bundled gems # it cannot find the bundled gems
@ -161,7 +166,7 @@ application mastodon_path do
user "mastodon" user "mastodon"
group "mastodon" group "mastodon"
cwd mastodon_path cwd mastodon_path
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" /opt/ruby_build/builds/#{ruby_version}/bin/bundle exec rake assets:precompile" command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" bundle exec rake assets:precompile"
end end
service "mastodon-web" do service "mastodon-web" do