Skip to content

Instantly share code, notes, and snippets.

@jeremiaheb
Last active October 4, 2015 05:27
Show Gist options
  • Save jeremiaheb/2585100 to your computer and use it in GitHub Desktop.
Save jeremiaheb/2585100 to your computer and use it in GitHub Desktop.
Setup script for production server
# This document specifies the steps needed to take a default ubuntu install with a main user called 'support' and
# prepare it to make a new default server.
#
# 1. Install latest ruby build from source requirements
#
# $ sudo apt-get update
# $ sudo apt-get install -y build-essential apache2-prefork-dev zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev vim aptitude screen apache2 postgresql git openssh-server wkhtmltopdf libffi libffi-dev nodejs
#
# 1.5 Configure database
#
# $ sudo su postgres
# $ psql template1
# template1=# create role [rolename] with createdb login password '[password]';
# CREATE ROLE
#
#
# 2. Install ruby from source
#
# $ wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
$ tar xzvf yaml-0.1.5.tar.gz
$ cd yaml-0.1.5
$ ./configure --prefix=/usr/
$ make
$ sudo make install
#
# $ sudo wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.gz
# $ tar -xvf ruby-2.2.1.tar.gz
# $ cd ruby-2.2.1
# $ ./configure --prefix=/usr --enable-shared
# $ make
# $ sudo make install
#
# 3. Install bundler, passenger
#
# $ sudo gem install rails
#
# $ sudo gem install bundler passenger
# $ sudo passenger-install-apache2-module
#
#
#
#
# 4. Configure Apache and virtual hosts
#
# Add
LoadModule passenger_module /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.12
Passenger Ruby /usr/bin/ruby
PassengerPoolIdleTime 0
#
# to /etc/apache/apache2.conf
#
# Create a virtual host file for your rails application in /etc/apache2/sites-available/EntryApplication.conf
<VirtualHost *:80>
ServerName www.sefsc.noaa.gov
DocumentRoot /var/www/apps/EntryApplication/current/public
<Directory /var/www/apps/EntryApplication/current/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
#
# Enable the virtual host and reload apache:
#
# $ a2ensite EntryApplication
# $ /etc/init.d/apache2 reload
#
#
# Set up directory:
#
# $ sudo mkdir -p /var/www/apps/EntryApplication
#
# Set www-data to be group owner of all amware files
# $ sudo chgrp -R www-data /var/www/apps/EntryApplication
# $ sudo chmod g+w /var/www/apps/EntryApplication
# $ sudo chown jeremiaheb -R /var/www/apps/EntryApplication
# $ sudo usermod -a -G www-data jeremiaheb
#
#
# Add a deploy file in config/deploy.rb for this server.
# Therefore, create a file called deploy.rb, in the development machine then run:
#
# $ cap deploy:setup
# $ cap deploy:cold
# Setup wkhtmltopdf
#
# Download static build and put it in /usr/bin
# Set up database backup script
# https://gist.github.com/58adf982d989e91b66f3
# Set up .pgpass
# Set up crontab for support user
# */15 * * * * /home/support/pg_db_dump.sh && rsync -avz /home/support/backups /media/BACKUP\ Volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment