Compare commits

..

26 Commits
v4.33 ... v4.35

Author SHA1 Message Date
Kroese
6218333fec feat: Console mode
* feat: Console mode

* fix: Increase timeout
2023-11-29 20:24:28 +01:00
Kroese
f32d8cbefc feat: Read version from image
feat: Read version from image
2023-11-29 18:13:37 +01:00
Kroese
3e985502c2 docs: Networking 2023-11-29 18:11:19 +01:00
Kroese
ad3132e8c2 docs: Networking 2023-11-29 18:09:02 +01:00
Kroese
830ace0e47 feat: Read version from image 2023-11-29 18:07:41 +01:00
Kroese
1c36893729 build: Set version 2023-11-29 18:05:47 +01:00
Kroese
a87aaab6f7 build: Docker metadata 2023-11-29 18:03:34 +01:00
Kroese
21699b8960 build: Bash
build: Bash
2023-11-29 08:52:15 +01:00
Kroese
87ee25d404 build: Bash 2023-11-29 08:51:52 +01:00
Kroese
c1714f9e6b build: External labels
* build: External labels
2023-11-29 08:26:41 +01:00
Kroese
754765b766 docs: Readme
docs: Readme
2023-11-28 11:51:06 +01:00
Kroese
419f0cf571 docs: Readme 2023-11-28 11:50:47 +01:00
Kroese
55d9ac521f build: Push to mirror
build: Push to mirror
2023-11-26 04:06:16 +01:00
Kroese
3406b3b471 build: Push to mirror 2023-11-26 04:05:58 +01:00
Kroese
f067ad2458 build: Concurrency
build: Concurrency
2023-11-24 04:09:16 +01:00
Kroese
7eafd0a969 build: Concurrency 2023-11-24 04:08:53 +01:00
Kroese
116f30bc0a fix: Cleanup dirs
fix: Cleanup dirs
2023-11-24 01:41:19 +01:00
Kroese
04aa20e836 fix: Cleanup dirs 2023-11-24 01:37:39 +01:00
Kroese
3bf4cc861b docs: Readme
docs: Readme
2023-11-23 21:21:14 +01:00
Kroese
3c6620a3f9 docs: Readme 2023-11-23 21:20:29 +01:00
Kroese
ab0ea5a1d8 docs: Readme
docs: Readme
2023-11-22 19:17:24 +01:00
Kroese
f894ad2686 docs: Readme 2023-11-22 19:16:08 +01:00
Kroese
570340d4e5 fix: Healthcheck start period
fix: Healthcheck start period
2023-11-20 11:46:38 +01:00
Kroese
7dbe706282 fix: Healthcheck start period 2023-11-20 11:45:28 +01:00
Kroese
0c9559f695 fix: Variables
fix: Variables
2023-11-19 20:16:10 +01:00
Kroese
3113e2b64e fix: Variables 2023-11-19 19:56:11 +01:00
8 changed files with 88 additions and 109 deletions

View File

