Skip to content

Commit

Permalink
Install and run pycore automatically.
Browse files Browse the repository at this point in the history
Part of issue #3.
  • Loading branch information
mik3y committed Feb 10, 2014
1 parent 7846a5d commit ce17a1c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}"
Expand Down
16 changes: 15 additions & 1 deletion system-files/kegbot-supervisor.conf
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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

0 comments on commit ce17a1c

Please sign in to comment.