Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (36 sloc) 1.79 KB

Make a service on a Raspberry Pi 2 running Rasbian jessie

Jessie comes with systemd installed, which can be used to start services upon boot.

Run a NATS worker on your pi.

Prerequisites:

  • Raspberry Pi 2 with Rasbian jessie
  • On your network
  • You learn the ip.
  • For convenience of not having enter a password every time authorize your public key on the pi.
    • scp ~/.ssh/id_rsa.pub pi@:/home/pi/.ssh/jill_rsa.pub
    • ssh into the pi and append the contents of jill_rsa.pub to ~/.ssh/authorized_keys

Steps:

  • download pypy for Rasbian: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux-armhf-raspbian.tar.bz2
  • bunzip2 it and put it in /home/pi/ on the pi.
  • Extract the tar: tar -xvf pypy-4.0.1-linux-armhf-raspbian.tar
  • clone this repo to /home/pi/projects/ (hardcoded in the .service file)
  • copy this Makefile and nats.respond.1.service to /home/pi/ as that is where I wrote it and hardcoded some paths. TODO: Use environmental variables or maybe do this Chef
  • ssh into the pi
  • download get-pip.py to /home/pi/
    • curl -o get-pip2.py https://bootstrap.pypa.io/get-pip.py
  • make install-pypy
  • make pypy-get-pip
  • make install-txnats

Optionally link pypy to your home bin directory, so you can run pypy without entering the whole path.

  • If it doesn't exist add a bin directory to your home directory. mkdir ~/bin
  • make link-pypy

Setup and start the services This will make four copies of the respond service.

  • make add-services
  • make start-services
  • make enable-services

See the status of the services:

  • make status-services

From your local machine you should now be able to run make_requests.py and the services on the pi will respond.

You can’t perform that action at this time.