@@ -7,12 +7,16 @@ on:
- master - master
paths-ignore: paths-ignore:
- '**/*.md' - '**/*.md'
- '**/*.yml' - '**/*.yml'
- '.gitignore' - '.gitignore'
- '.dockerignore' - '.dockerignore'
- '.github/**' - '.github/**'
- '.github/workflows/**' - '.github/workflows/**'
concurrency:
group: build
cancel-in-progress: false
jobs: jobs:
shellcheck: shellcheck:
name: Check name: Check
@@ -22,37 +26,32 @@ jobs:
needs: shellcheck needs: shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
actions: write
packages: write packages: write
contents: read contents: read
steps: steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- -
name: Checkout name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- -
name: Prepare Docker build name: Docker metadata
id: prepare id: meta
run: | uses: docker/metadata-action@v5
with:
PLATFORMS="linux/amd64,linux/arm64" context: git
VERSION="${{ vars.MAJOR }}.${{ vars.MINOR }}" images: |
${{ secrets.DOCKERHUB_REPO }}
TAGS=() ghcr.io/${{ github.repository }}
TAGS=("${{ github.repository }}:latest") tags: |
TAGS+=("${{ github.repository }}:${VERSION}") type=raw,value=latest,priority=100
#TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:latest") type=raw,value=${{ vars.MAJOR }}.${{ vars.MINOR }}
#TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:${VERSION}") labels: |
TAGS+=("ghcr.io/${{ github.repository }}:latest") org.opencontainers.image.title=${{ vars.NAME }}
TAGS+=("ghcr.io/${{ github.repository }}:${VERSION}") -
name: Set up Docker Buildx
echo "tags=${TAGS[@]}" >> $GITHUB_OUTPUT uses: docker/setup-buildx-action@v3
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "docker_platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- -
name: Login into Docker Hub name: Login into Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -66,36 +65,28 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build Docker image
run: |
TAGS=(${{ steps.prepare.outputs.tags }})
echo "Build date: ${{ steps.prepare.outputs.build_date }}"
echo "Docker platform: ${{ steps.prepare.outputs.docker_platforms }}"
echo "Tags: ${{ steps.prepare.outputs.tags }}"
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=true" \
--progress=plain \
--build-arg "BUILD_ARG=${GITHUB_RUN_ID}" \
--build-arg "VERSION_ARG=${{ steps.prepare.outputs.version }}" \
--build-arg "DATE_ARG=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
$(printf "%s" "${TAGS[@]/#/ --tag }" ) .
- -
name: Clear Docker credentials name: Build Docker image
run: | uses: docker/build-push-action@v5
rm -f ${HOME}/.docker/config.json with:
context: .
push: true
provenance: false
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.labels }}
build-args: |
VCS_REF=${GITHUB_SHA::8}
VERSION_ARG=${{ steps.meta.outputs.version }}
- -
name: Create a release name: Create a release
uses: action-pack/github-release@v2 uses: action-pack/github-release@v2
env: env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
with: with:
tag: "v${{ steps.prepare.outputs.version }}" tag: "v${{ steps.meta.outputs.version }}"
title: "v${{ steps.prepare.outputs.version }}" title: "v${{ steps.meta.outputs.version }}"
- -
name: Increment version variable name: Increment version variable
uses: action-pack/bump@v2 uses: action-pack/bump@v2

View File

