Commit eeaf683 1 parent d996203 commit eeaf683 Copy full SHA for eeaf683
File tree 2 files changed +26
-10
lines changed
2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change 19
19
20
20
include_recipe "web::base"
21
21
22
- ruby = "ruby#{ node [ :ruby ] [ :version ] } "
22
+ web_passwords = data_bag_item ( "web" , "passwords" )
23
+
23
24
rails_directory = "#{ node [ :web ] [ :base_directory ] } /rails"
24
25
25
- template "/etc/cron.daily/web-cleanup" do
26
- source "cleanup.cron.erb"
27
- owner "root"
28
- group "root"
29
- mode "755"
30
- variables :ruby => ruby , :directory => rails_directory
26
+ file "/etc/cron.daily/web-cleanup" do
27
+ action :delete
28
+ end
29
+
30
+ systemd_service "rails-cleanup" do
31
+ description "Rails cleanup"
32
+ type "simple"
33
+ environment "RAILS_ENV" => "production" ,
34
+ "SECRET_KEY_BASE" => web_passwords [ "secret_key_base" ]
35
+ user "rails"
36
+ working_directory rails_directory
37
+ exec_start "#{ node [ :ruby ] [ :bundle ] } exec rails db:expire_tokens"
38
+ sandbox :enable_network => true
39
+ memory_deny_write_execute false
40
+ read_write_paths "/var/log/web"
41
+ end
42
+
43
+ systemd_timer "rails-cleanup" do
44
+ description "Rails cleanup"
45
+ on_calendar "02:00"
46
+ end
47
+
48
+ service "rails-cleanup.timer" do
49
+ action [ :enable , :start ]
31
50
end
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments