2022-08-28 13:51:31 +00:00
|
|
|
# Docker Environment for Development and Testing
|
|
|
|
|
2022-12-05 17:58:23 +00:00
|
|
|
⚠️ **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](https://github.com/PiSCSI/piscsi/wiki/Setup-Instructions)
|
2022-08-28 13:51:31 +00:00
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2022-12-05 17:58:23 +00:00
|
|
|
Containers will be built and started for the PiSCSI server and the web UI.
|
2022-08-28 13:51:31 +00:00
|
|
|
|
|
|
|
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 |
|
2022-12-04 14:31:57 +00:00
|
|
|
| -------------------- |----------|
|
2023-10-15 06:38:15 +00:00
|
|
|
| `OS_VERSION` | bullseye |
|
2022-08-28 13:51:31 +00:00
|
|
|
| `WEB_HTTP_PORT` | 8080 |
|
|
|
|
| `WEB_HTTPS_PORT` | 8443 |
|
|
|
|
| `WEB_LOG_LEVEL` | info |
|
2022-12-05 17:58:23 +00:00
|
|
|
| `BACKEND_HOST` | backend |
|
|
|
|
| `BACKEND_PORT` | 6868 |
|
|
|
|
| `BACKEND_PASSWORD` | *[None]* |
|
|
|
|
| `BACKEND_LOG_LEVEL` | debug |
|
2022-08-28 13:51:31 +00:00
|
|
|
|
|
|
|
**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/ |
|
2022-12-05 17:58:23 +00:00
|
|
|
| docker/volumes/config/ | /home/pi/.config/piscsi/ |
|
2022-08-28 13:51:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
## How To
|
|
|
|
|
|
|
|
### Rebuild Containers
|
|
|
|
|
|
|
|
You should rebuild the container images after checking out a different version of
|
2022-12-05 17:58:23 +00:00
|
|
|
PiSCSI or making changes which affect the environment at build time, e.g.
|
2022-08-28 13:51:31 +00:00
|
|
|
`easyinstall.sh`.
|
|
|
|
|
|
|
|
```
|
|
|
|
docker compose up --build
|
|
|
|
```
|
|
|
|
|
|
|
|
### Open a Shell on a Running Container
|
|
|
|
|
2022-12-04 14:31:57 +00:00
|
|
|
Run the following command, replacing `[CONTAINER]` with `backend` or `web`.
|
2022-08-28 13:51:31 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
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
|
2022-12-05 17:58:23 +00:00
|
|
|
`/home/pi/piscsi/python/` in the `web` container.
|
2022-08-28 13:51:31 +00:00
|
|
|
|
|
|
|
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:
|
2022-12-04 14:31:57 +00:00
|
|
|
web:
|
2022-08-28 13:51:31 +00:00
|
|
|
volumes:
|
2022-12-05 17:58:23 +00:00
|
|
|
- ../python:/home/pi/piscsi/python:delegated
|
2022-08-28 13:51:31 +00:00
|
|
|
```
|
|
|
|
|
2022-12-05 17:58:23 +00:00
|
|
|
### Connect the Web UI to a Real PiSCSI
|
2022-08-28 13:51:31 +00:00
|
|
|
|
2022-12-05 17:58:23 +00:00
|
|
|
This can be useful for testing, but there are some caveats, e.g. the PiSCSI and the
|
2022-08-28 13:51:31 +00:00
|
|
|
web UI will be accessing separate `images` directories.
|
|
|
|
|
|
|
|
```
|
2022-12-05 17:58:23 +00:00
|
|
|
BACKEND_HOST=foo BACKEND_PASSWORD=bar docker compose up
|
|
|
|
```
|