Sha256: 08561c6592f181c469d864d0a11688ea211601c388c6292fdb1719e5deb0777e

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

namespace :setup do

  task :firewall do

    def ufw(*rule)
      sudo :ufw, *rule
    end

    on roles(:all) do
      upload_as :root, file("ufw"), "/etc/default/ufw"
      ufw :allow, "in ssh"
    end

    on roles(:db) do
      roles(:app).each do |server|
        ufw :allow, "proto tcp from #{server.hostname} to any port postgresql"
      end
    end

    on roles(:indexer) do
      roles(:app).each do |server|
        ufw :allow, "proto tcp from #{server.hostname} to any port 8983"
      end
    end

    on roles(:cache) do
      roles(:app).each do |server|
        ufw :allow, "proto tcp from #{server.hostname} to any port 6379"
      end
    end

    on roles(:web) do
      roles(:proxy).each do |server|
        ufw :allow, "proto tcp from #{server.hostname} to any port http"
      end
    end


    on roles(:proxy) do |server|
      ufw :allow, "in http"
      ufw :allow, "in https"
    end

    on roles(:all) do
      execute :yes, "| sudo ufw enable"
    end

  end

end


before "setup:finished", "setup:firewall"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
capistrano-cluster-0.0.17 tasks/setup/firewall.rake
capistrano-cluster-0.0.16 tasks/setup/firewall.rake
capistrano-cluster-0.0.15 tasks/setup/firewall.rake
capistrano-cluster-0.0.14 tasks/setup/firewall.rake
capistrano-cluster-0.0.13 tasks/setup/firewall.rake
capistrano-cluster-0.0.12 tasks/setup/firewall.rake
capistrano-cluster-0.0.11 tasks/setup/firewall.rake