RASCSI/docker/README.md
nucleogenic 673da6312b
Add Docker environment for development and testing of the web UI
Add --token parameter to easyinstall.sh

Add --skip-token parameter to easyinstall.sh

Install required apt packages explicitly (--no-install-recommends)

Allow standalone RaSCSI and web UI installations to specify an auth token

Add development mode to web UI (web/start.sh --dev-mode)

Initial Docker-based development environment for Python and web UI

Bump protobuf version

Workaround for Flask development server and asyncio incompatibility

Build Python protobuf interface on container launch, if it doesn’t exist

Allow containers to be configured with environment variables, add support for token authentication

Move web UI live editing setup out of main Docker Compose config

Update dockerignore to exclude by default

Update README

Add OS_DISTRO, OS_VERSION and OS_ARCH build args

Allow extracted files to be moved to target when crossing a filesystem boundary

Reduce noise from watchmedo auto-restarts

Update Docker tag structure to rascsi:{build}-{platform}-{variant}

Prevent Docker Compose from attempting to pull images from Docker registry

Add workaround for issue #821

Allow container processes to be stopped with Ctrl+C

Update README, bind to ports 8080/8443 on the Docker host by default

Update README to clarify audience and no board connectivity

Add AIBOM and GAMERNIUM to --connect_type validation

Update cfilesystem.patch following rebase
2022-09-08 12:19:30 +01:00

115 lines
3.0 KiB
Markdown

# Docker Environment for Development and Testing
⚠️ **Important:** The Docker environment is unable to connect to the RaSCSI board and is
intended for development and testing purposes only. To setup RaSCSI on a Raspberry Pi
refer to the [setup instructions](https://github.com/akuker/RASCSI/wiki/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 RaSCSI server and the web UI.
The web UI can be accessed at:
* http://localhost:8080
* https://localhost:8443
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_DISTRO` | debian |
| `OS_VERSION` | buster |
| `OS_ARCH` | amd64 |
| `WEB_HTTP_PORT` | 8080 |
| `WEB_HTTPS_PORT` | 8443 |
| `WEB_LOG_LEVEL` | info |
| `RASCSI_HOST` | rascsi |
| `RASCSI_PORT` | 6868 |
| `RASCSI_PASSWORD` | *[None]* |
| `RASCSI_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/rascsi/ |
## How To
### Rebuild Containers
You should rebuild the container images after checking out a different version of
RaSCSI 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 `rascsi` or `rascsi_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/RASCSI/python/` in the `rascsi_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:
rascsi_web:
volumes:
- ../python:/home/pi/RASCSI/python:delegated
```
### Connect the Web UI to a Real RaSCSI
This can be useful for testing, but there are some caveats, e.g. the RaSCSI and the
web UI will be accessing separate `images` directories.
```
RASCSI_HOST=foo RASCSI_PASSWORD=bar docker compose up
```