From 463da9f5f6b3f1a990e36a23d307b64a8140d89c Mon Sep 17 00:00:00 2001 From: Michael Stephenson Date: Fri, 31 May 2013 15:07:41 +0100 Subject: [PATCH 1/4] Added instructions for setting up stringer on a VPS --- VPS.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 VPS.md diff --git a/VPS.md b/VPS.md new file mode 100644 index 000000000..b7846aa5f --- /dev/null +++ b/VPS.md @@ -0,0 +1,92 @@ +Install some dependencies +========================= + +The first step is installing some essential dependencies from your VPS's package manager. + +#### Ubuntu/Debian + + sudo apt-get install git libxml2-dev libxslt-dev libcurl4-openssl-dev libpq-dev libsqlite3-dev build-essential nodejs postgresql screen + +#### CentOS/Fedora + + sudo yum install git libxml2-devel libxslt-devel libcurl4-devel libpq-devel libsqlite3-devel nodejs make automake gcc gcc-c++ postgresql screen + +Set up the database +=================== + +Create a postgresql user to own the database stringer will use, you will need to create a password too, make a note of it. + + sudo -u postgres createuser -D -A -P stringer + +Now create the database Stringer will use + + sudo -u postgres createdb -O stringer stringer_live + +Create your stringer user +========================= + +We will run stringer as it's own user for security, also as we'll be installing a specific version of ruby to be used for the stringer user alone in the stringer user's home directory, this saves us worrying whether the version of ruby and some dependencies provided by your distro are compatible with Stringer. + + adduser stringer --shell /bin/bash + su stringer + +Install Ruby for your stringer user +=================================== + +We are going to use Rbenv to manage the version of Ruby you use. + + cd + git clone git://github.com/sstephenson/rbenv.git .rbenv + echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bash_profile + echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile + git clone git://github.com/sstephenson/ruby-build.git $HOME/.rbenv/plugins/ruby-build + source ~/.bash_profile + + rbenv install 1.9.3-p0 + rbenv local 1.9.3-p0 + rbenv rehash + +We also need to install bundle which will handle Stringer's dependencies + + gem install bundler + rbenv rehash + +Install Stringer and set it up +============================== + +Grab Stringer from github + + git clone https://github.com/swanson/stringer.git + cd stringer + +Use bundle to grab and build Stringer's dependencies + + bundle install + rbenv rehash + +Stringer uses environment variables to determine information about your database, edit these values to reflect your database and the password you chose earlier + + echo export STRINGER_DATABASE="stringer_live" >> $HOME/.bash_profile + echo export STRINGER_DATABASE_USERNAME="stringer" >> $HOME/.bash_profile + echo export STRINGER_DATABASE_PASSWORD="EDIT_ME" >> $HOME/.bash_profile + source ~/.bash_profile + +Tell stringer to run the database in production mode, using the postgres database you created earlier. + + cd $HOME/stringer + rake db:migrate RACK_ENV=production + +Run the application: + + screen -d "bundle exec foreman start" + +Set up a cron job to parse the rss feeds. + + crontab -e + +add the lines + + SHELL=/bin/bash + PATH=/home/stringer/.rbenv/bin:/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin + */10 * * * * source $HOME/.bash_profile; cd $HOME/stringer/; bundle exec rake fetch_feeds; + From d356152974e385f600ca4df5a71918db22cf25f9 Mon Sep 17 00:00:00 2001 From: Michael Stephenson Date: Fri, 31 May 2013 16:13:39 +0100 Subject: [PATCH 2/4] Removed node.js dependency --- VPS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VPS.md b/VPS.md index b7846aa5f..4f90bb069 100644 --- a/VPS.md +++ b/VPS.md @@ -5,11 +5,11 @@ The first step is installing some essential dependencies from your VPS's package #### Ubuntu/Debian - sudo apt-get install git libxml2-dev libxslt-dev libcurl4-openssl-dev libpq-dev libsqlite3-dev build-essential nodejs postgresql screen + sudo apt-get install git libxml2-dev libxslt-dev libcurl4-openssl-dev libpq-dev libsqlite3-dev build-essential postgresql screen #### CentOS/Fedora - sudo yum install git libxml2-devel libxslt-devel libcurl4-devel libpq-devel libsqlite3-devel nodejs make automake gcc gcc-c++ postgresql screen + sudo yum install git libxml2-devel libxslt-devel libcurl4-devel libpq-devel libsqlite3-devel make automake gcc gcc-c++ postgresql screen Set up the database =================== From 48275c36c1c50d066d562aab70d14fe1ffb63c82 Mon Sep 17 00:00:00 2001 From: Michael Stephenson Date: Fri, 31 May 2013 16:35:24 +0100 Subject: [PATCH 3/4] Fixed some unintelligible rambling in VPS.md --- VPS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VPS.md b/VPS.md index 4f90bb069..3ad142c1d 100644 --- a/VPS.md +++ b/VPS.md @@ -14,7 +14,7 @@ The first step is installing some essential dependencies from your VPS's package Set up the database =================== -Create a postgresql user to own the database stringer will use, you will need to create a password too, make a note of it. +Create a postgresql user to own the database Stringer will use, you will need to create a password too, make a note of it. sudo -u postgres createuser -D -A -P stringer @@ -25,7 +25,7 @@ Now create the database Stringer will use Create your stringer user ========================= -We will run stringer as it's own user for security, also as we'll be installing a specific version of ruby to be used for the stringer user alone in the stringer user's home directory, this saves us worrying whether the version of ruby and some dependencies provided by your distro are compatible with Stringer. +We will run stringer as it's own user for security, also we will be installing a specific version of ruby to stringer user's home directory, this saves us worrying whether the version of ruby and some dependencies provided by your distro are compatible with Stringer. adduser stringer --shell /bin/bash su stringer From 07bc85b038760c8d1134e3df70b34d659b9697bf Mon Sep 17 00:00:00 2001 From: Michael Stephenson Date: Fri, 31 May 2013 18:50:20 +0100 Subject: [PATCH 4/4] Fixed a few typos in VPS.md --- VPS.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/VPS.md b/VPS.md index 3ad142c1d..e336697ab 100644 --- a/VPS.md +++ b/VPS.md @@ -46,7 +46,7 @@ We are going to use Rbenv to manage the version of Ruby you use. rbenv local 1.9.3-p0 rbenv rehash -We also need to install bundle which will handle Stringer's dependencies +We also need to install bundler which will handle Stringer's dependencies gem install bundler rbenv rehash @@ -59,16 +59,16 @@ Grab Stringer from github git clone https://github.com/swanson/stringer.git cd stringer -Use bundle to grab and build Stringer's dependencies +Use bundler to grab and build Stringer's dependencies bundle install rbenv rehash Stringer uses environment variables to determine information about your database, edit these values to reflect your database and the password you chose earlier - echo export STRINGER_DATABASE="stringer_live" >> $HOME/.bash_profile - echo export STRINGER_DATABASE_USERNAME="stringer" >> $HOME/.bash_profile - echo export STRINGER_DATABASE_PASSWORD="EDIT_ME" >> $HOME/.bash_profile + echo 'export STRINGER_DATABASE="stringer_live"' >> $HOME/.bash_profile + echo 'export STRINGER_DATABASE_USERNAME="stringer"' >> $HOME/.bash_profile + echo 'export STRINGER_DATABASE_PASSWORD="EDIT_ME"' >> $HOME/.bash_profile source ~/.bash_profile Tell stringer to run the database in production mode, using the postgres database you created earlier.