summaryrefslogtreecommitdiff
path: root/recipes/rails.rb
blob: 09fbc59ede01bfa55e1f8c7835e2c5ad5dddd2c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
include_recipe "stronglifters::user"
include_recipe "stronglifters::aws"

root_path = node["stronglifters"]["root_path"]
shared_path = File.join(root_path, "shared")

template "/etc/logrotate.d/rails" do
  source "rails_logrotate.erb"
  mode "0644"
  variables({ shared_path: shared_path })
end

template "/etc/profile.d/rails.sh" do
  variables(env: node["stronglifters"]["env"])
end

[root_path, shared_path, "#{shared_path}/config"].each do |dir|
  directory dir do
    mode "0755"
    owner node["stronglifters"]["username"]
    group node["stronglifters"]["username"]
    recursive true
  end
end

file "#{shared_path}/config/database.yml" do
  content <<-YAML
production:
  adapter: postgresql
  encoding: unicode
  pool: 5
  url: <%= ENV['DATABASE_URL'] %>
YAML
end