-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 272fbf9
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vagrant | ||
.bundle | ||
tmp/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
default[:valhalla][:user] = 'valhalla' | ||
default[:valhalla][:base_dir] = '/data' | ||
default[:valhalla][:s3bucket] = 'mapzen.valhalla' | ||
default[:valhalla][:s3bucket_dir] = 'prod' | ||
default[:valhalla][:log_dir] = "#{node[:valhalla][:base_dir]}/logs" | ||
default[:valhalla][:tile_dir] = "#{node[:valhalla][:base_dir]}/valhalla" | ||
default[:valhalla][:transit_dir] = "#{node[:valhalla][:base_dir]}/valhalla/transit" | ||
default[:valhalla][:elevation_dir] = "#{node[:valhalla][:base_dir]}/valhalla/elevation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name 'mapzen_valhalla-docker' | ||
maintainer 'Mapzen' | ||
maintainer_email '[email protected]' | ||
license 'All rights reserved' | ||
description 'Installs/Configures valhalla host systems' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version '0.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Cookbook Name:: mapzen_valhalla-docker | ||
# Recipe:: default | ||
# | ||
# Copyright 2016, Mapzen | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# | ||
|
||
# make the valhalla user | ||
user node[:valhalla][:user][:name] do | ||
manage_home false | ||
home node[:valhalla][:base_dir] | ||
not_if { node[:valhalla][:user][:name] == 'root' } | ||
end | ||
|
||
# set up directory structure | ||
dirs = [ | ||
node[:valhalla][:base_dir], | ||
node[:valhalla][:log_dir], | ||
node[:valhalla][:tile_dir], | ||
node[:valhalla][:transit_dir], | ||
node[:valhalla][:elevation_dir] | ||
] | ||
|
||
dirs.each do |d| | ||
directory d do | ||
owner node[:valhalla][:user] | ||
recursive true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Cookbook Name:: mapzen_valhalla-docker | ||
# Recipe:: default | ||
# | ||
# Copyright 2016, Mapzen | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# | ||
|
||
# go get the tiles | ||
execute 'pull tiles' do | ||
cwd node[:valhalla][:base_dir] | ||
command <<-EOH | ||
echo -n https://s3.amazonaws.com/#{node[:valhalla][:s3bucket]}/#{node[:valhalla][:s3bucket_dir]}/ > latest_tiles.txt && | ||
aws --region us-east-1 s3 ls s3://#{node[:valhalla][:s3bucket]}/#{node[:valhalla][:s3bucket_dir]}/ | grep -F tiles_ | awk '{print $4}' | sort | tail -n 1 >> latest_tiles.txt | ||
EOH | ||
end | ||
|
||
# open them up | ||
execute 'extract tiles' do | ||
cwd node[:valhalla][:base_dir] | ||
command <<-EOH | ||
rm -rf tmp_tiles old_tiles && | ||
mkdir tmp_tiles && | ||
curl $(cat latest_tiles.txt) 2>#{node[:valhalla][:log_dir]}/curl_tiles.log | tar xzp -C tmp_tiles 2>#{node[:valhalla][:log_dir]}/untar_tiles.log | ||
EOH | ||
retries 3 | ||
end | ||
|
||
# move them into place | ||
execute 'move tiles' do | ||
cwd node[:valhalla][:base_dir] | ||
command "mv #{node[:valhalla][:tile_dir]} old_tiles; mv tmp_tiles #{node[:valhalla][:tile_dir]}" | ||
end |