Giter VIP home page Giter VIP logo

bradleya / pi-display Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 7.6 MB

Displays are Pimoroni Blinkt, Scroll-pHAT, and Scroll-pHAT-HD connected to Raspberry Pi 3 using Triple GPIO Multiplexing Expansion Board

License: MIT License

Shell 56.24% Python 41.89% Dockerfile 1.88%
raspberry-pi-3 shell-script scroll-phat led-display pimoroni blinkt scroll-phat-hd pimoroni-blinkt-python respberry-pi led-matrix-displays

pi-display's People

Contributors

bradleya avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

pi-display's Issues

./create-message.sh redesign to decrease the amount ot time to complete

./create-message.sh support scale and performance
redesign create-message/sh to decrease the amount of time it takes to complete
change the first loop to start a docker container or script.sh on each host in SYSTEMS list but do not wait for the container or script to complete before starting the container or script on the next host. That way each the container or script will run in ~parallel.
Will need a method for the second loop to determine if the first container or script has completed. (test with 1 or 2 host then test with all hosts)
or use a temp file for the new information and when the container or script is complete then update data/cluster/host file with the new information so when the second loop pull information it is always complete

Architect: installation script to self configure cluster server

Architect

install in create-message.sh ; check all required directories if NOT create / error ; check for install files in default directories if NOT create / error

Directories required:

-d /usr/local/bin 2) 3)
-d /usr/local/data
-d /usr/local/data/${CLUSTER}

Install files:

  1. SYSTEMS
  2. create-message.sh
  3. CPU_usage.sh
  4. docker-compose.yaml
  5. Dockerfile

System configuration:

A) set crontab or at 2)
B)

display-led.py determine script run time to determine sleep time before exit

display-led.py determine script run time to determine sleep time before exit

Need to write this in python

