Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.46 KB

run-without-docker.md

File metadata and controls

71 lines (47 loc) · 1.46 KB

Run Without Docker

The following steps can be used to run the raspberry-pi-server without using a container (Docker, Kubernetes, etc.).

NOTE: Alternatively you can run the following command from your Raspberry Pi to perform these steps for you:

sudo curl -fL https://github.com/rustygreen/raspberry-pi-server/blob/main/scripts/setup.sh | sh -

Review the setup.sh script before executing (don't just trust me).

Raspberry Pi Setup

  1. Install Git on your Raspberry Pi
$ sudo apt update
$ sudo apt install git
  1. Install Python 3 and Pip 3 on your Raspberry Pi
$ sudo apt update
$ sudo apt install python3 idle3 pip3

Deploy Server to Pi

  1. Clone the repository
$ cd /home/pi # Or wherever you want to store your code.
$ git clone https://github.com/rustygreen/raspberry-pi-server.git
  1. Install Python dependencies
$ cd raspberry-pi-server
$ pip3 install -r requirements.txt
  1. Run Server
$ sudo python3 server.py
  1. Consume the services

Returns a list of pins and their state (1 or 0)

$ curl http://localhost:8080/pins

Returns the state for GPIO pin #7

$ curl http://localhost:8080/pins/7

Sets the state of GPIO pin #7 to 1 (high)

$ curl http://localhost:8080/pins/7/1

You should get back a JSON list of the GPIO pins and their current state.