diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 653c098..c5483f9 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -23,6 +23,8 @@ unless platform?('ubuntu') && node[:platform_version].to_f < 18.04 owner 'mastodon' action :create end +else + postgresql_data_bag_item = {} end mastodon_path = node["kosmos-mastodon"]["directory"] @@ -88,6 +90,8 @@ template "/lib/systemd/system/mastodon-streaming.service" do notifies :restart, "service[mastodon-streaming]", :delayed end +user = "mastodon" + application mastodon_path do owner "mastodon" group "mastodon" @@ -100,8 +104,8 @@ application mastodon_path do end git do - user "mastodon" - group "mastodon" + user user + group user repository "https://gitea.kosmos.org/kosmos/mastodon.git" revision "production" end @@ -111,8 +115,8 @@ application mastodon_path do template ".env.production" do source "env.production.erb" mode "0640" - owner "mastodon" - group "mastodon" + owner user + group user variables redis_url: node["kosmos-mastodon"]["redis_url"], domain: node["kosmos-mastodon"]["server_name"], paperclip_secret: mastodon_credentials['paperclip_secret'], @@ -132,14 +136,14 @@ application mastodon_path do execute do environment "HOME" => mastodon_path - user "mastodon" + user user cwd mastodon_path command "/opt/ruby_build/builds/#{ruby_version}/bin/bundle install --without development,test --deployment" end execute do environment "HOME" => mastodon_path - user "mastodon" + user user cwd mastodon_path command "yarn install --pure-lockfile" end @@ -152,8 +156,8 @@ application mastodon_path do execute 'rake db:migrate' do environment "RAILS_ENV" => "production", "HOME" => mastodon_path - user "mastodon" - group "mastodon" + user user + group user cwd mastodon_path command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" bundle exec rake db:migrate" end @@ -163,8 +167,8 @@ application mastodon_path do # it cannot find the bundled gems execute 'rake assets:precompile' do environment "RAILS_ENV" => "production", "HOME" => mastodon_path - user "mastodon" - group "mastodon" + user user + group user cwd mastodon_path command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" bundle exec rake assets:precompile" end