Sha256: 40dc610f51094ff2854f59841e0c871530745211cd2c441696656ec12648b89f
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
namespace :nginx do task :install do on roles :web do execute 'sudo apt-get install -y nginx' execute 'sed -i "s/# server_names_hash_bucket_size 64/server_names_hash_bucket_size 64/" /etc/nginx/nginx.conf' template 'vhost.conf', '/etc/nginx/conf.d/vhost.conf' invoke 'nginx:restart' end end task :cert do on roles(:web) do |host| run_locally do run_in host, <<-EOBLOCK cd /usr/local/sbin sudo wget https://dl.eff.org/certbot-auto sudo chmod a+x /usr/local/sbin/certbot-auto mkdir /var/www/#{fetch :application}/current/public/.well-known sudo certbot-auto certonly -a webroot --webroot-path=/var/www/#{fetch :application}/current/public -d #{host.hostname} sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 EOBLOCK end end end task :ssl do on roles(:web) do |host| template 'vhost_ssl.conf', '/etc/nginx/conf.d/vhost.conf' invoke 'nginx:restart' end end %w(start stop restart status).each do |action| desc "Nginx" task :"#{action}" do on roles(:app) do execute "sudo service nginx #{action}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prun-ops-0.2.2 | lib/capistrano/config/nginx.rake |
prun-ops-0.2.1 | lib/capistrano/config/nginx.rake |
prun-ops-0.2.0 | lib/capistrano/config/nginx.rake |