Skip to content

Commit

Permalink
Add virtualenv for running PiPot (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
VertexC authored and canihavesomecoffee committed Mar 16, 2019
1 parent 1864705 commit a6944da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
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

0 comments on commit a6944da

Please sign in to comment.