Giter Club home page Giter Club logo

Comments (15)

swanson avatar swanson commented on August 28, 2024

We should add these - however, I am running on Heroku so it would be ideal if someone that has setup on VPS would type on the steps.

from stringer.

bolandrm avatar bolandrm commented on August 28, 2024

What type of documentation are you looking for? Setting up a VPS from scratch takes a ton of steps, and it's probably out of scope for any Stringer documentation. Perhaps the docs could provide links that show how to setup a VPS (in general), and then explain Stringer installation after that?

from stringer.

swanson avatar swanson commented on August 28, 2024

@bolandrm Yeah, I think it is safe to assume that a VPS has been setup. We should link to the pre-reqs that need to be installed (Ruby, Postgres, Git) and then provide instructions to get the app running from there.

from stringer.

brahmadpk avatar brahmadpk commented on August 28, 2024

@swanson Yes, you are correct. There is good amount of documentation on setting up a RoR server on VPS. That can be safely left out. Just pre-reqs, installation steps and if any code modification/addition that needs to be done for installing it.

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

These are the steps I took to get it running on my Ubuntu VPS, it's running sqlite at the moment rather than postgresql

Install some dependencies:

sudo apt-get install git libxml2-dev libxslt-dev libcurl4-openssl-dev libpq-dev libsqlite3-dev build-essential nodejs

Create a user for stringer:

adduser stringer
su stringer

Install Ruby:

cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
source ~/.bash_profile

rbenv install 1.9.3-p0
rbenv local 1.9.3-p0
rbenv rehash

gem install bundler
rbenv rehash

Clone stringer from github:

git clone https://github.com/swanson/stringer.git
cd stringer

Set up Stringer:

bundle install
rbenv rehash

Set up the DB:

bundle exec rake db:migrate

Run the application:

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 stringer.

s3nk4s avatar s3nk4s commented on August 28, 2024

great instructions mick
I had a bit of an issue running 'bundle install' at the curb stage:

solution was to install libcurl-dev (i think)

i ran the following:

sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

I might not have put all the needed dependencies in the apt-get line, I should really wipe my VPS and run the commands from scratch.

from stringer.

cnu avatar cnu commented on August 28, 2024

bundle install doesn't work for me.

vagrant@precise64:/vagrant$ bundle install
Gemfile syntax error:
/vagrant/Gemfile:6: syntax error, unexpected ':', expecting $end
gem "sinatra-contrib", github: "sinatra/sinatra-contrib"
                              ^

My bundle version is 1.3.5.

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

Probably a version of ruby installed by your package manager is superceding the version we selected with rbenv for the string user, in the short term if you don't need ruby for anything else uninstall it with the package manager.

The solution must lie in doing something clever with the path variable to ensure this doesn't happen, I'll do some googling about it later this evening.

from stringer.

cnu avatar cnu commented on August 28, 2024

I destroyed the old vagrant box and did a fresh install and your steps worked fine. Just need to apt-get install build-essential for make.

from stringer.

swanson avatar swanson commented on August 28, 2024

I think the only thing missing is to get the app using postgres (as per #64) then the instructions are good to go.

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

The instructions are distro agnostic apart from the apt-get line, so would be useful if people would submit an equivalent line for all the various distributions likely to be offered as a VPS. Fedora, Suse, Centos, FreeBSD etc.

Also I'll look into writing an init script for it.

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

This is how you get it working with postgres

Install Postgres

apt-get install postgresql

Set up the database:

sudo -u postgres createuser -D -A -P stringer
sudo -u postgres createdb -O stringer stringer_live

Edit config file database.yml with the setting fro the database you just created:

su stringer
nano ~/stringer/config/database.yml

Add the following text to the file, and change the password to the one you created when setting up the stringer user for postgres

production:
  adapter:  postgresql
  database: stringer_live
  username: stringer
  password: <edit this>
  host: localhost

Switch over from sqlite to postgres

rake db:migrate RACK_ENV=production

from stringer.

mickstephenson avatar mickstephenson commented on August 28, 2024

Updated instructions:

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 stringer.

swanson avatar swanson commented on August 28, 2024

Added instructions to the repo here. Thanks @mickstephenson @cnu @s3nk4s

from stringer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.