May 20132013
This is a rough log of setting up a new Debian 7 server.
Staging server ip 184.106.215.248
www.howtoforge.com/how-to-upgrade-debian-squeeze-to-wheezy
*add user deploy to sudo group and use it instead of root for here on*
adduser deploy adduser deploy sudo
*update system, you might want to do-release-upgrade here*
sudo apt-get update sudo apt-get upgrade
*set correct time*
sudo dpkg-reconfigure tzdata sudo apt-get install ntpdate vim htop sudo ntpdate pool.ntp.org
apache
sudo apt-get install apache2 apache2-prefork-dev autoconf bison build-essential curl git-core imagemagick mysql-client mysql-common mysql-server openssl php5 libcurl4-openssl-dev
*install a default ruby*
apt-get install ruby ruby-dev
rvm
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) sudo adduser deploy rvm source /etc/profile.d/rvm.sh
*logout and back in for rvm*
*need to downgrade rubygems due to a problem encountered*
cd to app path rvmsudo rvm install rubygems 1.8.25
TODO:
*setup apache sites*
sudo a2dissite default
*install apache mods*
sudo a2enmod expires sudo a2enmod headers sudo a2enmod proxy sudo a2enmod ssl sudo a2enmod rewrite sudo apt-get install libapache2-mod-xsendfile sudo apt-get install libapache2-mod-php5 sudo apt-get install libapache2-mod-proxy-html sudo service apache2 restart
*install passenger*
sudo gem install passenger rvmsudo passenger-install-apache2-module make sure to do this from the rvm running the pulse
*other ubuntu packages required for building gems*
sudo apt-get install libxslt-dev
*pulse gems*
see README
*pat gems*
see README
*setup apache site*
sudo scp deploy@emu.powertochange.com:/etc/apache2/sites-available/emu.powertochange.com /etc/apache2/sites-available/ sudo a2ensite pulse.powertochange.com sudo a2dissite default Had to remove RailsAutoDetect, replace it with PassengerEnabled, set PassengerRuby to the rvm ruby path Had to use /usr/local/rvm/wrappers/ree-1.8.7-2012.02@pulse/ruby as the ruby path
*setup mocksmtps on dev server*
sudo scp -r deploy@emu.powertochange.com:/var/www/mocksmtpd . gem sources -a http://gems.github.com gem install koseki-mocksmtpd
*copy /etc/screen.d over*
cd /etc sudo scp -r deploy@emu.powertochange.com:/etc/screen.d . sudo scp -r deploy@192.168.242.176:/etc/screen.d .
screen
sudo apt-get install screen
*htmldoc is used by the pat to generate pdf from html*
sudo apt-get install htmldoc
crontab
SHELL=/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/opt/ruby/bin:/usr/sbin
# m h dom mon dow command 00 6 * * * cd /var/www/pulse.powertochange.com/current && RAILS_ENV=production /opt/ruby/bin/rake pulse:deliver_emails_working 00 * * * * cd /var/www/pat.powertochange.org/current && RAILS_ENV=production /opt/ruby/bin/rake tmp:cache:clear 15 5 * * * cd /var/www/pat.powertochange.org/current && RAILS_ENV=production /opt/ruby/bin/rake db:sessions:clear 30 5 * * * cd /var/www/pulse.powertochange.com/current && RAILS_ENV=production /opt/ruby/bin/rake db:sessions:clear 20 * * * * ruby /etc/screen.d/dj_pulse.rb * * * * * cd /var/www/pulse.powertochange.com/current && RAILS_ENV=production flock -n tmp/connect.lock rake connect:import_contacts
uuid
sudo apt-get install uuid-runtime
*important note about profile pictures*
When changing the name of the pulse app, make sure that the profile pictures directory in /var/www/<app>/shared/<name>.profile_pictures works and points to the current profile picture directory. I've been aliasing /shared/<ALL NAMES>.profile_pictures to the current profile pictures directory. Make sure the deploy.rb file is setting up aliases from the public profile pic directories to shared. -AR
*copy over profile_pictures before going live*