Fix the application resources to work on Chef 14

This commit is contained in:
Greg 2019-04-10 11:48:47 +02:00
parent 126b5f8dd5
commit 919f5db431
1 changed files with 14 additions and 9 deletions

View File

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