Page 1 of 1

Trying to understand the SW architecture

PostPosted: Wed Sep 27, 2017 7:39 am
by Christopher
I'm installing the webapp on a Phidget SBC3 (running Debian) and have some questions about each piece. Am I correct in that gunicorn is the actual web server? Does nginx just provide reverse proxy and SSL?

If that's the case, and if the webapp is password protected, then I don't need nginx because the box is behind another SSL/reverse proxy from a gatekeeper server running Apache.

I got nginx running, but I don't think gunicorn is...

The requirements install get to Babel-2.5.1, downloads, then is "killed". Any idea why?


EDIT:
The gunicorn service doesn't start properly.
Code: Select all
service gunicorn start
reports OK and starting alarmdecoder, but the process must be terminating. The log file is empty.

I did change the gunicorn user/group to root/root

Re: Trying to understand the SW architecture

PostPosted: Wed Sep 27, 2017 9:00 am
by kevin
Christopher wrote:I'm installing the webapp on a Phidget SBC3 (running Debian) and have some questions about each piece. Am I correct in that gunicorn is the actual web server? Does nginx just provide reverse proxy and SSL?

If that's the case, and if the webapp is password protected, then I don't need nginx because the box is behind another SSL/reverse proxy from a gatekeeper server running Apache.

I got nginx running, but I don't think gunicorn is...

The requirements install get to Babel-2.5.1, downloads, then is "killed". Any idea why?


EDIT:
The gunicorn service doesn't start properly.
Code: Select all
service gunicorn start
reports OK and starting alarmdecoder, but the process must be terminating. The log file is empty.

I did change the gunicorn user/group to root/root


Ok, so yes, nginx is just an ssl gateway/reverse proxy

If the requirements aren't being installed correctly, I would investigate why. It is using pip to do it all via the requirements.txt - so you can individually install each one and see why it is failing.

There are 3 potential log locations for the gunicorn stuff

webapp logs: /opt/alarmdecoder-webapp/instance/logs/*
daemon log: /var/log/daemon.log
syslog: /var/log/syslog
gunicorn logs: /var/log/gurnicorn.d/*

Re: Trying to understand the SW architecture

PostPosted: Thu Sep 28, 2017 9:23 am
by Christopher
It fails because gevent isn't installed.

It fails to install - invalid command 'bdist_wheel'
Code: Select all
Collecting gevent
  Using cached gevent-1.2.2.tar.gz
Collecting greenlet>=0.4.10 (from gevent)
  Using cached greenlet-0.4.12.tar.gz
Building wheels for collected packages: gevent, greenlet
  Running setup.py bdist_wheel for gevent ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hmTz2M/gevent/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpSIUlSWpip-wheel- --python-tag cp27:
  /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'cffi_modules'
    warnings.warn(msg)
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

Thoughts?

Re: Trying to understand the SW architecture

PostPosted: Thu Sep 28, 2017 9:35 am
by kevin
Please make sure you have updated your pip, updated your setup tools, and have the wheel package installed

pip install pip --upgrade
pip install setuptools --upgrade
pip install wheel

It's not failing because gevent isn't installed, it's failing to even install gevent.

Re: Trying to understand the SW architecture

PostPosted: Fri Sep 29, 2017 4:45 pm
by TD22057
I installed the webapp on an Ubuntu box without using nginx (it's just me using it). Here's my notes from the install -maybe they'll help you out. I started by getting ser2sock installed, working, and running as a service. Test that w/ the basic python ad2usb module to make sure it can interact with the panel. Then I cloned the webapp repo, then created a virtualenv to store all the software that the app needs w/o changing my system. To start it I got some help from the forum and created the run.sh script below.

Code: Select all
git clone to /opt/alarmdecoder-webapp

cd /opt/alarmdecoder-webapp
virtualenv pyenv
. pyenv/bin/activate
pip install alarmdecoder
pip install gunicorn
pip install -r requirements.txt

make file run.sh
----
#!/bin/sh

cd /opt/alarmdecoder-webapp
. pyenv/bin/activate

gunicorn --name alarmdecoder \
    --worker-class=socketio.sgunicorn.GeventSocketIOWorker \
    --env=POLICY_SERVER=0 \
    --workers=1 \
    --log-file /var/log/alarmdecoder.log \
    --timeout=120 \
    wsgi:application
----


Run this script by hand and make sure it works. Check the logs, etc if there is a problem. When it's working, change the whole directory to be owned by ad2usb and create an init/upstart/systemd (whatever your system is using) file to execute run.sh as the ad2usb user.

Code: Select all
sudo useradd -r -s /bin/false ad2usb
sudo adduser ad2usb dialout
sudo chown -R ad2usb:dialout /opt/alarmdecoder-webapp