RASCSI/docker
Uwe Seimet 41bdcd4aed
Issues 1179 and 1182 (#1232)
* Update logging

* Remove duplicate code

* Update unit tests

* Clean up includes

* Merge ProtobufSerializer into protobuf_util namespace

* Precompile regex

* Add const

* Add Split() convenience method, update log level/ID parsing

* Move log.h to legacy folder

* Elimininate gotos

* Fixes for gcc 13

* Update compiler flags

* Update default folder handling

* Use references instead of pointers

* Move code for better encapsulation

* Move code

* Remove unused method argument

* Move device logger

* Remove redundant to_string

* Rename for consistency

* Update handling of protobuf pointers

* Simplify protobuf usage

* Memory handling update

* Add hasher
2023-10-15 08:38:15 +02:00
..
backend Introduce FTP server option; sundry bug fixes (#1028) 2022-12-09 21:00:31 -08:00
pytest Run web API test suite in GitHub Actions (#1009) 2022-12-04 14:31:57 +00:00
volumes Add Docker environment for development and testing of the web UI 2022-09-08 12:19:30 +01:00
web Issues 1179 and 1182 (#1232) 2023-10-15 08:38:15 +02:00
docker-compose.ci.yml Always assign locale in detect_locale() (#1163) 2023-05-16 12:19:40 -07:00
docker-compose.override.yml.example Rebrand project to PiSCSI (#1016) 2022-12-05 09:58:23 -08:00
docker-compose.yml Issues 1179 and 1182 (#1232) 2023-10-15 08:38:15 +02:00
README.md Issues 1179 and 1182 (#1232) 2023-10-15 08:38:15 +02:00

Docker Environment for Development and Testing

⚠️ Important: The Docker environment is unable to connect to the PiSCSI board and is intended for development and testing purposes only. To setup PiSCSI on a Raspberry Pi refer to the setup instructions on the wiki instead.

Introduction

This documentation currently focuses on using Docker for developing and testing the web UI.

Additions, amendments and contributions for additional workflows are most welcome.

Getting Started

The easiest way to launch a new environment is to use Docker Compose.

cd docker
docker compose up

Containers will be built and started for the PiSCSI server and the web UI.

The web UI can be accessed at:

To stop the containers, press Ctrl + C, or run docker compose stop from another terminal.

Environment Variables

The following environment variables are available when using Docker Compose:

Environment Variable Default
OS_VERSION bullseye
WEB_HTTP_PORT 8080
WEB_HTTPS_PORT 8443
WEB_LOG_LEVEL info
BACKEND_HOST backend
BACKEND_PORT 6868
BACKEND_PASSWORD [None]
BACKEND_LOG_LEVEL debug

Examples:

Run Debian "bullseye":

OS_VERSION=bullseye docker compose up

Start the web UI with the log level set to debug:

WEB_LOG_LEVEL=debug docker compose up

Volumes

When using Docker Compose the following volumes will be mounted automatically:

Local Path Container Path
docker/volumes/images/ /home/pi/images/
docker/volumes/config/ /home/pi/.config/piscsi/

How To

Rebuild Containers

You should rebuild the container images after checking out a different version of PiSCSI or making changes which affect the environment at build time, e.g. easyinstall.sh.

docker compose up --build

Open a Shell on a Running Container

Run the following command, replacing [CONTAINER] with backend or web.

docker compose exec [CONTAINER] bash

Setup Live Editing for the Web UI

Use a docker-compose.override.yml to mount the local python directory to /home/pi/piscsi/python/ in the web container.

Any changes to *.py files on the host computer (i.e. in your IDE) will trigger the web UI process to be restarted in the container.

Example:

services:
  web:
    volumes:
      - ../python:/home/pi/piscsi/python:delegated

Connect the Web UI to a Real PiSCSI

This can be useful for testing, but there are some caveats, e.g. the PiSCSI and the web UI will be accessing separate images directories.

BACKEND_HOST=foo BACKEND_PASSWORD=bar docker compose up