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
1 change: 1 addition & 0 deletions bin/pipotd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function usage() {

export PYTHONPATH="${PYTHONPATH}:${DIR}/../"
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 Down
14 changes: 13 additions & 1 deletion install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,26 @@ 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 [[ "$OSTYPE" == "linux-gnu" ]]; then
apt-get -q -y install build-essential libffi-dev libssl-dev >> "$install_log" 2>&1
fi
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 "
pip install --upgrade 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