diaspora/lib/tasks/heroku.rake
Jonne Haß 2a4db54db9 New configuration system
* Throw away old system
* Add new system
* Add new example files
* Replace all calls
* add the most important docs
* Add Specs
* rename disable_ssl_requirement to require_ssl
* cloudfiles isn't used/called in our code
* since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it
* die if session secret is unset and on heroku
* First basic infrastructure for version information
2012-09-26 20:19:37 +02:00

34 lines
1.3 KiB
Ruby

#Copyright (c) 2012, Diaspora Inc. This file is
#licensed under the Affero General Public License version 3 or later. See
#the COPYRIGHT file.
namespace :heroku do
HEROKU_CONFIG_ADD_COMMAND = "heroku config:add"
task :generate_secret_token do
puts "Generating and setting a new secret token"
token = SecureRandom.hex(40) #reloads secret token every time you reload vars.... this expires cookies, and kinda sucks
command = "#{HEROKU_CONFIG_ADD_COMMAND} SECRET_TOKEN=#{token}"
puts command
system command
end
task :install_requirements do
system 'heroku addons:remove logging:basic'
system 'heroku addons:add logging:expanded'
system 'heroku addons:add redistogo:nano'
end
task :set_up_s3_sync => [:environment] do
fog_provider = "FOG_PROVIDER=AWS"
aws_access_key_id = "AWS_ACCESS_KEY_ID=#{AppConfig.environment.s3.key}"
aws_secret_access_key = "AWS_SECRET_ACCESS_KEY=#{AppConfig.environment.s3.secret}"
fog = "FOG_DIRECTORY=#{AppConfig.environment.s3.bucket}"
asset_host = "ASSET_HOST=https://#{AppConfig.environment.s3.bucket}.s3.amazonaws.com"
each_heroku_app do |stage|
system("heroku labs:enable user_env_compile -a #{stage.app}")
stage.run('config:add', "#{fog} #{fog_provider} #{aws_secret_access_key} #{aws_access_key_id} ASSET_HOST=#{asset_host}")
end
end
end