Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup virtualenv for server. Fix PiPot/PiPot#7 #11

Merged
merged 9 commits into from
Mar 16, 2019
3 changes: 2 additions & 1 deletion bin/pipotd
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function usage() {
}

if [ "${cmd}" == "--start" ]; then
source /usr/src/pipot/pipot-env/bin/activate
twistd -y "${DIR}/pipot.tac" --pidfile "${PIDFILE}" --syslog --prefix=pipotd
python "${DIR}/bootstrap_gunicorn.py" "${DIR}/../" "${PIDFILE2}"
elif [ "${cmd}" == "--stop" ]; then
Expand All @@ -24,4 +25,4 @@ elif [ "${cmd}" == "--stop" ]; then
else
usage
exit 1
fi
fi
12 changes: 11 additions & 1 deletion install/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ echo ""
echo "* Updating package list "
apt-get update >> "$install_log" 2>&1
echo "* Installing nginx, python & pip "
apt-get -q -y install dnsutils nginx python python-dev python-pip >> "$install_log" 2>&1
apt-get -q -y install virtualenv dnsutils nginx python python-dev python-pip >> "$install_log" 2>&1
if [ ! -f /etc/init.d/mysql* ]; then
echo "* Installing MySQL (root password will be empty!)"
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server >> "$install_log" 2>&1
fi
virtualenv_name="/usr/src/pipot/pipot-env"
# Check if virtulenv has been created
if [ ! -d $virtualenv_name ]; then
echo "* Create virtualenv $virtualenv_name"
virtualenv $virtualenv_name
else
echo "* Use virtualenv $virtualenv_name"
fi
source $virtualenv_name/bin/activate

echo "* Update setuptools "
easy_install -U setuptools >> "$install_log" 2>&1
echo "* Installing pip dependencies"
Expand Down
3 changes: 2 additions & 1 deletion install/pipot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ case "${1}" in
start)
echo "Starting PiPot daemon..."
cd /usr/src/pipot/server
source /usr/src/pipot/pipot-env/bin/activate
bin/pipotd --start
;;
stop)
Expand All @@ -18,4 +19,4 @@ case "${1}" in
;;
esac

exit 0
exit 0