فهرست منبع

switch to local install

Torsten Simon 2 سال پیش
والد
کامیت
55cd0e3e6f
6فایلهای تغییر یافته به همراه45 افزوده شده و 36 حذف شده
  1. 0 16
      Dockerfile
  2. 25 0
      Dockerfile.bak
  3. 9 10
      docker-compose.yml
  4. 7 7
      install.sh
  5. 2 2
      src/data-writer.py
  6. 2 1
      src/requirements.txt

+ 0 - 16
Dockerfile

@@ -1,16 +0,0 @@
-# syntax=docker/dockerfile:1
-
-FROM debian:bullseye
-RUN apt-get update && apt-get -y install wget git gcc python3-pip tesseract-ocr build-essential cmake pkg-config libjpeg-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev libssl-dev -y
-WORKDIR /tmp
-RUN git clone https://github.com/adrianlazaro8/Tesseract_sevenSegmentsLetsGoDigital && cd Tesseract_sevenSegmentsLetsGoDigital && mv 'Trained data'/* /usr/share/tesseract-ocr/4.00/tessdata/
-WORKDIR /app
-RUN mkdir images
-RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
-RUN chmod +x wait-for-it.sh
-COPY src/requirements.txt . 
-RUN pip3 install --upgrade pip
-RUN export READTHEDOCS=True && pip3 install -r requirements.txt --default-timeout=100
-COPY src/ .
-RUN chmod +x entrypoint.sh
-CMD [ "./entrypoint.sh"]

+ 25 - 0
Dockerfile.bak

@@ -0,0 +1,25 @@
+# syntax=docker/dockerfile:1
+
+#FROM debian:bullseye
+FROM balenalib/raspberry-pi-debian:latest
+RUN apt-get update 
+#RUN apt-get install wget git gcc python3-pip tesseract-ocr build-essential cmake pkg-config libjpeg-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev libssl-dev  -y
+RUN apt-get install tesseract-ocr
+RUN apt-get install git -y
+RUN apt-get install wget -y
+RUN apt-get install python3-pip -y
+RUN apt-get install patch -y
+RUN apt-get install cmake -y 
+#RUN apt-get install libraspberrypi-bin -y
+WORKDIR /tmp
+RUN git clone https://github.com/adrianlazaro8/Tesseract_sevenSegmentsLetsGoDigital && cd Tesseract_sevenSegmentsLetsGoDigital && mv 'Trained data'/* /usr/share/tesseract-ocr/4.00/tessdata/
+WORKDIR /app
+RUN mkdir images
+RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
+RUN chmod +x wait-for-it.sh
+COPY src/requirements.txt . 
+RUN pip3 install --upgrade pip
+RUN export READTHEDOCS=True && pip3 install -r requirements.txt --default-timeout=100
+COPY src/ .
+RUN chmod +x entrypoint.sh
+CMD [ "./entrypoint.sh"]

+ 9 - 10
docker-compose.yml

@@ -1,14 +1,14 @@
 version: "3.9"
 services:
-  python:
-      image: tsgames/solar-monitor:manifest-arm32v7
-      build: 
-        context: .
-      restart: unless-stopped
-      devices:
-        - "/dev/vchiq"
-      volumes:
-          - images-data:/app/images
+#  python:
+#      image: tsgames/solar-monitor:manifest-arm32v7
+#      build: 
+#        context: .
+#      restart: unless-stopped
+#      devices:
+#        - "/dev/vchiq"
+#      volumes:
+#          - images-data:/app/images
   fileserver:
       build:
         context: nginx
@@ -26,7 +26,6 @@ services:
         GF_DATE_FORMATS_FULL_DATE: "DD.MM.YYYY HH:mm:ss"
       volumes:
         - grafana-data:/var/lib/grafana
-        
   influxdb:
     #image: influxdb:1.8
     image: arm32v7/influxdb:latest

+ 7 - 7
install.sh

@@ -1,20 +1,20 @@
 #!/bin/sh
 
 sudo apt-get update
-sudo apt-get install python3-pip tesseract-ocr python-opencv build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev -y
+sudo apt-get install python3-pip tesseract-ocr python3-opencv build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev -y
 
-pip3 install -r requirements.txt
+pip3 install -r src/requirements.txt
 pip3 install -U numpy
 git clone https://github.com/arturaugusto/display_ocr
 sudo cp display_ocr/letsgodigital/* /usr/share/tesseract-ocr/4.00/tessdata/
 git clone https://github.com/adrianlazaro8/Tesseract_sevenSegmentsLetsGoDigital && cd Tesseract_sevenSegmentsLetsGoDigital
-sudo mv 'Trained data'/* /usr/share/tesseract-ocr/4.00/tessdata/
+sudo mv 'Trained data'/ /usr/share/tesseract-ocr/4.00/tessdata/
 docker-compose up -d
-(crontab -l 2>/dev/null; echo "@reboot python3 /home/pi/solar-monitor/data-writer.py") | crontab -
+(crontab -l 2>/dev/null; echo "@reboot python3 /home/pi/solar-monitor/src/data-writer.py") | crontab -
 # python3 data-writer.py
-echo "Reboot pi to complete setup and start the data job or run 'python3 /home/pi/solar-monitor/data-writer.py'"
+echo "Reboot pi to complete setup and start the data job or run 'python3 /home/pi/solar-monitor/src/data-writer.py'"
 
 
 # UNSORTED
-git clone https://github.com/ljk53/pytorch-rpi && cd pytorch-rpi
-LIBTORCH_VARIANT=armv7l-cxx11-abi-shared-without-deps ./build_libtorch.sh
+# git clone https://github.com/ljk53/pytorch-rpi && cd pytorch-rpi
+# LIBTORCH_VARIANT=armv7l-cxx11-abi-shared-without-deps ./build_libtorch.sh

+ 2 - 2
src/data-writer-opencv.py → src/data-writer.py

@@ -11,7 +11,7 @@ import numpy as np
 import re
 import os
 from influxdb import InfluxDBClient
-client = InfluxDBClient(host="influxdb", port=8086, username="influxdb", password="influxdbTSGAMES")
+client = InfluxDBClient(host="localhost", port=8086, username="influxdb", password="influxdbTSGAMES")
 client.create_database("influxdb")
 client.switch_database('influxdb')
 class SolarMonitor:
@@ -151,7 +151,7 @@ class SolarMonitor:
             # os.unlink(file)
             time.sleep(2)    
 
+solar = SolarMonitor(test = False)
 while True:
-    solar = SolarMonitor(test = False)
     solar.run()
     

+ 2 - 1
src/requirements.txt

@@ -3,8 +3,9 @@ influxdb
 rpi-rf
 setuptools
 wheel
-opencv-python==4.5.3.56
+#opencv-python==4.5.3.56
 #opencv-python==3.4.13.47
+opencv-python # ==4.3.0.38
 pillow
 pytesseract
 imutils