Giter Club home page Giter Club logo

rpi-docker-cpu-temperature-server's Introduction

Raspberry Pi Temperature Server using Docker Compose

This project uses docker-compose to run a multi-container application which checks the Raspberry Pi's CPU temperature and provides the result through a very simple AJAX web application. It is intentionally more complicated than necessary to show how docker-compose can be used to deploy applications on the Raspberry Pi.

The application consists of three containers. The current temperature is read from one container using Python and then stored in another container using Redis. The value is then read from Redis and server over HTTP using NodeJS/Express.

Running docker-compose up will:

  1. (If needed) download a Raspbian base docker image.
  2. (If needed) download Redis and compile from source inside the redis-rpi image.
  3. (If needed) install NodeJS and Python inside the nodejs-rpi and python3-rpi images respectively.
  4. Start containers for each image and network them together.
  5. Make the NodeJS application available on port 80 (default web port) of the raspberry pi.

Initial Setup

Before running this project you will need to install docker and docker-compose on your pi. This can be achieved by running the following commands on from a terminal on the Raspberry pi:

# Install docker via not-very-secure pipe from curl to shell
curl -sSL https://get.docker.com | sh
    
# Easiest way to install docker-compose is through python's pip
# package manager
pip install docker-compose

Once you've installed docker and docker-compose, reboot your pi by running:

sudo reboot

Running Temperature Server

Once docker and docker-compose are both happily working, simply run:

# Clone this git repository
git clone https://github.com/tomnewport/rpi-docker-cpu-server.git

# Change to the main directory
cd rpi-docker-cpu-server

# Run docker-compose in detached mode - this may take some time to 
# download and build docker images on first run.
docker-compose up -d

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.