include_recipe "postgresql"
include_recipe "git"
+include_recipe "python"
passwords = data_bag_item("db", "passwords")
+wal_secrets = data_bag_item("db", "wal-secrets")
postgresql_munin "openstreetmap" do
cluster node[:db][:cluster]
owner "root"
group "root"
end
+
+package "lzop"
+
+python_package "wal-e" do
+ python_version "3"
+end
+
+python_package "boto" do
+ python_version "3"
+end
+
+template "/usr/local/bin/openstreetmap-wal-e" do
+ source "wal-e.erb"
+ owner "root"
+ group "postgres"
+ mode 0o750
+ variables :s3_key => wal_secrets["s3_key"]
+end
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+export WALE_S3_PREFIX="s3://openstreetmap-wal/"
+export AWS_ACCESS_KEY_ID="AKIAIQX2LTDOBIW4CZUQ"
+export AWS_SECRET_ACCESS_KEY="<%= @s3_key %>"
+export AWS_REGION="eu-west-2"
+
+exec /usr/local/bin/wal-e "$@"
property :package_name, :kind_of => String, :name_property => true
property :version, :kind_of => String
+property :python_version, :kind_of => String
action :install do
if version.nil?
execute "pip-install-#{name}" do
- command "pip install #{new_resource.package_name}"
- not_if "pip show #{new_resource.package_name}"
+ command "#{pip_command} install #{new_resource.package_name}"
+ not_if "#{pip_command} show #{new_resource.package_name}"
end
else
execute "pip-install-#{name}" do
- command "pip install #{new_resource.package_name}==#{new_resource.version}"
- not_if "pip show #{new_resource.package_name} | fgrep -q #{new_resource.version}"
+ command "#{pip_command} install #{new_resource.package_name}==#{new_resource.version}"
+ not_if "#{pip_command} show #{new_resource.package_name} | fgrep -q #{new_resource.version}"
end
end
end
action :remove do
execute "pip-uninstall-#{name}" do
- command "pip uninstall #{new_resource.package_name}"
- only_if "pip show #{new_resource.package_name}"
+ command "#{pip_command} uninstall #{new_resource.package_name}"
+ only_if "#{pip_command} show #{new_resource.package_name}"
end
end
+
+def pip_command
+ "pip#{python_version}"
+end