Compare commits

...

5 commits

5 changed files with 63 additions and 32 deletions

View file

@ -3,7 +3,7 @@
############
ARG NODE_VERSION=lts
ARG PYTHON_VERSION=3.12
ARG PYTHON_VERSION=3.12-slim
FROM node:${NODE_VERSION} AS build-ui
# env setup
@ -57,6 +57,9 @@ RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive; \
apt-get update; apt-get install --yes --no-install-recommends \
libmagic1 \
# need to build hiredis
gcc \
libc-dev \
; rm -rf /var/lib/apt/lists/*; \
\
# install ovdashboard_api

View file

@ -54,12 +54,12 @@ It is also heavily advisable that you log into your device using SSH, so you sho
### Install Base System
`OVDashboard` is designed to run on a `DietPi` installation. Full installation documentation is available [at dietpi.com](https://dietpi.com/docs/deploy/). To quickly get up and running:
OVDashboard is designed to run on a `DietPi` installation. Full installation documentation is available [at dietpi.com](https://dietpi.com/docs/deploy/). To quickly get up and running:
1. Download Image from [dietpi.com/#download](https://dietpi.com/#download)
1. Uncompress Image and flash onto SD card you might need "7zip", "balenaEtcher" and/or other tools
1. Check the SD card, open "dietpi.txt" and change some options (full documentation [here](https://dietpi.com/docs/usage/#options-within-the-file)):
- For WiFi, use `AUTO_SETUP_NET_WIFI_ENABLED=1` and `AUTO_SETUP_NET_WIFI_COUNTRY_CODE=DE`, and also check "dietpi-wifi.txt"
- For WiFi, use `AUTO_SETUP_NET_WIFI_ENABLED=1` and `AUTO_SETUP_NET_WIFI_COUNTRY_CODE=DE`, and also edit "dietpi-wifi.txt" like `aWIFI_SSID[0]='OV WLAN'` and `aWIFI_KEY[0]='Strong_pa55w0rd'`
- System options, e.g. `AUTO_SETUP_AUTOMATED=1`, `AUTO_SETUP_NET_HOSTNAME=OVDashboard`, `AUTO_SETUP_GLOBAL_PASSWORD=dietpi`, `AUTO_SETUP_LOCALE=de_DE.UTF-8`, `AUTO_SETUP_KEYBOARD_LAYOUT=de`, `AUTO_SETUP_TIMEZONE=Europe/Berlin`, `CONFIG_SERIAL_CONSOLE_ENABLE=0`
1. Be sure to at least change the password (and remember it 🙂️), then put the SD card into your device and boot it. Let the first time setup finish, it will take a bit. It will let you know when it is done!
1. Log into your device using SSH. By default, that's user name `root` and password `dietpi`
@ -83,19 +83,32 @@ This can all be done after logging into your prepared device:
> - The installer will ask for the connected screen's resolution. The default values should be fine, you can likely just hit **Return** here.
> - The installer will ask for "display languages". This will affect some details on the connected screen. <br />
For German, enter `de-DE,de,en-US,en`.
> - The installer will ask you to "review the Docker Compose file" before starting the services. You will want to edit `WEBDAV__HOST`, `WEBDAV__USERNAME` and `WEBDAV__PASSWORD` at least. <br />
Refer to [the "Settings"](TODO) for the full list of options.
Afterwards, reboot your device (`reboot` in the terminal). Your OVDashboard should be working now.
Afterwards, reboot your device (`reboot` in the terminal).
If the install was successful, your OVDashboard should be showing up on the connected screen after rebooting.
> You will also be able to view your OVDashboard on any webbrowser in your network using `http://<device-ip>`. <br />
> The device IP is displayed in the lower right region of the OVDashboard.
For a better understanding of your newly created OVDashboard, refer to the [about section](#about-the-default-ovdashboard-deployment).
## Updates, upgrades
<!-- TODO `/opt/ovdashboard` -->
## Configuration
### "Config" in your WebDAV share: `config.txt`
<!-- TODO -->
### "Settings" on your Device: `/opt/ovdashboard/docker-compose.yml`
<!-- TODO -->
## Updating your Device
<!-- TODO `/opt/ovdashboard` -->
## Setup for development and contribution
Refer to the specific README files for [the API](./api/README.md) and [the UI](./ui/README.md) to contribute to one of those sub-projects.
@ -103,17 +116,9 @@ Refer to the specific README files for [the API](./api/README.md) and [the UI](.
## About the "default" OVDashboard deployment
The default deployment is made up of three parts: The **installer** runs once, prepares your device for OVDashboard usage and deploys the **server**.
Running the installer script carries out the following actions:
The **server** will then run continuously and make OVDashboard available as a web application in your network.
Also, a browser is installed to display the OVDashboard using your device.
### The OVDashboard installer will:
- install and set up Docker, Docker Compose and Chromium-Browser
- create the OVDashboard Compose project at `/opt/ovdashboard`
- get a `docker` image from [`code.yavook.de`](https://code.yavook.de/OEKZident.de/-/packages/container/ovdashboard) containing the OVDashboard server
- set up your device to auto-run Chromium in "kiosk" mode to display the local OVDashboard
- auto-hide your mouse cursor
- install Chromium-Browser, Docker and Docker Compose
- create the OVDashboard project at `/opt/ovdashboard`
- start the OVDashboard project, this deploys the `ovdashboard` service from [`code.yavook.de`](https://code.yavook.de/OEKZident.de/-/packages/container/ovdashboard) and a [`redis` instance](https://redis.io/) to your device
- set up your device to auto-boot into Chromium "kiosk" mode to display the local OVDashboard

View file

@ -63,13 +63,23 @@ async def find_images_by_prefix(
response_class=StreamingResponse,
)
async def get_image_by_prefix(
cfg: Config = Depends(get_config),
remote_path: str = Depends(RP_IMAGE),
name: str = Depends(LM_IMAGE.getter.func),
) -> StreamingResponse:
cfg = await get_config()
img = Image.open(BytesIO(await WebDAV.read_bytes(f"{remote_path}/{name}")))
img_buffer = BytesIO()
width, height = img.size
target_height = cfg.image.height
target_width = int(width * target_height / height)
img = img.resize(
size=(target_width, target_height),
resample=Image.LANCZOS,
)
img.save(img_buffer, **cfg.image.save_params)
img_buffer.seek(0)

View file

@ -6,13 +6,12 @@ script_dir="$( dirname "${script}" )"
# shellcheck disable=SC1091
. "${script_dir}/check_version"
install_version="$( \
grep '^ovd_version' "${script_dir}/../install.sh" \
| sed -E 's/^ovd_version[^0-9]*((0|[1-9][0-9]*)[0-9\.]*[0-9]).*$/\1/'
)"
# defined in `check_version` script
# shellcheck disable=SC2154
echo "${git_version}" >/dev/null
docker buildx build \
--pull --push \
--tag "code.yavook.de/oekzident.de/ovdashboard:${install_version}" \
--tag "code.yavook.de/oekzident.de/ovdashboard:${git_version}" \
--platform "linux/amd64,linux/arm64" \
"${script_dir}/../.."

View file

@ -67,18 +67,32 @@ echo '{"intl":{"selected_languages":"'"${display_lang}"'"}}' \
mkdir -p /opt/ovdashboard
# compose file
# prepare compose project
curl \
--proto "=https" --tlsv1.2 -sSf \
--output "/opt/ovdashboard/docker-compose.yml" \
"https://code.yavook.de/OEKZident.de/ovdashboard/raw/tag/v${ovd_version}/deploy/docker-compose.yml"
echo "Please review the Docker Compose file before continuing! [press Enter]"
read -r _ENTER
docker compose \
--project-directory "/opt/ovdashboard" \
pull
# review compose file
echo "Please review the Docker Compose file before continuing! [hit Return]"
read -r _RETURN
nano "/opt/ovdashboard/docker-compose.yml"
# start server
docker compose \
--file "/opt/ovdashboard/docker-compose.yml" \
--project-directory "/opt/ovdashboard" \
--project-name "ovdashboard" \
up --detach
############
# finalize #
############
echo ""
echo "#########################"
echo "# OVDashboard Installed #"
echo "#########################"
echo ""
echo "You can now reboot your device."