sirius on heroku
I've been playing around with sirius today and got it running properly locally so I decided to push it to heroku. All dependencies seem to be working ok, I'm able to reach the launch page, sign in, but I can't seem to see reach my printer as it seems to be offline. My guess is that it has something to do with me not configuring the bridge correctly. I adjusted my bridge server url to "http://myappname.herokuapp.com", do I need to assign a specific port? I was also wondering if I had to change anything to the config.py. From what I understand my current version is working with the development config, but as there's also a heroku config in there, I guess I should switch over to that? I tried earlier, but the app didn't seem to start then.
Thanks for your time and for keeping this alive.
The reason Heroku doesn't work is that the Bridge needs to connect to a fixed IP address. Heroku doesn't allocate fixed IPs, so the next best thing is Dokku (Heroku clone) on Digital Ocean (which does provide a fixed IP).
We ended up with a raspberry pi running a local instance of the app.
Some issues/things that could be useful when setting everything up:
- install Phantomjs. For a raspberry pi use this: https://github.com/piksel/phantomjs-raspberrypi/
- Phantomjs allows the app to take a screenshot of the rendered html you insert in the message field to readout that image to a bytearray and send it over to the printer.
- WARNING: then apt-get version of Phantomjs is not compatible (too old), so do not rely on it and install the version I mentioned above.
- if you're a python noob like me, learn how to use virtualenv.
- for the raspberry pi I had to change one of the package versions in requirements.txt. gevent 1.0.1 didn't work anymore (SSLv3 error), switching to 1.0.2 solved the issue.
- when your virtualenv is set up and activated, install all dependencies by running:
pip install -r requirements.txt - initiate the database by running:
python manage.py db upgrade - Don't forget you need to point your bridge to the correct ip:port
That should be it.
gunicorn -b 0.0.0.0:5000 -k flask_sockets.worker manage:app and go!
@bskrt that is super awesome :)
@bskrt I got all hyped up when I read your story about running the app on a Raspberry Pi and I tried to install the app on my Raspberry Pi B with Raspbian Jessie. The app running on http://alpha.littleprinter.com is very unstable and most of the time I get an "Internal Server Error".
So I followed your guide and installed all the dependencies, Phantomjs etc, but when I want to start the app with gunicorn -b 0.0.0.0:5000 -k flask_sockets.worker manage:app I get the following error:
[2015-10-20 13:43:41 +0000] [10445] [INFO] Starting gunicorn 19.1.1
[2015-10-20 13:43:41 +0000] [10445] [INFO] Listening at: http://0.0.0.0:5002 (10445)
[2015-10-20 13:43:41 +0000] [10445] [INFO] Using worker: flask_sockets.worker
[2015-10-20 13:43:41 +0000] [10450] [INFO] Booting worker with pid: 10450
Importing environment from .env...
--------------------------------------------------------------------------------
DEBUG in webapp [/home/pi/sirius/sirius/web/webapp.py:65]:
Creating app.
--------------------------------------------------------------------------------
DEBUG:sirius.web.webapp:Creating app.
SystemError: NULL result without error in PyObject_Call
<callback at 0xb59a8cd0 stopped> failed with SystemError
Then it tries to start again and again and again always ending with this error.
Do you or @genmon have any idea what could have raised this error? Or can you share your RPi image with me?
Thanks!
Hi Peter,
I can't say I have any idea what's causing this. I suppose you're referring to the correct port number?
gunicorn -b 0.0.0.0:5000 -k flask_sockets.worker manage:app
port 5000 obviously depends to where you pointed your bridge. In our case it's actually 5002.
There's no point in me giving you our RPi image as I fully stripped down the original app to suit our needs (no twitter login, custom printing page, ...).
Best of luck!
@bskrt I'd like to spin up a RPi to print directly to the printer, bypassing Twitter and the internet altogether. Is this what you've done? Would you mind sharing your image? If so: santheo@gmail. Thanks.
@santheo That is pretty much what I did. Printing obviously still runs through the browser, but everything is running locally. I'm planning on cleaning the entire thing up, so I can put an image online, but that's probably something for the coming holidays. I'll put it up here when it's done.
@bskrt This is also exactly what I am looking for! Would be nice if you could share!
Hey, I'd be also really grateful for such an image. Have a rasPi idling here and browser based solution fit perfect for my needs :)
Cheers, rad0 a.k.a. the future tester :)
----- Original Message -----
From: "bskrt" [email protected] To: "genmon/sirius" [email protected] Sent: Thursday, 3 December, 2015 11:37:08 AM Subject: Re: [sirius] sirius on heroku (#10)
@santheo That is pretty much what I did. Printing obviously still runs through the browser, but everything is running locally. I'm planning on cleaning the entire thing up, so I can put an image online, but that's probably something for the coming holidays. I'll put it up here when it's done.
— Reply to this email directly or view it on GitHub .
Connection closed by remote ghost.
Thanks @bskrt. If the clean-up is not for security reasons, I'd love to just try what you have now. I'm trying to get the thing working for a video project that starts tomorrow. I thought I had the printer working, since it worked fine with alpha.littleprinter.com a few days ago, but now that's throwing errors and I'm SOL. Any help you can offer would be huge. Thanks!
-Sandy [email protected]
Another one waiting for the image! Thanks!!
@bskrt Thanks for all the information. I'd love to see the image you have for the Raspberry Pi too.
@felippenardi @chepeme @santheo @awk0324 @ptitb Together with @bskrt and using @hako 's excellent guide as input, I made LittlePrinterPi, a pre-made image or install script to get Sirius up and running on your Raspberry Pi. I tried to include a full installation guide in the wiki.
Let us know if this helps!
Nice, though this is kinda what the Dokku route achieves. I guess it doesn't have the Docker memory issue though!
@anneris Thank you so much, man!!
@anneris This is great news, now trying to get it up and running! Thanks!
Yes, I got it working on a Raspberry Pi B!
I found that after running the install script I had to manually run ./manage.py db upgrade before it was working.
Thank you so much!
Strange, because the install script is supposed to do that for you. Did you get some kind of error message before you manually upgraded the database? (if so, let us know here)