Our Location
304 North Cardinal St.
Dorchester Center, MA 02124
I’ve been working hard on a project lately called Debrew that adds a web interface to a CNC controller. I decided to go for Lighttpd as the web server, Web.py as the Python framework, and sqlite3 as the data base engine. Here is how I did it.
I’m going to write up the whole project in a different post, but I just wanted to post the instructions for getting a basic web interface going on BeagleBone Black. This post assumes using Angstrom (or similar OpenEmbedded flavour, I guess) as the distro. In the following instructions, I’m assuming starting from the Thing image. This image is very minimal, so it lacks stuff like Git.. The most important difference from a Debian based distro is perhaps the package handling system. The instructions are specific for Debrew, so just exchange your project for this.
Prerequities:
opkg install git opkg install python-compile opkg install wget opkg install python-setuptools
Instructions for installing the software:
opkg install lighttpd opkg install sqlite3 opkg install lighttpd-module-fastcgi opkg install lighttpd-module-rewrite opkg install lighttpd-module-alias opkg install python-sqlite3
Install Web.py
cd /usr/src/ git clone git://github.com/webpy/webpy.git cd webpy python setup.py install
transfer python software
make debrew.py executable:
chmod +x /www/pages/debrew/debrew.py
Edit the lighttpd config file to enable serving Python files:
nano /etc/lighttpd.conf enable mod_alias, mod_fastcgi, mod_rewrite by commenting out the # opn that line.
Add this to the end of the file:
fastcgi.server = ( ".py" => (( "socket" => "/tmp/fastcgi.socket", "bin-path" => "/www/pages/debrew/debrew.py", "max-procs" => 1, "bin-environment" => ( "REAL_SCRIPT_NAME" => "" ), "check-local" => "disable" )) ) url.rewrite-once = ( "^/favicon.ico$" => "/static/favicon.ico", "^/static/(.*)$" => "/static/$1", "^/(.*)$" => "/debrew/debrew.py/$1", )
The lighttpd systemd file is broken, so make sure it looks like this:
nano /lib/systemd/system/lighttpd.service
Should look like this:
[Unit] Description=Lightning Fast Webserver With Light System Requirements After=syslog.target [Service] EnvironmentFile=-/etc/sysconfig/lighttpd ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd.conf [Install] WantedBy=multi-user.target
Install Flup:
cd /usr/src wget --no-check-certificate https://pypi.python.org/packages/source/f/flup/flup-1.0.tar.gz#md5=530801fe835fd9a680457e443eb95578 tar -vxf flup-1.0.tar.gz cd flup-1.0/ python setup.py install
Restart lighttpd:
systemctl restart lighttpd
If there are problems during the development, make sure you check both /www/logs/lighttpd.error.log and syslog (journalctl).
Update: With the new Thing-image, this is already pre-installed.
Will it run on BeagleBone?
Yes
Is this related to what looked like a delta-bot coffee pourover setup you tweeted a photo of a while back? I’ve thought about making an automatic pourover setup that somehow emulates a person pouring the water, but using a cnc deltabot setup didn’t even cross my mind. Looks awesome!
Yes! Let me just finish the BBB flasher image for it and I will upload all files to a repo. OSHW FTW 😉
Hello, Where can I find “debrew.py”? Thanks!
Hi! Look in the repo, bu don’t trust the build instruvmctions until tomorrow:) https://bitbucket.org/intelligentagent/debrew
Can you provide any metrics related to the performance of SQLite on BBB?
That should not be specific to BBB, i think.