#!/bin/bash # # See https://github.com/helpyio/helpy/wiki/Installing-Helpy-on-Ubuntu-16.04-using-Passenger-and-Nginx # https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rvm-on-debian-8 # https://www.phusionpassenger.com/library/deploy/standalone/reverse_proxy.html # Parameters SHARE="$1" # Include basic functions . $SHARE/trashman/functions || exit 1 . $SHARE/trashman/debian || exit 1 # System setup #sudo apt-get update #sudo apt-get dist-upgrade trashman_apt_install dirmngr trashman_apt_install git-core imagemagick postgresql postgresql-contrib libpq-dev \ curl build-essential zlib1g-dev libssl-dev libreadline-dev \ libyaml-dev libsqlite3-dev sqlite3 libcurl4-openssl-dev \ libxml2-dev libxslt1-dev software-properties-common nodejs \ nginx-extras passenger # Database setup su postgres -c "createuser -s rails" su postgres -c "createdb helpy_production" echo "Please set a passphrase for the rails@postgres user, then type \q..." echo -n "\\password rails\n" | sudo su postgres -c psql # User setup adduser rails gpasswd -a rails sudo # Download RVM #\curl -sSL https://get.rvm.io -o rvm.sh cp $SHARE/hoarder/rvm/unix/install /home/rails/rvm.sh # Userland setup sudo -u rails bash <<"EOF" cd gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB # RVM cat rvm.sh | bash -s stable --rails source /home/rails/.rvm/scripts/rvm # Other ruby dependencies rvm install 2.3.3 rvm requirements rvm alias create default ruby-2.3.3 rvm gemset create helpy rvm 2.3.3@helpy gem install rails --no-ri --no-rdoc -v 4.2.10 gem install bundler # Helpy setup git clone https://github.com/helpyio/helpy.git cd helpy bundle install cp config/database.do.yml config/database.yml rake secret # Logs mkdir -p /home/rails/helpy/log touch /home/rails/helpy/log/production.log chmod 0664 /home/rails/helpy/log/production.log EOF # Final steps # Secret and db credentials setup echo "Basic installation complete" echo "Now you should do:" echo "" echo " - Secrets and db setup" echo " - Configure the webserver" #RAILS_ENV=production rake assets:precompile #RAILS_ENV=production rake db:setup #rails s -e production -b your.ip.add.ress -p 3000