#  Set START_TIME
START_TIME=`date +%Y%m%d%H%M%S
#  Set end time
END_TIME=`date +%Y%m%d%H%M%S`
#  calucate run time
RUN_TIME=$(expr ${END_TIME} - ${START_TIME})
echo "${START_TIME} ${END_TIME}"
expr  15 - (${END_TIME} - ${START_TIME})

display-led.py correct run error

display-led.py
check-markit 134 [INFO]: /usr/local/bin/display-led.py release 3.141.283, commit date 2018-09-22_13:30:59_CDT

Traceback (most recent call last):
File "/usr/local/bin/display-led.py", line 89, in
FILE_NAME = DATA_DIR + CLUSTER + FILE_NAME
TypeError: Can't convert 'bytes' object to str implicitly

create-message.sh move copy of MESSAGE file to remote systems after being updated

create-message.sh
The information in MESSAGE file is sent to remote systems before it has been updated. This means remote systems with Scroll-pHAT will display the previous MESSAGE information. Thus systems with Scroll-pHAT will display the previous MESSAGE information.

Add a new loop to scp MESSAGE file to remote hosts after MESSAGE file has been completed . This will display current information on remote systems with Scroll-pHAT vers previous copy of MESSAGE.

create-message.sh coping wrong hostname files

create-message.sh

server six create-message.sh creates correct docker information in four-rpi3B.cptx86.com on six (Running 1) but when create-message.sh copied the file (four-rpi3b.cptx86.com) from six to four the wrong docker information is copied to four-rpi3b.cptx86.com on host four-rpi3b (Running 0)

display-led.py Change echo or print DEBUG INFO WARNING ERROR

display-led.py Change echo or print DEBUG INFO WARNING ERROR

• When - Date and Time (UTC)1 Event Occurred
• What - Software Application & version, Command, OS version, log level, PID, PPID
• Where - GPS Location, MAC Address, Gateway, Source and Destination IP, Port, VM ID, Container ID, Image ID, Host ID, Data Center Row and Rack location, Data Center Geo-location
• Who2 - UID, GID, Customer ID, Transaction ID, cart ID
• Message - Text Message including incident level

scrollphat/display-message.py retest and update display_help

../scrollphat/display-message.py

echo $CLUSTER
export CLUSTER='us-west1'
echo $CLUSTER
unset  CLUSTER
echo $CLUSTER

Use the -n option with export")
print ("to remove the exported information from the CLUSTER environment variable;")
print ("export -n CLUSTER. Setting an environment variable to be defined at login")
print ("by adding it to ~/.bashrc file or you can just modify the script with your")
print ("default location for DATA_DIR, CLUSTER, and MESSAGE_FILE. You are on your")
print ("own defining environment variables if you are using other shells.")

display-message-hd.py test if require splitlines()

display-message-hd.py test if require splitlines() is required or if rstrip('\n') is ok
sample of code below

#  Check argument 1 for non-default MESSAGEHD file
if no_arguments == 2 :
   MESSAGEHD_file = sys.argv[1]
   if DEBUG == 1 : print ("> {}DEBUG{} {}  {}  Using MESSAGEHD file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), MESSAGEHD_file))
else :
   if DEBUG == 1 : print ("> {}DEBUG{} {}  {}  Using MESSAGEHD file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), MESSAGEHD_file))

#  Read TEMP_FILE contents and return contents
def get_msg(TEMP_FILE) :
   if DEBUG == 1 : print ("> {}DEBUG{} {}  {}  Reading MESSAGE file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), TEMP_FILE))
   file = open(TEMP_FILE,"r")
   CONTENT = file.read()
   file.close()
   CONTENT = CONTENT.rstrip('\n')
   return CONTENT

add pi-display/main/test2/display-led.py to crontab

pi-display/main/test2/display-led.py display on blinkt
=> notes <
check if VISUAL is set to editor
env | grep -i visual
source ~/.bashrc

sudo vi /etc/cron.allow
add user name approved to add to crontab
uadmin

crontab -e

add line below to file
*/2 * * * * /usr/local/bin/display-led.py >> /tmp/crontab-test-log-file 2>&1

create-message.sh correct ssh port design

create-message.sh

Looks like scp and ssh is not using SSHPORT
the second question
should I use .ssh/config instead of argument 4

THis looks like a bug just need to test so more

create-message.sh add failover automation support

create-message.sh
Change the design to support running create-message.sh on any system in a cluster, not just the system in the cluster that has a scroll phat. Systems fail! To support an SRE environment of automation and failover

create-message.sh Change echo or print DEBUG INFO WARNING ERROR

Change echo or print DEBUG INFO WARNING ERROR

• When - Date and Time (UTC)1 Event Occurred
• What - Software Application & version, Command, OS version, log level, PID, PPID
• Where - GPS Location, MAC Address, Gateway, Source and Destination IP, Port, VM ID, Container ID, Image ID, Host ID, Data Center Row and Rack location, Data Center Geo-location
• Who2 - UID, GID, Customer ID, Transaction ID, cart ID
• Message - Text Message including incident level

pi-display/blinkt/display-led.py : move from crontab to ? systemd ?

Thinking about moving the services to containers (Thinking not just off the top of my head; the container will create an security risk because of the need for --privileged) or systemd. (systemctl status docker.service ; journalctl -xe )

Full container capabilities (--privileged)

The --privileged flag gives all capabilities to the container, and it also lifts all the limitations enforced by the device cgroup controller. In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.

scrollphat/display-message.py add test if scrollpHAT available

scrollphat/display-message.py add test if scrollpHAT available

$ ./display-message.py -h
Traceback (most recent call last):
File "./display-message.py", line 37, in
import scrollphat
File "/usr/lib/python2.7/dist-packages/scrollphat/init.py", line 20, in
controller = IS31FL3730(smbus, font)
File "/usr/lib/python2.7/dist-packages/scrollphat/IS31FL3730.py", line 21, in init
self.set_mode(self.i2cConstants.MODE_5X11)
File "/usr/lib/python2.7/dist-packages/scrollphat/IS31FL3730.py", line 62, in set_mode
self.bus.write_i2c_block_data(self.i2cConstants.I2C_ADDR, self.i2cConstants.CMD_SET_MODE, [self.i2cConstants.MODE_5X11])
IOError: [Errno 5] Input/output error

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.