From cc1307f9cd54b17eea8e97e670324318a4182823 Mon Sep 17 00:00:00 2001 From: bobcall Date: Sun, 29 Jan 2012 05:59:53 -0500 Subject: [PATCH] Changed setup.sh to include whole process and start will start the server from home --- README.md | 28 +++++++++++++----------- setup.sh | 4 ---- start | 65 ++++++++++++++++++------------------------------------- 3 files changed, 36 insertions(+), 61 deletions(-) mode change 100644 => 100755 start diff --git a/README.md b/README.md index 8c2a355..4e47208 100644 --- a/README.md +++ b/README.md @@ -17,21 +17,24 @@ helping college students collaborate, learn, and share their knowledge freely on Requirements: -- A typical Linux server (circa 2011) -- Node.js (Version 0.4.10 or later) [More ...](http://nodejs.org) -- MongoDB (Version 1.8.2 or later) [More ...](http://mongodb.org) +- Debian/ubuntu-server GNU/Linux Box with a modern kernel (2.6.39 <) +- 1 GB (idealy) 512MB min. +- Node.js (Version 0.6.1 or later) [More ...](http://nodejs.org) +- MongoDB (Version 2.0.2 or later) [More ...](http://mongodb.org) - forever - $ pwd - /home/you - $ install git - $ install node - $ git clone git@github.com:/finalsclubdev/FinalsClub fc - $ cd fc - $ git submodule init - $ git submodule update +Deployment: + +1. Copy setup.sh to home directory. + +2. REVIEW setup.sh BEFORE RUNNING!!!! + +3. run: sudo setup.sh + +4. mongorestore any back-up databases that you may have. + +5. Copy "start" to home directory and run. - [[ flesh this out with correct commands - reference util scripts - fix util scripts ]] # System components @@ -45,7 +48,6 @@ The system consists of these main parts: Most of the system is written in Javascript and executed by the Node.js runtime. - # Source Code diff --git a/setup.sh b/setup.sh index 2685684..c3a0062 100755 --- a/setup.sh +++ b/setup.sh @@ -54,10 +54,6 @@ cd ~/ export PATH="/usr/local/bin:$PATH" -cd ~ -rm -rf bc -git clone git://github.com/finalsclubdev/bc.git -cd ~/bc npm install connect npm install socket.io npm install express-messages diff --git a/start b/start old mode 100644 new mode 100755 index b0cafa3..b6d0b6a --- a/start +++ b/start @@ -1,52 +1,29 @@ #!/bin/bash -# TODO update this with the contents of new.sh -exit # This breaks the script before it does anything else - -export PATH="/usr/local/bin:$PATH" - -cd ~ -rm -rf bc -git clone git://github.com/finalsclubdev/bc.git -cd ~/bc -npm install connect -npm install socket.io -npm install express-messages -npm install jade - -cd ~ -rm -rf FinalsClub -git clone git://github.com/finalsclubdev/FinalsClub.git -ln -sf FinalsClub fc - -cd ~/fc -git checkout master -git submodule init && git submodule update -npm install -cd etherpad-lite -npm install - -# install some dependencies -cd ~/fc -npm install connect -npm install socket.io -npm install express-messages -npm install jade - - -## init fcbackup -cd ~/fc/fcbackups -chmod 775 fcbackup_init.sh -./fcbackup_init.sh - - -## start the server -cd ~/fc -./restart - +# Start Script for running app.js and Etherpad-lite +# Kill all node instances +killall node +# Set Env. Vars. +export NODE_PATH=/home/risci_atom/fc/etherpad-lite/node_modules:$NODE_MODULES +export MONGO_HOST_URI=mongodb://localhost/fc +export MONGO_HOST=localhost +export SERVER_HOST=www.finalsclub.org +export SERVER_PORT=80 +export NODE_ENV=production +ps waux | grep node | grep -v grep +echo "starting ..." +cd fc/etherpad-lite/node +forever server.js &> log.txt & +cd ../../ +if [ "$(id -u)" != "0" ]; then + ## note: start as root, pass env vars to sudo param, this app will downgrade itself onc$ + sudo -E forever app.js &> log.txt & +else + forever app.js &> log.txt & +fi -- 2.25.1