Show and Tell Timer Hackathon Project

For the Berlin Hack and Tell I use a Raspberry Pi 4 connected to an LCD and external LED matrix to run the show and tell. It display a countdown timer, collect votes, etc… and uses both Ethernet and Wifi.

The application code is at hackandtell-python/hackandtell-pygame.py at master · lucasrangit/hackandtell-python · GitHub and uses PyGame, SDL2, and the Linux Framebuffer, and UDP.

1 Like

Hi @marc_pous_test , I noticed that the GitHub - balena-io-examples/balena-node-hello-world: Run a simple express server with balena doesn’t have a balena.yml file. Is it optional for simple projects?

1 Like

Thank you @lucasrangit for this!

Let us know your next steps :slight_smile:

Same is true for the Python hello world flask example GitHub - balena-io-examples/balena-python-hello-world: A simple Hello World server with Python Flask .

1 Like

@mpous , I need to use a docker-compose.yml file so that I can specify which host devices I need access to. But I don’t understand how this is done with balena and if the balena.yml is the same thing?

Is the Python and Node examples, how does balena know to forward port :80 to the container?

no! balena.ymlis a contract that we use internally at balena to deploy projects and use them on balenaHub, but nothing related with docker-composethat is being use to define the services that will be deployed on the fleet.

Maybe reading this will help you for a multi-container environment Two projects, one device: turn your Raspberry Pi into a multitool!

Here you can learn more about multi-container releases managing ports (e.g. 80) Communicate outside the container - Balena Documentation

I’ve setup a docker-compose.yml with the following. But my program is having issues detecting the framebuffer device and the python program exits immediately. How can I SSH into the container to troubleshoot? I need to override the CMD command to run a shell since my program is exiting.

version: "2"

services:
  hackandtell-pygame:
    build:
      context: .
      dockerfile: ./Dockerfile.template
    privileged: true
    devices:
      - "/dev/fb0:/dev/fb0"
      # - "/dev/input:/dev/input"
      # - "/dev/snd:/dev/snd"
    environment:
      - NETWORK_INTERFACE=eth0
      - SDL_FBDEV=/dev/fb0
[Logs]    [10/16/2021, 2:39:55 PM] Restarting service 'hackandtell-pygame sha256:c80518bb747a16b19bddeba59d9f812d53aa4ef98aefc9d8bc78267c0dbd2160'
[Logs]    [10/16/2021, 2:39:56 PM] [hackandtell-pygame] pygame 2.0.2 (SDL 2.0.16, Python 3.6.14)
[Logs]    [10/16/2021, 2:39:56 PM] [hackandtell-pygame] Hello from the pygame community. https://www.pygame.org/contribute.html
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame] Traceback (most recent call last):
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame]   File "hackandtell-pygame.py", line 253, in <module>
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame]     main()
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame]   File "hackandtell-pygame.py", line 88, in main
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame]     SIZE = SIZE_W, SIZE_H = (min(pygame.display.Info().current_w, 1024), min(pygame.display.Info().current_h, 600))
[Logs]    [10/16/2021, 2:39:57 PM] [hackandtell-pygame] pygame.error: video system not initialized
[Logs]    [10/16/2021, 2:39:58 PM] Service exited 'hackandtell-pygame sha256:c80518bb747a16b19bddeba59d9f812d53aa4ef98aefc9d8bc78267c0dbd2160'

I’m trying to use local mode to debug faster Develop locally - Balena Documentation . But I think the issue is my service does not start properly.

$ echo "ls -l /dev; exit;" | balena ssh 192.168.1.129 hackandtell-pygame
Error response from daemon: Container 34021c940f85ca3e9926a0ef6b5460920290f8bc6ccbae4cfe72657c890fa2c5 is restarting, wait until the container is running
Warning: ssh process exited with non-zero code "1"
1 Like

Hello @lucasrangit did you fin a way to solve this issue?

Let us know how we can help you more!