5 # Copyright:: 2014-2022, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # https://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 include_recipe "accounts"
21 include_recipe "planet::aws"
22 include_recipe "python"
24 aws_credentials = data_bag_item("tilelog", "aws")
26 tilelog_directory = "/opt/tilelog"
27 ofastlylog_directory = "/opt/ofastlylog"
28 tilelog_output_directory = node[:tilelog][:output_directory]
30 python_virtualenv tilelog_directory do
31 interpreter "/usr/bin/python3"
34 python_package "tilelog" do
35 python_virtualenv tilelog_directory
40 directory tilelog_output_directory do
47 template "/usr/local/bin/tilelog" do
52 variables :output_dir => tilelog_output_directory,
53 :aws_credentials => aws_credentials
56 systemd_service "tilelog" do
57 description "Tile log analysis"
59 exec_start "/usr/local/bin/tilelog"
61 sandbox :enable_network => true
63 bind_paths "/home/planet"
64 read_write_paths tilelog_output_directory
67 systemd_timer "tilelog" do
68 description "Tile log analysis"
69 on_calendar "*-*-* 01:35:00"
72 service "tilelog.timer" do
73 action [:enable, :start]
76 python_virtualenv ofastlylog_directory do
77 interpreter "/usr/bin/python3"
80 python_package "ofastlylog" do
81 python_virtualenv ofastlylog_directory
86 template "/usr/local/bin/ofastlylog-hourly" do
87 source "ofastlylog-hourly.erb"
91 variables :aws_credentials => aws_credentials
94 systemd_service "ofastlylog-hourly" do
95 description "ofastlylog analysis"
98 exec_start "/usr/local/bin/ofastlylog-hourly"
100 sandbox :enable_network => true
104 systemd_timer "ofastlylog-hourly" do
105 description "Fastlylog log analysis"
106 on_calendar "*-*-* *:07:00"
109 service "ofastlylog-hourly.timer" do
110 action [:enable, :start]