Tested working on:
- Raspberry Pi 1 Model B+ (Using Docker hypriot/rpi-python) (debian/wheezy)
- Raspberry Pi 2 Model B (with virtualenv)
- Ubuntu Linux x64 (with virtualenv)
- Ubuntu Linux x64 (Using Docker)
- OS X Yosemite (with virtualenv)
Not tested on:
- Raspberry Pi 1 Model B (with virtualenv or Docker)
- Raspberry Pi 3 Model B (with virtualenv or Docker)
- Windows 10 (with Linux Subsystem)
- Windows (with VirtualBox)
- OS X El Capitan
This guide is regularly updated and tested with 0 dead page links. (excluding localhost links)
You have three options:
Once the server is up and running, Skip to Step 5 to connect the server to the printer.
Using a Raspberry Pi? If you would like to install sirius quickly on your Pi, @anneris has put together a prebuilt Raspberry Pi image and other sirius installation options.
- Pre-built Raspberry Pi Image (~296.1 MB)
- Install Script
- Other options
If you are familiar with Docker, I have built a sirius Docker image:
hakobyte/sirius (~296.1 MB)
Run docker run -t -p 5000:5000 hakobyte/sirius /usr/bin/honcho start
to use that image and skip to Step 5.
If you prefer to go down the manual route, continue to follow the guide below.
postgresql
foreman/honcho
phantomjs
libfreetype6-dev
fontconfig
libgstreamer0.10-dev
python-dev
On Linux/Raspberry Pi, run [sudo] apt-get update
before installing the prequisites.
This guide assumes you have either python
, pip
or ruby
installed.
This guide also assumes that wget
and git
are installed.
--
Linux:
[sudo] apt-get install libpq-dev
OS X:
brew install postgresql
--
Foreman and Honcho manage Procfile-based applications and sirius is one of them. You can install either foreman
or honcho
. It doesn't matter which one you install, both do the same thing.
foreman (Ruby)
[sudo] gem install foreman
If you want to install honcho instead, you can consider installing it before or after installing virtualenv & virtualenvwrapper in Step 1.
honcho (Python)
[sudo] pip install honcho
--
[sudo] apt-get install libfreetype6-dev fontconfig libgstreamer0.10-dev python-dev
This guide uses phantomjs 1.9.8
OS X (With brew):
brew install phantomjs
All platforms (x86-x64): ariya/phantomjs/downloads
Raspberry Pi & other ARM boards: (From piksel/phantomjs-raspberrypi)
You can use these scripts for your platform below:
Linux (x64)
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
&& tar jxf phantomjs-1.9.8-linux-x86_64.tar.bz2 \
&& sudo mv phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
Linux (x86)
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-i686.tar.bz2 \
&& tar jxf phantomjs-1.9.8-linux-i686.tar.bz2 \
&& sudo mv phantomjs-1.9.8-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
Raspberry Pi (ARM)
wget -O phantomjs https://git.io/vzA6L \
&& chmod +x phantomjs \
&& sudo mv phantomjs /usr/local/bin/phantomjs
--
Install virtualenv & virtualenvwrapper. (Optional)
[sudo] pip install virtualenv virtualenvwrapper
export WORKON_HOME=~/Envs
echo "export WORKON_HOME=~/Envs" >> ~/.bashrc
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv lpenv
workon lpenv
If you use a different shell eg. zsh
, change line 3 from ~/.bashrc
to ~/.zshrc
Download the sirius source code.
git clone https://github.com/genmon/sirius.git
cd sirius
Install python requirements.
Linux:
[sudo] pip install -r requirements.txt
Mac:
// gevent fails to build
[sudo] CFLAGS='-std=c99' pip install -r requirements.txt
(Note: If you get SSLv3 errors like NameError: name 'PROTOCOL_SSLv3' is not defined
, upgrade gevent
)
[sudo] pip install gevent==1.0.2
Migrate the database.
./manage.py db upgrade
and start the server.
foreman (Ruby)
foreman start
Or
honcho (Python)
honcho start
What you should see:
web.1 | [2016-01-19 06:17:55 +0000] [42169] [INFO] Starting gunicorn 19.1.1
web.1 | [2016-01-19 06:17:55 +0000] [42169] [INFO] Listening at: http://0.0.0.0:5000 (42169)
web.1 | [2016-01-19 06:17:55 +0000] [42169] [INFO] Using worker: flask_sockets.worker
web.1 | [2016-01-19 06:17:55 +0000] [42172] [INFO] Booting worker with pid: 42172
web.1 | --------------------------------------------------------------------------------
web.1 | DEBUG in webapp [<path>]:
web.1 | Creating app.
web.1 | --------------------------------------------------------------------------------
web.1 | DEBUG:sirius.web.webapp:Creating app.
Step 5 requires that your bridge is updated to connect to custom little printer servers. Connect your bridge and navigate to this URL.
http://<bridge ip>:81/configure
To find your BERG Cloud bridge IP address type inside the terminal:
arp -a | grep "40:d8:55"
This command should find your BERG Cloud bridge Mac address and IP on the LAN.
You should see a dialog box requesting a username and password.
username: berg
password: hereandthere
Change Server URL to point to your sirius server you perfomed foreman start
on.
Getting the IP address
Mac: Go to (System Prefrences -> Network) and you should see Status. Copy the IP address.
Linux:
Run hostname -I
to get your IP address.
Copy & Paste the IP address into the Server URL with the port number as 5000
and hit submit.
Like so: http://<sirius ip>:5000/
Your bridge should restart.
Reset your Little Printer by using a paperclip and pushing the button inside the tiny hole in the Printer.
The Little Printer should be reset at this point and you can print out a claim code once the Printer's LED is white.
Navigate to http://<sirius ip>:5000/
and sign in into Twitter.
Once signed in hit claim Printer and enter your claim code.
If you've reached this point the claim code should have worked and now you're ready to use sirius.
Your twitter users you follow, can also now send messages to your printer!
If you want to send a message to your Little Printer, click "send message". Enter your message and hit "Print Now."
\o/ Happy Printing! \o/
Credits:
- Anner Tiete / @anneris for setting up a prebuilt image and install script of this tutorial.
- Mat Webb / @genmon for Little Printer, BERG Cloud and sirius!
Hi,
Just a quick note, went through this on a raspberry pi (so its behind my firewall, so need to look at getting messages from others onto it later) but this worked a treat! I think my issue from before was not having phantomjs installed correctly.
Thanks for doing this!
Mark