<commit_before>#############################################################
#	Application
#############################################################

set :application, 'feedbunch'

#############################################################
#	RVM
#############################################################

set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.2.2'
set :rvm_user_path, '~/.rvm'

#############################################################
#	Settings
#############################################################

set :format, :pretty
set :log_level, :info

# Map new commands we need during deployment
SSHKit.config.command_map[:puma] = 'sudo service feedbunch-puma'
SSHKit.config.command_map[:redis_cache] = 'sudo service redis-cache'
SSHKit.config.command_map[:redis_sidekiq] = 'sudo service redis-sidekiq'
SSHKit.config.command_map[:sidekiq] = 'sudo service sidekiq'

# Lazily evaluate :stage variable. It is given value in the stage files, which are ran after this one. This means
# that the value of :stage cannot be directly fetched in this file, but it can be lazily evaluated so that
# the value is retrieved after the stage file has run (and so the variable has value).
set :stage, proc{fetch :stage}

#############################################################
#	Servers
#############################################################

set :deploy_to, '/var/rails/feedbunch'
set :keep_releases, 5
set :linked_files, %w{
                      config/database.yml
                      config/secrets.yml
                      config/newrelic.yml
                      redis-cache/redis.conf
                      redis-sidekiq/redis.conf
                  }
set :linked_dirs, %w{
                      bin
                      log
                      uploads
                      public/assets
                      public/system
                      tmp/cache
                      tmp/pids
                      tmp/sockets
                      vendor/bundle
                      rack_cache
                  }

#############################################################
#	Git
#############################################################

set :scm, :git
set :repo_url,  'git://github.com/amatriain/feedbunch.git'
# Default is to deploy master, but it can be overriden with REVISION or BRANCH_NAME env variables
set :branch, ENV['REVISION'] || ENV['BRANCH_NAME'] || 'master'

#############################################################
#	Puma
#############################################################

namespace :puma do

  desc 'Start Puma'
  task :start do
    on roles :app do
      execute :puma, 'start'
    end
  end

  desc 'Stop Puma'
  task :stop do
    on roles :app do
      execute :puma, 'stop'
    end
  end

  desc 'Restart Puma'
  task :restart do
    on roles :app do
      execute :puma, 'restart'
    end
  end

  desc 'Restart Puma with phased-restart. If there have been changes in the DB schema you MUST issue a stop+start manually.'
  task :phased_restart do
    on roles :app do
      within release_path do
        execute :bundle, :exec, :pumactl, "-F config/puma/#{fetch :stage}.rb", 'phased-restart'
      end
    end
  end

end

#############################################################
#	Redis backend for Rails cache
#############################################################

namespace :redis_cache do

  desc 'Start Redis backend for Rails cache'
  task :start do
    on roles :background do
      execute :redis_cache, 'start'
    end
  end

  desc 'Stop Redis backend for Rails cache'
  task :stop do
    on roles :background do
      execute :redis_cache, 'stop'
    end
  end

  desc 'Restart Redis backend for Rails cache'
  task :restart do
    invoke 'redis_cache:stop'
    invoke 'redis_cache:start'
  end

  desc 'Clear the Rails cache, removing all saved data from Redis'
  task :clear do
    on roles :background do
      within release_path do
        execute :rake, 'rails_cache:clear'
      end
    end
  end
end

#############################################################
#	Redis backend for Sidekiq
#############################################################
<commit_msg>Redis server for the Rails cache is now in the web server, instead of the background server.<commit_after>#############################################################
#	Application
#############################################################

set :application, 'feedbunch'

#############################################################
#	RVM
#############################################################

set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.2.2'
set :rvm_user_path, '~/.rvm'

#############################################################
#	Settings
#############################################################

set :format, :pretty
set :log_level, :info

# Map new commands we need during deployment
SSHKit.config.command_map[:puma] = 'sudo service feedbunch-puma'
SSHKit.config.command_map[:redis_cache] = 'sudo service redis-cache'
SSHKit.config.command_map[:redis_sidekiq] = 'sudo service redis-sidekiq'
SSHKit.config.command_map[:sidekiq] = 'sudo service sidekiq'

# Lazily evaluate :stage variable. It is given value in the stage files, which are ran after this one. This means
# that the value of :stage cannot be directly fetched in this file, but it can be lazily evaluated so that
# the value is retrieved after the stage file has run (and so the variable has value).
set :stage, proc{fetch :stage}

#############################################################
#	Servers
#############################################################

set :deploy_to, '/var/rails/feedbunch'
set :keep_releases, 5
set :linked_files, %w{
                      config/database.yml
                      config/secrets.yml
                      config/newrelic.yml
                      redis-cache/redis.conf
                      redis-sidekiq/redis.conf
                  }
set :linked_dirs, %w{
                      bin
                      log
                      uploads
                      public/assets
                      public/system
                      tmp/cache
                      tmp/pids
                      tmp/sockets
                      vendor/bundle
                      rack_cache
                  }

#############################################################
#	Git
#############################################################

set :scm, :git
set :repo_url,  'git://github.com/amatriain/feedbunch.git'
# Default is to deploy master, but it can be overriden with REVISION or BRANCH_NAME env variables
set :branch, ENV['REVISION'] || ENV['BRANCH_NAME'] || 'master'

#############################################################
#	Puma
#############################################################

namespace :puma do

  desc 'Start Puma'
  task :start do
    on roles :app do
      execute :puma, 'start'
    end
  end

  desc 'Stop Puma'
  task :stop do
    on roles :app do
      execute :puma, 'stop'
    end
  end

  desc 'Restart Puma'
  task :restart do
    on roles :app do
      execute :puma, 'restart'
    end
  end

  desc 'Restart Puma with phased-restart. If there have been changes in the DB schema you MUST issue a stop+start manually.'
  task :phased_restart do
    on roles :app do
      within release_path do
        execute :bundle, :exec, :pumactl, "-F config/puma/#{fetch :stage}.rb", 'phased-restart'
      end
    end
  end

end

#############################################################
#	Redis backend for Rails cache
#############################################################

namespace :redis_cache do

  desc 'Start Redis backend for Rails cache'
  task :start do
    on roles :app do
      execute :redis_cache, 'start'
    end
  end

  desc 'Stop Redis backend for Rails cache'
  task :stop do
    on roles :app do
      execute :redis_cache, 'stop'
    end
  end

  desc 'Restart Redis backend for Rails cache'
  task :restart do
    invoke 'redis_cache:stop'
    invoke 'redis_cache:start'
  end

  desc 'Clear the Rails cache, removing all saved data from Redis'
  task :clear do
    on roles :app do
      within release_path do
        execute :rake, 'rails_cache:clear'
      end
    end
  end
end

#############################################################
#	Redis backend for Sidekiq
#############################################################

{'fraction_non_alphanumeric': 0.29093497864261986, 'fraction_numerical': 0.0009492168960607499, 'mean_word_length': 3.1399803536345776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1018391', 'n_tokens_mistral': 2334, 'n_tokens_neox': 2166, 'n_words': 708}