Created
July 3, 2012 15:50
-
-
Save peleteiro/3040613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
REDIS_VERSION = "2.6.0-rc5" | |
ELASTICSEARCH_VERSION = "0.19.7" | |
task :install => %w[install:postgres install:redis install:elasticsearch] | |
namespace :install do | |
task :postgres do | |
next if File.exist?("#{Rails.root}/vendor/postgres") | |
system <<-bash | |
initdb --username=postgres --pgdata="#{Rails.root}/vendor/postgres" | |
bash | |
end | |
task :redis do | |
next if File.exist?("#{Rails.root}/vendor/redis/#{REDIS_VERSION}") | |
system <<-bash | |
rm -rf #{Rails.root}/vendor/redis | |
curl http://redis.googlecode.com/files/redis-#{REDIS_VERSION}.tar.gz -o /tmp/redis.tar.gz | |
mkdir -p #{Rails.root}/vendor/redis | |
touch #{Rails.root}/vendor/redis/#{REDIS_VERSION} | |
tar -C #{Rails.root}/vendor/redis --strip-components 1 -xvzf /tmp/redis.tar.gz | |
cd #{Rails.root}/vendor/redis | |
make | |
bash | |
File.open("#{Rails.root}/vendor/redis/redis.conf", "w") do |file| | |
file << <<-CONF | |
daemonize no | |
timeout 300 | |
loglevel notice | |
logfile stdout | |
save 900 1 | |
save 300 10 | |
save 60 10000 | |
rdbcompression yes | |
appendonly no | |
appendfsync no | |
dir #{Rails.root}/vendor/redis/ | |
dbfilename dump.rdb | |
CONF | |
end | |
end | |
task :elasticsearch do | |
next if File.exist?("#{Rails.root}/vendor/elasticsearch/#{ELASTICSEARCH_VERSION}") | |
system <<-bash | |
rm -rf #{Rails.root}/vendor/elasticsearch | |
mkdir -p #{Rails.root}/vendor/elasticsearch | |
touch #{Rails.root}/vendor/elasticsearch/#{ELASTICSEARCH_VERSION} | |
curl http://cloud.github.com/downloads/elasticsearch/elasticsearch/elasticsearch-#{ELASTICSEARCH_VERSION}.tar.gz -o /tmp/es.tar.gz | |
tar -C #{Rails.root}/vendor/elasticsearch --strip-components 1 -xvzf /tmp/es.tar.gz | |
#{Rails.root}/vendor/elasticsearch/bin/plugin -install mobz/elasticsearch-head | |
bash | |
end | |
end |
This file contains hidden or 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
rails: rails s | |
pg: postgres -D vendor/postgres | |
es: vendor/elasticsearch/bin/elasticsearch -f | |
redis: vendor/redis/src/redis-server vendor/redis/redis.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment