From ce17a1c107fe00f8e0ae0b743a31acf03849b20e Mon Sep 17 00:00:00 2001 From: mike wakerly Date: Sun, 9 Feb 2014 17:58:15 -0800 Subject: [PATCH] Install and run pycore automatically. Part of issue #3. --- src/install.sh | 15 +++++++++++++-- system-files/kegbot-supervisor.conf | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/install.sh b/src/install.sh index ba163b5..fa3a7d5 100644 --- a/src/install.sh +++ b/src/install.sh @@ -7,9 +7,11 @@ set -x ### Configuration section -REQUIRED_PACKAGES="nginx-light libjpeg-dev supervisor python-setuptools python-dev libsqlite3-dev libmysqlclient-dev mysql-server memcached" +REQUIRED_PACKAGES="nginx-light libjpeg-dev supervisor python-setuptools python-dev libsqlite3-dev libmysqlclient-dev mysql-server memcached redis-server" KEGBERRY_DIR="/etc/kegberry" + KEGBOT_PIP_NAME="https://nodeload.github.com/Kegbot/kegbot/zip/master" +PYCORE_PIP_NAME="https://nodeload.github.com/Kegbot/kegbot-pycore/zip/master" NGINX_CONF_URL="https://raw.github.com/Kegbot/kegberry/master/system-files/kegbot-nginx.conf" SUPERVISOR_CONF_URL="https://raw.github.com/Kegbot/kegberry/master/system-files/kegbot-supervisor.conf" @@ -43,12 +45,21 @@ install_kegberry() { sudo easy_install-2.7 pip info "Installing Kegbot Server ..." - sudo pip install ${KEGBOT_PIP_NAME} + sudo pip install -U ${KEGBOT_PIP_NAME} + + info "Installing Kegbot Pycore ..." + sudo pip install -U ${PYCORE_PIP_NAME} info "Configuring Kegbot Server ..." mysqladmin -u root create kegbot || true setup-kegbot.py --db_type=mysql --interactive=false + info "Generating API key ..." + api_key=$(kegbot create_api_key "Kegberry") + mkdir -p /home/pi/.kegbot/ + echo "--api_url=http://localhost/api/" > /home/pi/.kegbot/pycore-flags.txt + echo "--api_key=${api_key}" >> /home/pi/.kegbot/pycore-flags.txt + info "Installing configs ..." sudo bash -c "curl -o /etc/nginx/sites-available/default ${NGINX_CONF_URL}" sudo bash -c "curl -o /etc/supervisor/conf.d/kegbot.conf ${SUPERVISOR_CONF_URL}" diff --git a/system-files/kegbot-supervisor.conf b/system-files/kegbot-supervisor.conf index 16c1a6c..9264b07 100644 --- a/system-files/kegbot-supervisor.conf +++ b/system-files/kegbot-supervisor.conf @@ -1,7 +1,7 @@ ### Supervisor.conf for Kegbot -- Kegberry edition. [group:kegbot] -programs=gunicorn,celery +programs=gunicorn,celery,kegbot_core,kegboard_daemon [program:gunicorn] command=su -l pi -c '/usr/local/bin/kegbot run_gunicorn --settings=pykeg.settings -w 1' @@ -16,3 +16,17 @@ directory=/home/pi autostart=true autorestart=true redirect_stderr=true + +[program:kegbot_core] +command=su -l pi -c '/usr/local/bin/kegbot_core.py --flagfile=/home/pi/.kegbot/pycore-flags.txt' +directory=/home/pi +autostart=true +autorestart=true +redirect_stderr=true + +[program:kegboard_daemon] +command=su -l pi -c '/usr/local/bin/kegboard_daemon.py' +directory=/home/pi +autostart=true +autorestart=true +redirect_stderr=true