Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2012 21:51
Show Gist options
  • Save anonymous/1839237 to your computer and use it in GitHub Desktop.
Save anonymous/1839237 to your computer and use it in GitHub Desktop.
installing diaspora vanilla / pistos @ debian stable w/postgres
#
# installing diaspora vanilla / pistos @ debian stable w/postgres
#
# please read the whole doc first before executing these
# steps. this is for people who know why a reserver proxy
# is a good idea. and how to setup one ;-)
#
# a little bit knowledge in rails/rvm/gem and how to operate
# your os-of-choice properly from commandline is preferable
#
#
# pre-install:
# https://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora
# https://github.com/diaspora/diaspora/wiki/Installing-on-Debian
# dont use this as bashscript ;-)
exit
# as r00t
aptitude update
aptitude install build-essential libxslt1.1 libxslt1-dev libxml2 libreadline5-dev curl libcurl4-openssl-dev
aptitude install git-core mysql-server libmysqlclient-dev libmysql-ruby libssl-dev libopenssl-ruby
aptitude install imagemagick libmagick9-dev libffi-ruby libffi-dev libsqlite3-dev libmysqlclient-dev libmysqld-dev sun-java6-jre
# install from squeeze - backports, cose i wanted pg 9.1
aptitude install nginx postgresql-9.1 postgresql-client-9.1 postgresql-server-dev-9.1
# when you encouter conflicts during installation:
#~ Accept this solution? [Y/n/q/?] n
#~ The following actions will resolve these dependencies:
#~
#~ Install the following packages:
#~ 1) postgresql-client-common [128~bpo60+1 (squeeze-backports)]
#~ 2) postgresql-common [128~bpo60+1 (squeeze-backports)]
#~
#~ Upgrade the following packages:
#~ 3) libpq5 [8.4.9-0squeeze1+b1 (now, stable) -> 9.1.2-4~bpo60+1 (squeeze-backports)]
#~
# redis-server, not tested
wget http://ftp.us.debian.org/debian/pool/main/r/redis/redis-server_2.2.12-1_amd64.deb -O redis-server.deb && sudo dpkg -i ./redis-server.deb
aptitude install ruby1.9.1-full rubygems1.9.1
# not needed -> rvm
#sudo gem install bundler
#sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/
#sudo chmod 755 /var/lib/gems/1.8/bin/bundle
#
# from here as user
#
# using rvm seems to be the not-so-heavy-way
# on debian, although i font like it,
# packagemanagement ftw
#
# i create ~/.railsrc, instead of appending rvm-stuff onto .bashrc
#
bash
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
echo "[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && source \"$HOME/.rvm/scripts/rvm\" # This loads RVM into a shell session." >> ~/.railsrc
source ~/.railsrc && rvm install ruby-1.9.2-p290 && rvm use ruby-1.9.2-p290@global
# used nginx as reverse-proxy, quite plain copypasta from
# https://github.com/diaspora/diaspora/wiki/Nginx-Configuration
# i made the nginx-working-user the same that runs
# the app for easy access of static files
# batteries will be included later
# preparing checkout of latest branch: diaspora-pistos-1.0.8
# i use 2 different directories:
# - git_root/diaspora.pistos -> keeping the git_sources and updating/branching as i like
# - app_root/diaspora.pistos -> storing the live_app_root separated for customizing
cd git_root
#checkout
git clone https://github.com/Pistos/diaspora.git diaspora.pistos
# diaspora-orig
# git clone https://github.com/diaspora/diaspora.git diaspora.orig
cd diaspora.pistos
git branch
# * master
# for the first installation take master-branch
cd ..
# initial rsync
rsync -avzh --exclude '.git*' --stats diaspora.pistos app_root/
cd app_root/diaspora.pistos
# only needed to be adjustet the first time
# edit and ajust variables, esp. database.yml
# see official diaspora-wiki
cp config/application.yml.example config/application.yml
cp config/script_server.yml.example config/script_server.yml
cp config/database.yml.example config/database.yml
# application.yml -> UNCOMMENT?
# enable_splunk_logging: false
# created own pg-user
# changed pg_hba.conf
# pg_restart
# changed values in database.yml accprding to user
# be sure to have rvm installed, see diaspora-wiki
source ~/.railsrc
rvm use ruby-1.9.2-p290@global
DB="postgres"
RAILS_ENV="production"
gem install bundler
gem install pg
#
# PROBLEM: when installing on postgres [ gem 'pg' ]
# in Gemfile is missing, must be installed afterwards
#
#
# edit Gemfile -> gem 'pg'
bundle install --without development test heroku
# check for pg
bundle show
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:migrate
# note: if
# PG::Error: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
# HINT: Use the same encoding as in the template database, or use template0 as template.
# : CREATE DATABASE "diatest" ENCODING = 'unicode'
# solution (only on a fresh pg-install with no data)
# [ postgres@srv :~] > pg_dropcluster --stop 9.1 main
# [ postgres@srv :~] > pg_createcluster --start -e UTF-8 9.1 main
# edit pg_hba.conf again
# build neccessary stuff in public/assets
# i think you need sun_java, BEWARE of OpenJDK
bundle exec jammit
#
# test if app would load
script/server # might take a while
[ctrl]-c - | stop server
#
# preparing for checkout of pisto-branchs
#
# delete db_migrate_scripts in app_root
rm db/migrate/*
cd git_root/diaspora.pistos
# checkout pistos-release
git checkout diaspora-pistos-1.0.8
git branch
# * diaspora-pistos-1.0.8
# master
# branch-rsync + copy of db-migrations
rsync -avzh --stats --exclude '.git*' diaspora.pistos/* app_root/diaspora.pistos/
# if something fails, start from here again
cd app_root/diaspora.pistos
# be sure to have rvm installed, see diaspora-wiki
source ~/.railsrc
rvm use ruby-1.9.2-p290@global
rm Gemfile.lock
# edit Gemfile -> gem 'pg'
bundle install --without development test heroku
#~ if something like
#~
#~ The bundle currently has linecache locked at 0.43.
#~ Try running `bundle update linecache`
bundle update && bundle install --without development test heroku
# build neccessary stuff in public/assets
# i think you need java
bundle exec jammit
RAILS_ENV=production bundle exec rake db:migrate
# start rails
script/server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment