Skip to content

Server Installation: Guided Walkthrough

huxoll edited this page Nov 6, 2014 · 20 revisions

This page provides a guided installation for setting up StackStudio and dependencies on a server.

Installation on Ubuntu

apt-get update
apt-get install git
cd /usr/local/
git clone https://github.com/TranscendComputing/CloudMux.git
# CloudMux requires ruby 1.9.x; if you have ruby 1.8 installed, 
# you may wish to use RVM (http://rvm.io) instead.
apt-get install ruby1.9.1-dev
apt-get install build-essential
apt-get install mongodb
apt-get install libxslt-dev libxml2-dev
cat > /usr/local/etc/cloudmux.env
STACK_PLACE_SERVICE_ENDPOINT=http://localhost:9292
MONGO_URI=mongodb://MONGOUSER:MONGOPASSWORD@localhost:27017
RACK_ENV=development
RAILS_ENV=development
export RACK_ENV MONGO_URI
^D
cd /usr/local/CloudMux/
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
gem install bundler
bundle install --without development test --deployment
bundle exec rake db:seed

cd /usr/local
git clone https://github.com/TranscendComputing/StackStudio.git

# Add repo to get latest node.js.
apt-get install python-software-properties python g++ make
add-apt-repository ppa:chris-lea/node.js
apt-get update

apt-get install nodejs
cd StackStudio
npm install
npm install -g grunt-cli

cp /usr/local/StackStudio/backend.json.sample \
/usr/local/StackStudio/backend.json
sed -i "s|@backend_endpoint@|http://${HOSTNAME}:9292|g" \
/usr/local/StackStudio/backend.json

# Add web server
apt-get install libssl-dev 
gem install puma 
cd
git clone https://github.com/puma/puma.git
cp puma/tools/jungle/upstart/puma* /etc/init 
# replace "apps" in /etc/init/puma.conf with intended user
echo "/usr/local/CloudMux" >> /etc/puma.conf
cp /usr/local/etc/cloudmux.env /etc/profile.d/cloudmux.sh 
# Replace /etc/init/puma.conf line:
exec bundle exec puma -C config/puma/production.rb
# with the following:
exec puma config.ru

# Install nginx
apt-get install nginx
# Edit default port to be 9001, root to be /usr/local/StackStudio
vi /etc/nginx/sites-available/default
update-rc.d nginx enable  

Installation on OS X

# before starting go to directory you will be working from
# this will help later on when you use bundler to modify 
# the ruby directories you will install here
cd <yourworkingdirectory>

# Get Ruby. CloudMux requires ruby 1.9.x. Current one we are using 
# is 1.9.3
# (Note: Version 2.1.1 was not working with CloudMux dependencies)
# ruby should already be part of OS X but will likely need to use 
# your own sandbox ruby because you will need to modify directories

# if you don’t already have rvm, to install
\curl -L https://get.rvm.io | bash -s stable
# this should automatically prompt to kickoff an install of XCode
# source rvm
source ~/.rvm/scripts/rvm

#now install ruby version you want. For example to install 
# version 1.9.3
rvm install 1.9.3
rvm use 1.9.3

#you will need git
#you might want to use macports or homebrew to install

#to install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew doctor

#install git
brew install git

#install mongodb
brew install mongodb

# Note: this is not necessary if registering (and controlling) 
# mongodb as a service via launchctl
# because the default plist file that comes with the brew install 
# of mongodb points to a default
# mongo config file that includes the dpath configuration among others.
#
#If executing mongodb directly from command line,
#you must perform the following prior to starting mongo for the first time.
#Instructions: 
#http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
#or 
#If you want to set the db write directory to your working directory
cd <yourworkingdirectory> #if not already there
sudo mkdir data/db

#get CloudMux
git clone https://github.com/TranscendComputing/CloudMux.git

#modify cloudmux env file
cat > cloudmux.env
STACK_PLACE_SERVICE_ENDPOINT=http://localhost:9292
MONGO_URI=mongodb://MONGOUSER:MONGOPASSWORD@localhost:27017
RACK_ENV=development
RAILS_ENV=development
export RACK_ENV MONGO_URI
#^D to escape

#for some reason environment not taking from cloudmux.env so 
# add to ~/.bash_profile
cat cloudmux.env >> ~/.bash_profile
source ~/.bash_profile

cd CloudMux
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
gem install bundler
bundle install
#depending on what version of ruby you installed, this might 
# throw error due to version 1.6.5 version of debugger not working 
# with certain versions of ruby. To fix, try installing debugger 
#without specifying a version gem install debugger and try 
#bundle install again 
#now you can seed
#Make sure Mongodb is running first
sudo mongod —dbpath <whicheverPathYouPutdata/dbDirectory>
bundle exec rake db:seed

#Sinatra config file may be missing or incomplete and could 
#cause a NoMethodError
#NoMethodError - undefined method `mciaas' for PackedImagesApiApp:Class:
#Resolution:
sed 's|endpoint|http://localhost:9292|' app/config/settings.yaml.sample \
> app/config/settings.yaml
restart CloudMux (CTRL-C, bundle exec rackup -p 9292)

cd yourworkingdirectory
git clone https://github.com/TranscendComputing/StackStudio.git

#install node.js
brew install node

cd StackStudio

#install packages
npm install
npm install -g grunt-cli

cp backend.json.sample backend.json

#modify backend.json
#replace @backend_enpoint@ with “http://insertyourhostnamehere:9292” 
# if on mac then hostname probably just localhost. 
# Make sure you have quotes.

#to run
#Make sure Mongodb is running first
#to run CloudMux
bundle exec rackup -p 9292

#to run StackStudio:
grunt run

#Problems you might encounter when running Stack Studio:
#Fatal error: EMFILE: Too many opened files.
#Temporary fix is to increase file limit with ulimit -n 2048. 
#This will only be active in current shell you are #running StackStudio in
Clone this wiki locally