Permalink
Browse files

+ added env_creation script (50%)

% modified dependencies_veirify (75%)
  • Loading branch information...
1 parent 40bc42c commit 1f96e89cd2fe5de5a02d1234c046d990647149fd Lele committed Apr 26, 2011
Showing with 54 additions and 18 deletions.
  1. +32 −18 dependencies_verify.sh
  2. +22 −0 env_creation.sh
View
50 dependencies_verify.sh
@@ -1,24 +1,27 @@
#!/bin/bash
# simple script to verify if youw system already has the needed binary for express
+# define your system dependencies here
+declare -a sys_dependencies
+sys_dependencies=("node" "npm" "curl")
+# define your npm dependencies here
+declare -a npm_modules_dependencies
+npm_modules_dependencies=("pool" "express" "request" "npm-wrapper" "daemon" "forever" "cradle")
# color used for printing
-use_color=true;
+use_color=true
if ($use_color) ;
then
- BLDWHI=$(tput bold ; tput setaf 3)
+ BLDYEL=$(tput bold ; tput setaf 3)
BLDVIO=$(tput bold ; tput setaf 5)
BLDCYA=$(tput bold ; tput setaf 6)
BLDRED=$(tput bold ; tput setaf 1)
BLDGRN=$(tput bold ; tput setaf 2)
NOCOLR=$(tput sgr0)
fi
-declare -a deps_not_ok
-deps_not_ok=()
# checking system dependencies
-declare -a sys_dependencies
-# define your system dependencies here
-sys_dependencies=("node" "npm" "curl" "foobar" "foo" "bar")
+declare -a sys_deps_not_ok
+sys_deps_not_ok=()
for sys_dep in ${sys_dependencies[@]}
do
type -P $sys_dep &>/dev/null \
@@ -42,13 +45,12 @@ do
printf '%s%*s%s' "$DEP_KO" $COL_KO "[${BLDRED}${KO_MSG}${NOCOLR}]" >&2;
echo ;
new_len=$(( ${#deps_not_ok[@]} + 1 ))
- deps_not_ok[$new_len]=$sys_dep
+ sys_deps_not_ok[$new_len]=$sys_dep
}
done
# checking npm dependencies
-declare -a npm_modules_dependencies
-# define your npm dependencies here
-npm_modules_dependencies=("express" "jade" "node" "npm" "curl")
+declare -a npm_deps_not_ok
+npm_deps_not_ok=()
for npm_mod in ${npm_modules_dependencies[@]}
do
installed=$(npm -dg ls 2>&1 | grep -E '[├│└]' | grep " $npm_mod\\@" | wc -l)
@@ -73,13 +75,25 @@ do
printf '%s%*s%s' "$DEP_KO" $COL_KO "[${BLDRED}${KO_MSG}${NOCOLR}]" >&2;
echo ;
new_len=$(( ${#deps_not_ok[@]} + 1 ))
- deps_not_ok[$new_len]=$npm_mod
+ npm_deps_not_ok[$new_len]=$npm_mod
}
done
# printing missing dependencies
-echo -n "Components ${BLDWHI}not found${NOCOLR}: ";
-for i in "${deps_not_ok[@]}"
-do
- echo -n "$i "
-done
-echo ;
+if [ "${#sys_deps_not_ok[@]}" -gt "0" ] ;
+then
+ echo -n "System Components ${BLDYEL}not found${NOCOLR}: "
+ for i in "${sys_deps_not_ok[@]}"
+ do
+ echo -n "$i "
+ done
+ echo
+fi
+if [ "${#npm_deps_not_ok[@]}" -gt "0" ] ;
+then
+ echo -n "NPM Components ${BLDYEL}not found${NOCOLR}: "
+ for i in "${npm_deps_not_ok[@]}"
+ do
+ echo -n "$i "
+ done
+ echo
+fi
View
22 env_creation.sh
@@ -0,0 +1,22 @@
+# CHOOSE THE HOME_DIR FOR THE NODESTER USER
+NODESTER_HOME_DIR="/var/nodester"
+NODESTER_USER="nodester"
+NODESTER_USER_PASS="YourUb3rSecretPassword!"
+NODESTER_GROUP="nodester"
+
+groupadd $NODESTER_GROUP
+useradd -d $NODESTER_HOME_DIR -c "nodester user" -g $NODESTER_GROUP -m -r -N -s /bin/bash $NODESTER_USER
+(sleep 1s; echo $NODESTER_USER_PASS ; sleep 1s ; echo $NODESTER_USER_PASS) | passwd $NODESTER_USER
+
+mkdir -p $HOME_DIR/.ssh
+# PASTE YOUR SSH KEY IN THE VAR HERE BELOW
+YOUR_PUB_KEY=""
+echo $YOUR_PUB_KEY > $HOME_DIR/.ssh/authorized_keys
+chmod -R 700 $HOME_DIR/.ssh
+
+# ENABLING SUDO FOR THE NODESTER USER
+echo "# nodester related rules
+nodester ALL = NOPASSWD: /var/nodester/nodester/proxy/start_proxy.sh *
+nodester ALL = NOPASSWD: /var/nodester/nodester/proxy/stop.sh
+nodester ALL = NOPASSWD: /var/nodester/nodester/scripts/launch_app.sh *
+" >> /etc/sudoers

0 comments on commit 1f96e89

Please sign in to comment.