lib/meroku/infrastructure/node.rb in meroku-2.0.7 vs lib/meroku/infrastructure/node.rb in meroku-2.0.8

- old
+ new

@@ -54,39 +54,48 @@ def install_packages @tunnel.run "sudo apt-add-repository ppa:brightbox/ruby-ng\;" @tunnel.run "curl -s -o /tmp/modified-cedar-14.sh https://raw.githubusercontent.com/oystersauce8/meroku/master/modified-cedar-14.sh" @tunnel.run "sudo chmod 755 /tmp/modified-cedar-14.sh" @tunnel.run "/bin/bash -lc 'sudo /tmp/modified-cedar-14.sh'" - #@tunnel.run "sudo apt-get update\;" @tunnel.run "sudo apt-get install -y ruby2.4 ruby2.4-dev" @tunnel.run "sudo apt-get install -y nginx libsqlite3-dev nodejs" self end def tweak_configuration - @tunnel.run 'sudo adduser --disabled-password --gecos "" git' - @tunnel.run 'sudo -u git mkdir /home/git/.ssh/' - @tunnel.run 'sudo -u git touch /home/git/.ssh/authorized_keys' + #@tunnel.run 'sudo adduser --disabled-password --shell /usr/bin/git-shell --gecos "" git' + #@tunnel.run 'sudo -u git mkdir /home/git/.ssh/' + #@tunnel.run 'sudo -u git touch /home/git/.ssh/authorized_keys' + @tunnel.run 'sudo mkdir /sharedro && sudo chmod 777 /sharedro' end def install_frontend_app @tunnel.run 'mkdir /home/ubuntu/.meroku' @tunnel.run "cd ~\; git clone https://github.com/oystersauce8/meroku\;" - @tunnel.run "sudo cp ~/meroku/frontend/etc_nginx_sites-available_default /etc/nginx/sites-available/default" + @tunnel.run "sudo rm -f /etc/nginx/sites-enabled/*" + @tunnel.run "sudo cp ~/meroku/frontend/etc_nginx_sites-enabled_default /etc/nginx/sites-enabled/default" + @tunnel.run 'sudo cp /home/ubuntu/meroku/frontend/etc_nginx_sites-enabled_template /sharedro' + @tunnel.run 'sudo chmod a+r /sharedro/etc_nginx_sites-enabled_template' @tunnel.run "curl -o /home/ubuntu/.meroku/letsencrypt_fullchain.pem http://www.sam-we.com/dropbox/meroku-#{ENV['SECRET']}/letsencrypt_fullchain.pem" @tunnel.run "curl -o /home/ubuntu/.meroku/letsencrypt_privkey.pem http://www.sam-we.com/dropbox/meroku-#{ENV['SECRET']}/letsencrypt_privkey.pem" - @tunnel.run "cd ~/.meroku/\; curl -O http://www.sam-we.com/dropbox/meroku-#{ENV['SECRET']}/ssh_host_keys.tgz" - #@tunnel.run "cd ~/.meroku/\; sudo tar xf ssh_host_keys.tgz -C /etc/ssh/ --overwrite" + + @tunnel.run "cd ~/meroku/frontend/\; sudo gem install bundler\; bundle\;" @tunnel.run "(cd ~/meroku/frontend && RAILS_ENV=production bundle exec rails assets:precompile)" @tunnel.run "(cd ~/meroku/frontend && RAILS_ENV=production bundle exec rake db:migrate)" - @tunnel.run "cd ~/meroku/frontend/\; bundle exec puma -d" + @tunnel.run "cd ~/meroku/frontend/\; bundle exec puma -d -b unix:///tmp/meroku.sock" @tunnel.run "sudo service nginx restart" - @tunnel.run "sudo service ssh restart" + @tunnel.run %Q[sudo sh -c 'echo "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIPWJQU+TkDu9uyVzHQcVnKklRhQvIBdXHkA/7zAQG8XuoAoGCCqGSM49\nAwEHoUQDQgAEI1lm18nECH4jH+6p80jhn8WgZRDOC1ufVVtoPUnUgEvslfV3xzWl\nDXZKof765EiCOYyt2TZ7pKClMexhHWhMtA==\n-----END EC PRIVATE KEY-----" > /etc/ssh/ssh_host_ecdsa_key'] + @tunnel.run %Q[sudo sh -c 'echo "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCNZZtfJxAh+Ix/uqfNI4Z/FoGUQzgtbn1VbaD1J1IBL7JX1d8c1pQ12SqH++uRIgjmMrdk2e6SgpTHsYR1oTLQ= root@ip-172-31-64-77" > /etc/ssh/ssh_host_ecdsa_key.pub'] + #@tunnel.run "cd ~/.meroku/\; curl -O http://www.sam-we.com/dropbox/meroku-#{ENV['SECRET']}/ssh_host_keys.tgz" + #@tunnel.run "cd ~/.meroku/\; sudo tar xf ssh_host_keys.tgz -C /etc/ssh/ --overwrite && sudo service ssh restart" + self + rescue + byebug end end end end