Skip to content

Instantly share code, notes, and snippets.

@hako
Last active December 15, 2021 14:29
Show Gist options
  • Save hako/f8944cfa7b8fb8115f6d to your computer and use it in GitHub Desktop.
Save hako/f8944cfa7b8fb8115f6d to your computer and use it in GitHub Desktop.
Installing Sirius on Mac / Linux / Raspberry Pi

Installing Sirius on Mac / Linux / Raspberry Pi

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)

Quickstarts:

You have three options:

Once the server is up and running, Skip to Step 5 to connect the server to the printer.

Raspberry Pi Quickstart

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.

Docker Quickstart

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.

DIY Tutorial

Prequisites:

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.

--

Installing postgresql

Linux: [sudo] apt-get install libpq-dev

OS X: brew install postgresql

--

Installing foreman/honcho

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

--

Installing phantomjs

Dependencies (Linux):

[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)

phantomjs 1.9.8 (ARM binary)

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

--

Step 1

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

Step 2

Download the sirius source code.

git clone https://github.com/genmon/sirius.git
cd  sirius

Step 3

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

Step 4

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

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

Step 6

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.

Step 7

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.

Step 8

Navigate to http://<sirius ip>:5000/ and sign in into Twitter.

Once signed in hit claim Printer and enter your claim code.

Step 9

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:

@digitalsalat
Copy link

@olliez0r : will try that tonite, thank you! Blindly poking is my way to go, too 👍

@pablonoel
Copy link

BTW @digitalsalat that solved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment