Sha256: 1d53ffaab85cd342821abc55d752f1d1615087195547d38bd76200191488b134

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

namespace :nginx do

  desc 'Nginx setup.'
  task :setup do
    on roles(:app) do
      puts "Creating #{fetch(:shared_path)}/config/nginx.#{fetch(:rails_env)}.conf"
      template "nginx.#{fetch(:rails_env)}.erb", "#{fetch(:shared_path)}/config/nginx.#{fetch(:rails_env)}.conf"

      puts "Symlinks #{fetch(:shared_path)}/config/nginx.#{fetch(:rails_env)}.conf to /etc/nginx/sites-enabled/#{fetch(:application)}"
      sudo "ln -nfs #{fetch(:shared_path)}/config/nginx.#{fetch(:rails_env)}.conf /etc/nginx/sites-enabled/#{fetch(:application)}"

    end
  end

  %w[start stop restart reload].each do |command|
    desc "Nginx #{command}"
    task command do
      on roles(:app), in: :groups, limit: 2, wait: 2 do
        sudo "service nginx #{command}"
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
recipes_matic-1.3.0 lib/generators/recipes_matic/templates/lib/capistrano/tasks/nginx.rake
recipes_matic-1.2.1 lib/generators/recipes_matic/templates/lib/capistrano/tasks/nginx.rake
recipes_matic-1.2.0 lib/generators/recipes_matic/templates/lib/capistrano/tasks/nginx.rake