Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Docker builds and modernized DHT access #21

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Follow [installation instruction](INSTALLATION.md)

# Configuration

Modify [fruitnanny_config](./fruitnanny_config.js) to configure the baby monitor.
Modify [fruitnanny_config](./fruitnanny/fruitnanny_config.js) to configure the baby monitor.

Params:
* `baby_name` - baby's name to display in UI
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
container.name: 'ivadim/fruitnanny-gstreamer'
Fruitnanny:
stage.name: 'fruitnanny'
container.name: 'ivadim/fruitnanny-app'
container.name: 'ivadim/fruitnanny'
maxParallel: 3

steps:
- script: |
docker version
docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker build . -f docker/$(stage.name)/Dockerfile -t $(container.name)
docker build . -f $(stage.name)/Dockerfile -t $(container.name)
docker images
docker inspect $(container.name)
displayName: 'Build $(stage.name) Container'
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- script: |
docker version
docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker build . -f docker/$(stage.name)/Dockerfile -t $(container.name)
docker build . -f $(stage.name)/Dockerfile -t $(container.name)
docker images
docker inspect $(container.name)
displayName: 'Build $(stage.name) Container'
Expand All @@ -45,4 +45,4 @@ jobs:
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: images
artifactName: images
12 changes: 0 additions & 12 deletions bin/dht22.py

This file was deleted.

6 changes: 0 additions & 6 deletions docker-compose.local.yml

This file was deleted.

15 changes: 6 additions & 9 deletions docker-compose.notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,29 @@ services:
notification-temp:
build:
context: .
dockerfile: docker/notification/Dockerfile
dockerfile: notification/Dockerfile
restart: always
network_mode: "host"
privileged: true
volumes:
- /opt/fruitnanny/bin:/opt/fruitnanny/bin
depends_on:
- nginx
- janus
- fruitnanny
#command: /bin/bash
#tty: true
command: python3 /opt/fruitnanny/bin/temperature.py
command: python3 /opt/notification/temperature.py

notification-motion:
image: fruitnanny_notification-temp
build:
context: .
dockerfile: notification/Dockerfile
restart: always
network_mode: "host"
privileged: true
volumes:
- /opt/fruitnanny/bin:/opt/fruitnanny/bin
depends_on:
- nginx
- janus
- fruitnanny
- notification-temp
#command: /bin/bash
#tty: true
command: python3 /opt/fruitnanny/bin/motion.py
command: python3 /opt/notification/motion.py
17 changes: 9 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
janus:
image: ivadim/fruitnanny-janus
build: ./janus
restart: always
privileged: true
network_mode: "host"
Expand All @@ -15,7 +15,7 @@ services:
- 5004 # video

gstreamer-video:
image: ivadim/fruitnanny-gstreamer
build: ./gstreamer
restart: always
privileged: true
network_mode: "host"
Expand All @@ -29,7 +29,7 @@ services:
command: gst-launch-1.0 -v rpicamsrc name=src preview=0 exposure-mode=night fullscreen=0 bitrate=1000000 annotation-mode=time+date annotation-text-size=20 ! video/x-h264,width=960,height=540,framerate=12/1,profile=constrained-baseline ! queue max-size-bytes=0 max-size-buffers=0 ! h264parse ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5004 sync=false

gstreamer-audio:
image: ivadim/fruitnanny-gstreamer
build: ./gstreamer
restart: always
privileged: true
network_mode: "host"
Expand All @@ -41,15 +41,16 @@ services:
command: "/audio_entry.sh"

fruitnanny:
image: ivadim/fruitnanny-app
build: ./fruitnanny
restart: always
privileged: true
volumes:
- ./fruitnanny_config.js:/opt/fruitnanny/fruitnanny_config.js
- ./bin:/opt/fruitnanny/bin
network_mode: "host"
depends_on:
- janus
devices:
- "/dev/gpiochip0:/dev/gpiochip0"
- "/dev/gpiochip1:/dev/gpiochip1"
- "/dev/gpiomem:/dev/gpiomem"
expose:
- 7000

Expand All @@ -67,4 +68,4 @@ services:
- ./configuration/ssl:/etc/fruitnanny-ssl
ports:
- "80:80"
- "443:443"
- "443:443"
23 changes: 0 additions & 23 deletions docker/fruitnanny/Dockerfile

This file was deleted.

20 changes: 20 additions & 0 deletions fruitnanny/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM balenalib/raspberrypi3-debian-node:12.13-buster

RUN echo 'APT::Install-Recommends "false";' >/etc/apt/apt.conf.d/00recommends \
&& echo 'APT::Install-Suggests "false";' >>/etc/apt/apt.conf.d/00recommends \
&& apt-get update && apt-get upgrade && apt-get install -y \
dos2unix \
libgpiod2 \
python3 \
python3-pip \
wiringpi \
&& pip3 install --upgrade RPI.GPIO adafruit-blinka adafruit-circuitpython-dht \
&& apt-get --purge -y autoremove && apt-get clean && rm -rf /tmp/* && rm -rf /var/lib/apt/lists/*

ADD . /opt/fruitnanny
WORKDIR /opt/fruitnanny

RUN dos2unix /opt/fruitnanny/bin/* && npm install

CMD ["node", "server/app.js"]
EXPOSE 7000
File renamed without changes.
22 changes: 22 additions & 0 deletions fruitnanny/bin/dht22.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3
import sys

import adafruit_dht
import board

# choose one or the other
dht = adafruit_dht.DHT22(board.D24)
# dht = adafruit_dht.DHT11(board.D24)

for i in range(1,10):
try:
t = dht.temperature
h = dht.humidity
if t and h:
print('{0:0.1f} {1:0.1f}'.format(t, h))
break
except:
pass
if not t or not h:
print('Failed to get reading. Try again!')
sys.exit(1)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading