From 70fcbe308601afc253a21e4d93737164621a7c31 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 10 Aug 2019 16:48:21 +0800 Subject: [PATCH 2/2] Delete `statup` cookbook. --- cookbooks/statup/attributes.rb | 10 --- cookbooks/statup/default.rb | 11 --- cookbooks/statup/files/etc/cron.d/statup | 1 - .../live/status.kazu634.com/dhparams_4096.pem | 13 --- .../files/etc/supervisor/conf.d/statup.conf | 10 --- cookbooks/statup/install.rb | 22 ----- cookbooks/statup/setup.rb | 80 ------------------- cookbooks/statup/ssl.rb | 23 ------ 8 files changed, 170 deletions(-) delete mode 100644 cookbooks/statup/attributes.rb delete mode 100644 cookbooks/statup/default.rb delete mode 100644 cookbooks/statup/files/etc/cron.d/statup delete mode 100644 cookbooks/statup/files/etc/letsencrypt/live/status.kazu634.com/dhparams_4096.pem delete mode 100644 cookbooks/statup/files/etc/supervisor/conf.d/statup.conf delete mode 100644 cookbooks/statup/install.rb delete mode 100644 cookbooks/statup/setup.rb delete mode 100644 cookbooks/statup/ssl.rb diff --git a/cookbooks/statup/attributes.rb b/cookbooks/statup/attributes.rb deleted file mode 100644 index a4dcb83..0000000 --- a/cookbooks/statup/attributes.rb +++ /dev/null @@ -1,10 +0,0 @@ -# ------------------------------------------- -# Specifying the default settings: -# ------------------------------------------- -node.reverse_merge!({ - 'statup' => { - 'FQDN' => 'status.kazu634.com', - 'db' => '/home/webadm/statup/statup.db', - 'config' => '/home/webadm/statup/config.yml' - } -}) diff --git a/cookbooks/statup/default.rb b/cookbooks/statup/default.rb deleted file mode 100644 index 74be2ba..0000000 --- a/cookbooks/statup/default.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Retrieve the default values: -include_recipe './attributes.rb' - -# Install statup -include_recipe './install.rb' - -# Setup statup -include_recipe './setup.rb' - -# Setup statup -include_recipe './ssl.rb' diff --git a/cookbooks/statup/files/etc/cron.d/statup b/cookbooks/statup/files/etc/cron.d/statup deleted file mode 100644 index b956c85..0000000 --- a/cookbooks/statup/files/etc/cron.d/statup +++ /dev/null @@ -1 +0,0 @@ -12 3 * * * root openssl rand 48 > /etc/letsencrypt/live/status.kazu634.com/ticket.key diff --git a/cookbooks/statup/files/etc/letsencrypt/live/status.kazu634.com/dhparams_4096.pem b/cookbooks/statup/files/etc/letsencrypt/live/status.kazu634.com/dhparams_4096.pem deleted file mode 100644 index b4c4948..0000000 --- a/cookbooks/statup/files/etc/letsencrypt/live/status.kazu634.com/dhparams_4096.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN DH PARAMETERS----- -MIICCAKCAgEA+gznnDB0OxkNsoQeMfWwyNvosTqhjM0uDVb4uyQJ9q6HHDtE2kic -OA84Z1AIrMut9IKQz0MOZ7aBiTQW6rV/XozTcfhEQbej61oqM+lHvd1iQfq9EJox -mDvSI4aqVsmICFBnEBp82NNJVAHnDzZj4FOOwhKMYk8d4tJpd+wBMcChOK3dGLTR -FDhN4cmcCptYfdPdLDr4+GWYI1BTn7JC5pTqhQRjOM3vLcLgYUJDDwW+xrAa+DIi -S06+1eBWnj9HrpxJLuauMzBuQ5B+1Y16tViavo35zBpakwMj0fKyMgx1L+mHW/0b -1wuIUIFudjsUY/NANDnTMT6qYhDtiQTDZ+pjJ9pVyrGd+15cNBhzkumzUwSWiiBM -VEkOSypSJl3JIVOvdo7oxP1RjJmSiaQjHg90ZC8xcqlQdlBm1m9RW8FAiNzchOrf -wEwM6XmTI31tzT2CF7xkz+KdLUjy/9It+DrA5JSxo0/5Izx9C4vttNckcecVjq1A -X5g9Beu74L+EJpP3qZym9+uZmQLKMlRXYLP+PDUK3eehUHrHOVSAx89UQ9LnEavB -m0MMUNLNTRt6iK0bBwNgUNTaENYRD9eEGs8w/6zmkCqgpKDCVBtdIo3P5mGYJ6eu -UbMmc4UaTUmNScPdiMOorxzDm6m6/lhD4Aeha8ofvy16BlsXG1YdNUMCAQI= ------END DH PARAMETERS----- diff --git a/cookbooks/statup/files/etc/supervisor/conf.d/statup.conf b/cookbooks/statup/files/etc/supervisor/conf.d/statup.conf deleted file mode 100644 index 46b5870..0000000 --- a/cookbooks/statup/files/etc/supervisor/conf.d/statup.conf +++ /dev/null @@ -1,10 +0,0 @@ -[program:statup] -command=/usr/local/bin/statup -ip 127.0.0.1 -stdout_logfile=/var/log/supervisor/statup.log -redirect_stderr=true -stdout_logfile_maxbytes=1MB -stdout_logfile_backups=5 -autorestart=true -stopsignal=TERM -user=webadm -directory=/home/webadm/statup/ diff --git a/cookbooks/statup/install.rb b/cookbooks/statup/install.rb deleted file mode 100644 index bd6378f..0000000 --- a/cookbooks/statup/install.rb +++ /dev/null @@ -1,22 +0,0 @@ -URL = 'https://assets.statup.io/install.sh' -TMP = '/tmp/install.sh' - -# Download install script -execute "wget #{URL} -O #{TMP}" do - user 'root' - - not_if 'test -e /usr/local/bin/statup' -end - -file TMP do - mode '755' - - not_if 'test -e /usr/local/bin/statup' -end - -# Execute install script: -execute TMP do - user 'root' - - not_if 'test -e /usr/local/bin/statup' -end diff --git a/cookbooks/statup/setup.rb b/cookbooks/statup/setup.rb deleted file mode 100644 index 8bc8ed2..0000000 --- a/cookbooks/statup/setup.rb +++ /dev/null @@ -1,80 +0,0 @@ -# Make directory: -directory '/home/webadm/statup' do - owner 'webadm' - group 'webadm' - mode '755' -end - -# Deploy the configuration: -execute 'mc cp minio/backup/statup/config.yml /tmp/config.yml' do - user 'kazu634' - - not_if "test -e #{node['statup']['config']}" -end - -file '/tmp/config.yml' do - owner 'webadm' - group 'webadm' - mode '664' - - not_if "test -e #{node['statup']['config']}" -end - -execute "mv /tmp/config.yml #{node['statup']['config']}" do - user 'webadm' - - not_if "test -e #{node['statup']['config']}" -end - -# Deploy the configuration DB: -execute 'mc cp minio/backup/statup/statup.db /tmp/statup.db' do - user 'kazu634' - - not_if "test -e #{node['statup']['db']}" -end - -file '/tmp/statup.db' do - owner 'webadm' - group 'webadm' - mode '664' - - not_if "test -e #{node['statup']['db']}" -end - -execute "mv /tmp/statup.db #{node['statup']['db']}" do - user 'webadm' - - not_if "test -e #{node['statup']['db']}" -end - -# Deploy the supervisord configuration file: -remote_file '/etc/supervisor/conf.d/statup.conf' do - user 'root' - group 'root' - mode '644' -end - -# Apply the changes -execute 'Reload supervisor' do - user 'root' - - command '/usr/bin/supervisorctl update' -end - -# Firewall Setting: -%w( 8080/tcp ).each do |port| - execute "ufw allow #{port}" do - user 'root' - - not_if "LANG=c ufw status | grep #{port}" - - notifies :run, 'execute[ufw reload-or-enable]' - end -end - -execute 'ufw reload-or-enable' do - user 'root' - command 'LANG=C ufw reload | grep skipping && ufw --force enable || exit 0' - - action :nothing -end diff --git a/cookbooks/statup/ssl.rb b/cookbooks/statup/ssl.rb deleted file mode 100644 index 4f497a7..0000000 --- a/cookbooks/statup/ssl.rb +++ /dev/null @@ -1,23 +0,0 @@ -[ - 'rm -f /etc/nginx/sites-enabled/*', - 'ln -f -s /etc/nginx/sites-available/maintenance /etc/nginx/sites-enabled/maintenance', - 'systemctl reload nginx', - "test -e /etc/letsencrypt/live/#{node['statup']['FQDN']}/cert.pem || certbot certonly --webroot -d #{node['statup']['FQDN']} --webroot-path /usr/share/nginx/html/ --email simoom634@yahoo.co.jp --agree-tos -n", - '/home/webadm/bin/nginx-config.sh', -].each do |cmd| - execute cmd -end - -remote_file "/etc/letsencrypt/live/#{node['statup']['FQDN']}/dhparams_4096.pem" do - owner 'root' - group 'root' - mode '644' -end - -execute "openssl rand 48 > /etc/letsencrypt/live/#{node['statup']['FQDN']}/ticket.key" - -remote_file '/etc/cron.d/statup' do - user 'root' - group 'root' - mode '644' -end