@@ -33,7 +33,7 @@ RUN apt-get update && apt-get -y upgrade && \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY src/*.sh /run/ COPY ./src /run/
COPY --from=builder /qemu-host.bin /run/host.bin COPY --from=builder /qemu-host.bin /run/host.bin
RUN chmod +x /run/*.sh && chmod +x /run/*.bin RUN chmod +x /run/*.sh && chmod +x /run/*.bin
@@ -49,20 +49,9 @@ ENV CPU_CORES "1"
ENV DISK_SIZE "16G" ENV DISK_SIZE "16G"
ENV RAM_SIZE "512M" ENV RAM_SIZE "512M"
ARG DATE_ARG=""
ARG BUILD_ARG=0
ARG VERSION_ARG="0.0" ARG VERSION_ARG="0.0"
ENV VERSION=$VERSION_ARG RUN echo "$VERSION_ARG" > /run/version
LABEL org.opencontainers.image.licenses="MIT" HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh
LABEL org.opencontainers.image.title="Virtual DSM"
LABEL org.opencontainers.image.created=${DATE_ARG}
LABEL org.opencontainers.image.revision=${BUILD_ARG}
LABEL org.opencontainers.image.version=${VERSION_ARG}
LABEL org.opencontainers.image.source="https://github.com/vdsm/virtual-dsm/"
LABEL org.opencontainers.image.url="https://hub.docker.com/r/vdsm/virtual-dsm/"
LABEL org.opencontainers.image.description="Virtual DSM in a docker container"
HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"] ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]

View File

@@ -9,6 +9,7 @@ services:
RAM_SIZE: "512M" RAM_SIZE: "512M"
devices: devices:
- /dev/kvm - /dev/kvm
- /dev/net/tun
- /dev/vhost-net - /dev/vhost-net
device_cgroup_rules: device_cgroup_rules:
- 'c *:* rwm' - 'c *:* rwm'

View File

@@ -10,6 +10,7 @@
[![Pulls]][hub_url] [![Pulls]][hub_url]
</div></h1> </div></h1>
Virtual DSM in a docker container. Virtual DSM in a docker container.
## Features ## Features
@@ -33,7 +34,6 @@ services:
DISK_SIZE: "16G" DISK_SIZE: "16G"
devices: devices:
- /dev/kvm - /dev/kvm
- /dev/vhost-net
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
ports: ports:
@@ -74,6 +74,19 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
Replace the example path `/home/user/data` with the desired storage folder. Replace the example path `/home/user/data` with the desired storage folder.
* ### How do I add multiple disks?
To create additional disks, modify your compose file like this:
```yaml
environment:
DISK2_SIZE: "32G"
DISK3_SIZE: "64G"
volumes:
- /home/example:/storage2
- /mnt/data/example:/storage3
```
* ### How do I change the space reserved by the virtual disk? * ### How do I change the space reserved by the virtual disk?
By default, the entire disk space is reserved in advance. To create a growable disk that only reserves the space that is actually used, add the following environment variable: By default, the entire disk space is reserved in advance. To create a growable disk that only reserves the space that is actually used, add the following environment variable:
@@ -84,32 +97,6 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
``` ```
Keep in mind that this will not affect any of your existing disks, it only applies to newly created disks. Keep in mind that this will not affect any of your existing disks, it only applies to newly created disks.
* ### How do I add multiple disks?
To mount extra volumes, modify your compose file like this:
```yaml
environment:
DISK2_SIZE: "32G"
DISK3_SIZE: "64G"
volumes:
- /home/example2:/storage2
- /home/example3:/storage3
```
Additionally, it's also possible to passthrough raw disk devices like this:
```yaml
environment:
DEVICE2: "/dev/vdc1"
DEVICE3: "/dev/vdc2"
devices:
- /dev/vdc1
- /dev/vdc2
```
Please beware that any pre-existing partitions and data on those devices will be wiped.
* ### How do I increase the amount of CPU or RAM? * ### How do I increase the amount of CPU or RAM?
@@ -185,17 +172,6 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
Please note that even if you don't need DHCP, it's still recommended to enable this feature as it prevents NAT issues and increases performance by using a `macvtap` interface. Please note that even if you don't need DHCP, it's still recommended to enable this feature as it prevents NAT issues and increases performance by using a `macvtap` interface.
* ### How do I install a specific version of vDSM?
By default, version 7.2.1 will be installed, but if you prefer an older version, you can add its download URL to your compose file as follows:
```yaml
environment:
URL: "https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
```
With this method, it is even possible to switch between different versions while keeping all your file data intact.
* ### How do I passthrough my GPU? * ### How do I passthrough my GPU?
To passthrough your Intel GPU, add the following lines to your compose file: To passthrough your Intel GPU, add the following lines to your compose file:
@@ -208,7 +184,18 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
``` ```
This can be used to enable the facial recognition function in Synology Photos for example. This can be used to enable the facial recognition function in Synology Photos for example.
* ### How do I install a specific version of vDSM?
By default, version 7.2.1 will be installed, but if you prefer an older version, you can add its download URL to your compose file as follows:
```yaml
environment:
URL: "https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
```
With this method, it is even possible to switch between different versions while keeping all your file data intact.
* ### What are the differences compared to the standard DSM? * ### What are the differences compared to the standard DSM?
There are only two minor differences: the Virtual Machine Manager package is not available, and Surveillance Station will not include any free licenses. There are only two minor differences: the Virtual Machine Manager package is not available, and Surveillance Station will not include any free licenses.

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
echo " Starting Virtual DSM for Docker v${VERSION}..." echo " Starting Virtual DSM for Docker v$(</run/version)..."
echo " For support visit https://github.com/vdsm/virtual-dsm/" echo " For support visit https://github.com/vdsm/virtual-dsm/"
cd /run cd /run
@@ -17,6 +17,11 @@ cd /run
trap - ERR trap - ERR
if [[ "${CONSOLE}" == [Yy]* ]]; then
exec qemu-system-x86_64 -pidfile "${QEMU_PID}" ${ARGS:+ $ARGS}
exit $?
fi
set -m set -m
( (
[[ "${DEBUG}" == [Yy1]* ]] && info "$VERS" && set -x [[ "${DEBUG}" == [Yy1]* ]] && info "$VERS" && set -x

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
: ${DEV:='Y'} # Controls whether device nodes are created. : ${URL:=''} # URL of the PAT file to be downloaded.
: ${DEV:='Y'} # Controls whether device nodes are created.
if [ -f "$STORAGE"/dsm.ver ]; then if [ -f "$STORAGE"/dsm.ver ]; then
BASE=$(cat "${STORAGE}/dsm.ver") BASE=$(cat "${STORAGE}/dsm.ver")
@@ -10,7 +11,6 @@ else
BASE="DSM_VirtualDSM_42962" BASE="DSM_VirtualDSM_42962"
fi fi
: ${URL:=''}
[ -n "$URL" ] && BASE=$(basename "$URL" .pat) [ -n "$URL" ] && BASE=$(basename "$URL" .pat)
if [[ -f "$STORAGE/$BASE.boot.img" ]] && [[ -f "$STORAGE/$BASE.system.img" ]]; then if [[ -f "$STORAGE/$BASE.boot.img" ]] && [[ -f "$STORAGE/$BASE.system.img" ]]; then
@@ -112,12 +112,12 @@ if [ -f "${RDC}" ]; then
if [[ "${DEV}" == [Nn]* ]]; then if [[ "${DEV}" == [Nn]* ]]; then
# Exclude dev/ from cpio extract # Exclude dev/ from cpio extract
{ (cd "$TMP" && cpio -it < "$TMP/rd" | grep -Ev 'dev/' | while read -r entry; do cpio -idm "$entry" < "$TMP/rd" 2>/dev/null; done); rc=$?; } || : { (cd "$TMP" && cpio -it < "$TMP/rd" | grep -Ev 'dev/' | while read -r entry; do cpio -idm "$entry" < "$TMP/rd" 2>/dev/null; done); rc=$?; } || :
(( rc != 0 )) && error "Failed to extract $RDC, reason $rc" && exit 92
else else
{ (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || : { (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || :
(( rc != 0 )) && error "Failed to cpio $RDC, reason $rc" && exit 92
fi fi
(( rc != 0 )) && error "Failed to extract $RDC, reason $rc" && exit 92
mkdir -p /run/extract mkdir -p /run/extract
for file in $TMP/usr/lib/libcurl.so.4 \ for file in $TMP/usr/lib/libcurl.so.4 \
$TMP/usr/lib/libmbedcrypto.so.5 \ $TMP/usr/lib/libmbedcrypto.so.5 \

View File

@@ -12,6 +12,7 @@ trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
: ${GPU:='N'} # Enable GPU passthrough : ${GPU:='N'} # Enable GPU passthrough
: ${DEBUG:='N'} # Enable debugging mode : ${DEBUG:='N'} # Enable debugging mode
: ${CONSOLE:='N'} # Start in console mode
: ${ALLOCATE:='Y'} # Preallocate diskspace : ${ALLOCATE:='Y'} # Preallocate diskspace
: ${ARGUMENTS:=''} # Extra QEMU parameters : ${ARGUMENTS:=''} # Extra QEMU parameters
: ${CPU_CORES:='1'} # Amount of CPU cores : ${CPU_CORES:='1'} # Amount of CPU cores
@@ -25,15 +26,20 @@ MINOR=$(uname -r | cut -d '.' -f2)
ARCH=$(dpkg --print-architecture) ARCH=$(dpkg --print-architecture)
VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1) VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1)
# Check folder
STORAGE="/storage"
[ ! -d "$STORAGE" ] && error "Storage folder (${STORAGE}) not found!" && exit 13
# Cleanup files # Cleanup files
rm -f /run/dsm.url rm -f /run/dsm.url
rm -f /run/qemu.pid rm -f /run/qemu.pid
rm -f /run/qemu.count rm -f /run/qemu.count
# Check folder # Cleanup dirs
STORAGE="/storage" rm -rf /tmp/dsm
[ ! -d "$STORAGE" ] && error "Storage folder (${STORAGE}) not found!" && exit 13 rm -rf "$STORAGE/tmp"
return 0 return 0

View File

@@ -48,7 +48,7 @@ sleep 0.2
while ! nc -z -w1 127.0.0.1 2210 > /dev/null 2>&1; do while ! nc -z -w1 127.0.0.1 2210 > /dev/null 2>&1; do
sleep 0.1 sleep 0.1
cnt=$((cnt + 1)) cnt=$((cnt + 1))
(( cnt > 20 )) && error "Failed to connect to qemu-host.." && exit 58 (( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 58
done done
cnt=0 cnt=0
@@ -56,7 +56,7 @@ cnt=0
while ! nc -z -w1 127.0.0.1 12345 > /dev/null 2>&1; do while ! nc -z -w1 127.0.0.1 12345 > /dev/null 2>&1; do
sleep 0.1 sleep 0.1
cnt=$((cnt + 1)) cnt=$((cnt + 1))
(( cnt > 20 )) && error "Failed to connect to qemu-host.." && exit 59 (( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 59
done done
# Configure serial ports # Configure serial ports