Module: Escualo::Bootstrap
- Defined in:
- lib/escualo/bootstrap.rb
Class Method Summary collapse
- .enable_swap(ssh) ⇒ Object
- .install_base(ssh, options) ⇒ Object
- .install_gems(ssh, options) ⇒ Object
- .install_ruby(ssh, options) ⇒ Object
- .setup_monit(ssh, options) ⇒ Object
Class Method Details
.enable_swap(ssh) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/escualo/bootstrap.rb', line 42 def self.enable_swap(ssh) ssh.exec! %q{ \ test -e /swapfile || fallocate -l 4G /swapfile && \ chmod 600 /swapfile && \ mkswap /swapfile && \ swapon /swapfile && \ swapon -s && \ echo '/swapfile none swap sw 0 0' >> /etc/fstab} end |
.install_base(ssh, options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/escualo/bootstrap.rb', line 3 def self.install_base(ssh, ) ssh.shell.perform! %q{ apt-get purge libruby* -y && apt-get install -y \ autoconf \ bison \ build-essential \ libreadline6 \ libreadline6-dev \ curl \ git \ monit \ libssl-dev \ zlib1g \ zlib1g-dev \ libreadline-dev }, end |
.install_gems(ssh, options) ⇒ Object
69 70 71 |
# File 'lib/escualo/bootstrap.rb', line 69 def self.install_gems(ssh, ) ssh.shell.perform! 'gem install bundler && gem install escualo', end |
.install_ruby(ssh, options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/escualo/bootstrap.rb', line 22 def self.install_ruby(ssh, ) if .with_rbenv ssh.shell.perform! %q{ curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash && echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc && echo 'eval "$(rbenv init -)"' >> ~/.bashrc }, ssh.shell.perform! 'rbenv install 2.3.1 && rbenv global 2.3.1 && rbenv rehash', else ssh.shell.perform! %q{ apt-get install software-properties-common -y && apt-add-repository ppa:brightbox/ruby-ng && apt-get update && apt-get install -y \ ruby2.3 \ ruby2.3-dev }, end end |
.setup_monit(ssh, options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/escualo/bootstrap.rb', line 53 def self.setup_monit(ssh, ) ssh.perform! %Q{ service monit stop cd /tmp && wget https://mmonit.com/monit/dist/binary/5.16/monit-#{options.monit_version}-linux-x64.tar.gz && tar -xzf monit-#{options.monit_version}-linux-x64.tar.gz && cp monit-#{options.monit_version}/bin/monit /usr/bin/monit ln -s /etc/monit/monitrc /etc/monitrc service monit start echo 'set httpd port 2812 and' > /etc/monit/conf.d/web-server echo ' allow 0.0.0.0/0.0.0.0' >> /etc/monit/conf.d/web-server echo ' allow admin:#{options.monit_password}' >> /etc/monit/conf.d/web-server monit reload }, end |