Commit db3a2c8
Changed files (6)
attributes
recipes
attributes/default.rb
@@ -57,10 +57,10 @@ pg_connection_string =
nil
end
default['stronglifters']['env'] = {
- asset_host: '',
- database_url: pg_connection_string,
- rails_env: 'production',
- secret_token: '',
+ ASSET_HOST: '',
+ DATABASE_URL: pg_connection_string,
+ RAILS_ENV: 'production',
+ SECRET_TOKEN: '',
}
default['stronglifters']['nginx']['ssl']['key'] = <<-SELFSIGNED
recipes/rails.rb
@@ -16,6 +16,10 @@ directory root_path do
recursive true
end
+template "/home/#{node["stronglifters"]["username"]}/.profile" do
+ variables(env: node["stronglifters"]["env"])
+end
+
gem "foreman"
runit_service "foreman" do
templates/.profile.erb
@@ -0,0 +1,3 @@
+<% @env.each do |key, value| %>
+<%= key.to_s.upcase %>="<%= value.to_s.gsub("\n", '\n') %>"
+<% end %>
templates/sv-foreman-run.erb
@@ -3,4 +3,5 @@ exec 2>&1
source /etc/profile.d/rbenv.sh
envdir=$(pwd)/env
cd <%= node['stronglifters']['root_path'] %>/current
-exec chpst -e $envdir /usr/local/rbenv/shims/foreman start
+exec chpst -u <%= node['stronglifters']['username'] %> \
+ -e $envdir /usr/local/rbenv/shims/foreman start
templates/sv-puma-run.erb
@@ -3,4 +3,4 @@ exec 2>&1
source /etc/profile.d/rbenv.sh
envdir=$(pwd)/env
cd <%= node['stronglifters']['root_path'] %>/current
-exec chpst -e $envdir /usr/local/rbenv/shims/bundle exec puma -C config/puma_production.rb
+exec chpst -u <%= node['stronglifters']['username'] %> -e $envdir /usr/local/rbenv/shims/bundle exec puma -C config/puma_production.rb
templates/sv-sidekiq-run.erb
@@ -3,4 +3,4 @@ exec 2>&1
source /etc/profile.d/rbenv.sh
envdir=$(pwd)/env
cd <%= node['stronglifters']['root_path'] %>/current
-exec chpst -e $envdir /usr/local/rbenv/shims/bundle exec sidekiq
+exec chpst -u <%= node['stronglifters']['username'] %> -e $envdir /usr/local/rbenv/shims/bundle exec sidekiq