Raspberry Pi and PC Integration

Anthias is designed to run on both Raspberry Pi devices and PCs, providing flexibility for various deployment scenarios. This section outlines how the codebase is structured to support both platforms and the specific considerations for each.

Raspberry Pi Support

Anthias offers disk images specifically tailored for Raspberry Pi models 1, 2, 3, and 4, providing a streamlined installation experience for this popular platform. README.md

The following code snippet demonstrates how the codebase detects the Raspberry Pi model using /proc/device-tree/model:

Filename: lib/device_helper.py
          def get_device_type():
              try:
                  with open('/proc/device-tree/model') as file:
                      content = file.read()
          
                      if 'Raspberry Pi 4' in content:
                          return 'pi4'
                      elif 'Raspberry Pi 3' in content:
                          return 'pi3'
                      elif 'Raspberry Pi 2' in content:
                          return 'pi2'
                      else:
                          return 'pi1'
              except FileNotFoundError:
                  return 'x86'
          

PC (x86 Devices) Support

Anthias currently supports 64-bit Bookworm installations on PCs. It is recommended to use an x86 device like a NUC for optimal performance. readme.md

Detailed instructions for installing Debian 12 on x86 devices can be found in the docs/x86-installation.md file.

Wi-Fi Setup

The Wi-Fi setup process for Anthias is primarily designed for Raspberry Pi devices. docs/wifi-setup.md

Authentication

The authentication mechanism in Anthias uses a combination of basic authentication and environment variables. The default user is set to ‘pi’ by default. lib/auth.py

Filename: lib/auth.py
          LINUX_USER = os.getenv('USER', 'pi')
          

Balena Integration

Anthias utilizes Balena for deployment and management. balena.yml Balena OpenFleets offers automatic updates, ensuring that your Anthias devices are always running the latest software version. balena.yml

Docker Containerization

Anthias relies on Docker for containerization. To access logs from the containers, use the docker logs or docker-compose logs commands. docs/README.md

Templates and Integrations

Anthias includes templates and integrations for various scenarios. For example, the following code snippets demonstrate how the system detects and displays device-specific information:

Filename: templates/integrations.html
          
          Code:
                                      Device Name
                                      {{ balena_device_name_at_init }}
                                      The name of the device on first initialisation.
                                  
          
                                      Host OS Version
                                      {{ balena_host_os_version }}
                                      The version of the host OS.
          
                                      Device UUID
                                      {{ balena_device_id }}
                                      The unique identification number for the device. This is used to identify it on
                                          balena.
                                      
                                  
                                  
                                      App ID
                                      {{ balena_app_id }}
                                      ID number of the balena application the device is associated.
                                  
          

Top-Level Directory Explanations

.github/ - This directory contains GitHub-specific configuration files and workflows for the project.

.github/workflows/ - This directory contains YAML files defining continuous integration and deployment workflows for GitHub Actions.

anthias_app/ - This directory contains the main application codebase for the project, likely written in Django.

anthias_django/ - This directory may contain additional Django-specific configuration files and code.

api/ - This directory contains the API codebase for the project.

api/serializers/ - This directory contains Django REST Framework serializers for converting data between Python objects and JSON.

api/views/ - This directory contains Django views for handling HTTP requests and rendering responses.

bin/ - This directory contains executable scripts for the project.

lib/ - This directory contains reusable Python modules and libraries for the project.

templates/ - This directory contains HTML templates used to render dynamic content.

tests/ - This directory contains test files for the project.

tools/ - This directory contains tools and scripts used to develop and maintain the project.

tools/image_builder/ - This tool likely builds and optimizes images for the project.

website/ - This directory contains the website codebase.

website/bin/ - This directory contains website executable scripts.

webview/ - This directory likely contains configuration files and code for a webview component.

webview/res/ - This directory contains webview resources, such as images and XML files.

webview/src/ - This directory contains webview source code.