Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Adding GeoIP databases.
Browse files Browse the repository at this point in the history
  • Loading branch information
darron committed Apr 16, 2014
1 parent 65c3874 commit ebd5edd
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions recipes/openresty.rb
Expand Up @@ -69,6 +69,38 @@
notifies :restart, 'service[proxy]', :delayed
end

# Setup GeoIP
directory '/usr/local/share/GeoIP/' do
owner 'root'
group 'root'
mode '0755'
recursive true
action :create
end

remote_file '/usr/local/share/GeoIP/GeoIP.dat.gz' do
source 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz'
owner 'root'
group 'root'
not_if { File.exist?('/usr/local/share/GeoIP/GeoIP.dat') }
end

remote_file '/usr/local/share/GeoIP/GeoLiteCity.dat.gz' do
source 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz'
owner 'root'
group 'root'
not_if { File.exist?('/usr/local/share/GeoIP/GeoLiteCity.dat') }
end

bash 'unzip the GeoIP files' do
user 'root'
cwd '/usr/local/share/GeoIP/'
code <<-EOH
gunzip *
EOH
not_if { File.exist?('/usr/local/share/GeoIP/GeoLiteCity.dat') }
end

service 'proxy' do
supports :status => true # rubocop:disable HashSyntax
action [:enable, :start]
Expand Down

0 comments on commit ebd5edd

Please sign in to comment.