Solved - Pi 3 manual install webapp issues

General Discussion

Re: Pi 3 manual install webapp issues

Postby timlegge » Mon Apr 11, 2016 4:13 am

No joy I am afraid. I even recreated the database on the off chance that something was corrupt.

Is there a way to increase the gunicorn debugging?

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

Re: Pi 3 manual install webapp issues

Postby Scott » Mon Apr 11, 2016 9:37 am

This seems vaguely familiar, like I may have run into a similar issue while building up the image. Our internal docs differ a little bit from the instructions on github.

sudo pip install gunicorn --upgrade
sudo ln -s /usr/local/bin/gunicorn /usr/bin/gunicorn
echo "nginx hold" | sudo dpkg --set-selections
echo "gunicorn hold" | sudo dpkg --set-selections

Did you do an apt-get upgrade after installing gunicorn? It may have updated the package to a version that doesn't support websockets. I'd try a 'sudo pip install gunicorn --upgrade' and recreate the link just to be sure.

As for debugging, you can uncomment the two lines in /etc/gunicorn.d/alarmdecoder and restart gunicorn.
Scott
Expert Nut
Expert Nut
 
Posts: 118
Joined: Thu Dec 12, 2013 11:17 am

Re: Pi 3 manual install webapp issues

Postby kevin » Mon Apr 11, 2016 1:39 pm

We got our pi3 in the mail today, so we'll be looking at this and releasing a working image for pi3 soon.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Pi 3 manual install webapp issues

Postby timlegge » Mon Apr 11, 2016 2:09 pm

Thanks, I am restarting from scratch so I will see how it goes.

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

Re: Pi 3 manual install webapp issues

Postby timlegge » Mon Apr 11, 2016 4:25 pm

Going through the installation again and it is possible that I forgot to install the alarmdecoder python package

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

Re: Pi 3 manual install webapp issues

Postby kevin » Mon Apr 11, 2016 7:20 pm

That would do it, though the logs should have shown a failure to import...
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Pi 3 manual install webapp issues

Postby timlegge » Tue Apr 12, 2016 4:05 am

A clean install last night with the same results. It does not seem like I can get additional logs to see what error is occurring.

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

Re: Pi 3 manual install webapp issues

Postby kevin » Tue Apr 12, 2016 11:33 am

In the meantime, since you have ser2sock working you can use the AlarmDecoder Keypad Software on any PC/Mac/Linux computer to interface with the stream.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Pi 3 manual install webapp issues

Postby timlegge » Wed Apr 13, 2016 12:53 pm

Thanks. I realized only late last night that the key pad address was not enabled on my panel. After I enabled it the software keypad works and I can seND command via the keypad and via a telnet to Ser2sock.

I need to go back to see if that makes any difference to the Web app but I doubt it.

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

Re: Pi 3 manual install webapp issues

Postby timlegge » Wed Apr 13, 2016 4:41 pm

Hi

I found the issue by running gunicorn manually as follows:

sudo /usr/bin/python /usr/bin/gunicorn --pid /var/run/gunicorn/alarmdecoder.pid --name alarmdecoder --user pi --group dialout --log-file /var/log/gunicorn/alarmdecoder.log --worker-class=socketio.sgunicorn.GeventSocketIOWorker --timeout=120 --env=POLICY_SERVER=0 --workers=1 --log-level=debug --log-file=/tmp/alarmdecoder.log wsgi:application

This resulted in a error:

Code: Select all
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gevent/baseserver.py", line 25, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 124, in handle
    handler.handle()
  File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 443, in handle
    result = self.handle_one_request()
  File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 658, in handle_one_request
    self.handle_one_response()
  File "/usr/local/lib/python2.7/dist-packages/socketio/handler.py", line 122, in handle_one_response
    return self._do_handshake(handshake_tokens.groupdict())
  File "/usr/local/lib/python2.7/dist-packages/socketio/handler.py", line 64, in _do_handshake
    self.write_smart(data)
  File "/usr/local/lib/python2.7/dist-packages/socketio/handler.py", line 88, in write_smart
    self.write_plain_result(data)
  File "/usr/local/lib/python2.7/dist-packages/socketio/handler.py", line 78, in write_plain_result
    ("Content-Type", "text/plain"),
  File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 778, in start_response
    raise UnicodeError("The value must be a native string", header, value)
UnicodeError: ('The value must be a native string', 'Access-Control-Max-Age', 3600)
<Greenlet at 0x735fb440: _handle_and_close_when_done(<bound method SocketIOServer.handle of <SocketIOSe, <bound method SocketIOServer.do_close of <SocketIO, (<socket at 0x722ee710 fileno=[Errno 9] Bad file d)> failed with UnicodeError


A Google search revealed:

UnicodeError on Raspbian using Raspberry Pi B+ #815 - https://github.com/ajenti/ajenti/issues/815

Which caused me to do this:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo pip install -U gevent==1.1b4

sudo service gunicorn restart

Problem solved!!!

Tim
timlegge
Junior Nut
Junior Nut
 
Posts: 31
Joined: Sat Apr 09, 2016 5:33 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests

cron