Lots of init changes

This commit is contained in:
thespad 2026-03-27 11:08:12 +00:00
parent 1012fc0fe9
commit 3ee94b83d6
No known key found for this signature in database
15 changed files with 81 additions and 31 deletions

View file

@ -28,7 +28,7 @@ RUN \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
printf "Package: docker-ce docker-ce-cli docker-ce-rootless-extras\nPin: version 5:28.* \nPin-Priority: 1001" > /etc/apt/preferences.d/docker && \
printf "Package: docker-ce docker-ce-cli docker-ce-rootless-extras\nPin: version 5:29.* \nPin-Priority: 1001" > /etc/apt/preferences.d/docker && \
apt-get install -y --no-install-recommends \
btrfs-progs \
build-essential \
@ -59,13 +59,13 @@ RUN \
https://raw.githubusercontent.com/moby/moby/master/hack/dind && \
chmod +x /usr/local/bin/dind && \
echo 'hosts: files dns' > /etc/nsswitch.conf && \
echo "**** setup wizard ****" && \
mkdir -p /wizard && \
if [ -z ${KASM_VERSION+x} ]; then \
KASM_VERSION=$(curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases/latest' \
| jq -r '.name'); \
fi && \
echo "${KASM_VERSION}" > /version.txt && \
echo "**** add wizard ****" && \
curl -o \
/tmp/wizard.tar.gz -L \
# "https://github.com/kasmtech/kasm-install-wizard/archive/refs/tags/${KASM_VERSION}.tar.gz" && \
@ -77,7 +77,7 @@ RUN \
sed -i "/installFlags = \[.*/a \ installFlags.push('-O');" /wizard/index.js && \
cd /wizard && \
npm install && \
echo "**** add installer ****" && \
echo "**** add image definitions ****" && \
curl -o \
/tmp/images.tar.gz -L \
#"https://kasm-ci.s3.amazonaws.com/${KASM_VERSION}-images-combined.tar.gz" && \
@ -85,10 +85,10 @@ RUN \
tar xf \
/tmp/images.tar.gz -C \
/ && \
echo "**** add installer ****" && \
curl -o \
/tmp/kasm.tar.gz -L \
# "https://github.com/kasmtech/kasm-install-wizard/releases/download/${KASM_VERSION}/kasm_release.tar.gz" && \
"https://kasm-static-content.s3.amazonaws.com/kasm_release_1.18.1.tar.gz" && \
"https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" && \
tar xf \
/tmp/kasm.tar.gz -C \
/ && \
@ -96,11 +96,25 @@ RUN \
sed -i \
'/alembic_version/s/.*/alembic_version: '${ALVERSION}'/' \
/kasm_release/conf/database/seed_data/default_images_a* && \
# Don't check for open ports
sed -i 's/-N -e -H/-N -B -e -H/g' /kasm_release/upgrade.sh && \
echo "exit 0" > /kasm_release/install_dependencies.sh && \
# Add our customisations
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.proxy.volumes += "/kasm_release/www/img/thumbnails:/srv/www/img/thumbnails"' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.proxy.depends_on = {"kasm_manager":{"condition": "service_healthy"},"kasm_api":{"condition": "service_healthy"},"kasm_agent":{"condition": "service_started"},"kasm_guac":{"condition": "service_started"},"kasm_rdp_https_gateway":{"condition": "service_started"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_manager.depends_on = {"db":{"condition": "service_healthy"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_api.depends_on = {"db":{"condition": "service_healthy"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_rdp_https_gateway.depends_on = {"proxy":{"condition": "service_started"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
echo "**** copy assets ****" && \
cp \
/kasm_release/www/img/thumbnails/*.png /kasm_release/www/img/thumbnails/*.svg \

View file

@ -28,7 +28,7 @@ RUN \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
printf "Package: docker-ce docker-ce-cli docker-ce-rootless-extras\nPin: version 5:28.* \nPin-Priority: 1001" > /etc/apt/preferences.d/docker && \
printf "Package: docker-ce docker-ce-cli docker-ce-rootless-extras\nPin: version 5:29.* \nPin-Priority: 1001" > /etc/apt/preferences.d/docker && \
apt-get install -y --no-install-recommends \
btrfs-progs \
build-essential \
@ -59,13 +59,13 @@ RUN \
https://raw.githubusercontent.com/moby/moby/master/hack/dind && \
chmod +x /usr/local/bin/dind && \
echo 'hosts: files dns' > /etc/nsswitch.conf && \
echo "**** setup wizard ****" && \
mkdir -p /wizard && \
if [ -z ${KASM_VERSION+x} ]; then \
KASM_VERSION=$(curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases/latest' \
| jq -r '.name'); \
fi && \
echo "${KASM_VERSION}" > /version.txt && \
echo "**** add wizard ****" && \
curl -o \
/tmp/wizard.tar.gz -L \
# "https://github.com/kasmtech/kasm-install-wizard/archive/refs/tags/${KASM_VERSION}.tar.gz" && \
@ -77,7 +77,7 @@ RUN \
sed -i "/installFlags = \[.*/a \ installFlags.push('-O');" /wizard/index.js && \
cd /wizard && \
npm install && \
echo "**** add installer ****" && \
echo "**** add image definitions ****" && \
curl -o \
/tmp/images.tar.gz -L \
#"https://kasm-ci.s3.amazonaws.com/${KASM_VERSION}-images-combined.tar.gz" && \
@ -85,10 +85,10 @@ RUN \
tar xf \
/tmp/images.tar.gz -C \
/ && \
echo "**** add installer ****" && \
curl -o \
/tmp/kasm.tar.gz -L \
# "https://github.com/kasmtech/kasm-install-wizard/releases/download/${KASM_VERSION}/kasm_release.tar.gz" && \
"https://kasm-static-content.s3.amazonaws.com/kasm_release_1.18.1.tar.gz" && \
"https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" && \
tar xf \
/tmp/kasm.tar.gz -C \
/ && \
@ -96,11 +96,25 @@ RUN \
sed -i \
'/alembic_version/s/.*/alembic_version: '${ALVERSION}'/' \
/kasm_release/conf/database/seed_data/default_images_a* && \
# Don't check for open ports
sed -i 's/-N -e -H/-N -B -e -H/g' /kasm_release/upgrade.sh && \
echo "exit 0" > /kasm_release/install_dependencies.sh && \
# Add our customisations
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.proxy.volumes += "/kasm_release/www/img/thumbnails:/srv/www/img/thumbnails"' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.proxy.depends_on = {"kasm_manager":{"condition": "service_healthy"},"kasm_api":{"condition": "service_started"},"kasm_agent":{"condition": "service_started"},"kasm_guac":{"condition": "service_started"},"kasm_rdp_https_gateway":{"condition": "service_started"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_manager.depends_on = {"db":{"condition": "service_healthy"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_api.depends_on = {"db":{"condition": "service_healthy"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
/kasm_release/bin/utils/yq_$(uname -m) -i \
'.services.kasm_rdp_https_gateway.depends_on = {"proxy":{"condition": "service_started"},"rdp_gateway":{"condition": "service_healthy"}}' \
/kasm_release/docker/docker-compose-all.yaml && \
echo "**** copy assets ****" && \
cp \
/kasm_release/www/img/thumbnails/*.png /kasm_release/www/img/thumbnails/*.svg \

View file

@ -71,9 +71,11 @@ Access the installation wizard at https://`your ip`:3000 and follow the instruct
Currently Synology systems are not supported due to them blocking CPU scheduling in their Kernel.
### Updating KASM
### Upgrading KASM
In order to update kasm, first make sure you are using the latest docker image, and then perform the in app update in the admin panel. Docker image update and recreation of container alone won't update kasm.
In order to upgrade kasm, first make sure you are using the latest docker image, and then perform the in app update in the admin panel. Docker image update and recreation of container alone won't upgrade kasm.
Following the upgrade, you will need to update any workspace image tags to match the new version.
### GPU Support
@ -127,6 +129,7 @@ services:
ports:
- 3000:3000
- 443:443
stop_grace_period: "90s" #optional
restart: unless-stopped
```
@ -147,6 +150,7 @@ docker run -d \
-v /path/to/kasm/profiles:/profiles `#optional` \
-v /dev/input:/dev/input `#optional` \
-v /run/udev/data:/run/udev/data `#optional` \
--stop-timeout="90s" `#optional` \
--restart unless-stopped \
lscr.io/linuxserver/kasm:latest
```
@ -167,6 +171,7 @@ Containers are configured using parameters passed at runtime (such as those abov
| `-v /profiles` | Optionally specify a path for persistent profile storage. |
| `-v /dev/input` | Optional for gamepad support. |
| `-v /run/udev/data` | Optional for gamepad support. |
| `--stop-timeout=` | Increase container shutdown delay to give Kasm services time to stop cleanly. |
| `--security-opt apparmor=rootlesskit` | Some hosts require this on top of privileged for namespacing to work properly inside the DinD layer. |
## Environment variables from files (Docker secrets)
@ -313,7 +318,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **22.03.26:** - Update for 1.18.1 release. Use rolling service images. Update docker pin to v29.
* **22.03.26:** - Update for 1.18.1 release. Use rolling service images.
* **13.11.25:** - Pin docker to v28 to avoid API deprecation issues.
* **22.10.25:** - Update for 1.18.0 release.
* **08.06.25:** - Deprecate develop branch.

View file

@ -42,6 +42,8 @@ opt_param_volumes:
opt_security_opt_param: true
opt_security_opt_param_vars:
- {run_var: "apparmor=rootlesskit", compose_var: "apparmor:rootlesskit", desc: "Some hosts require this on top of privileged for namespacing to work properly inside the DinD layer."}
opt_custom_params:
- {name: "stop-timeout", name_compose: "stop_grace_period", value: "90s", desc: "Increase container shutdown delay to give Kasm services time to stop cleanly."}
unraid_template: false
privileged: true
# application setup block
@ -60,9 +62,11 @@ app_setup_block: |
Currently Synology systems are not supported due to them blocking CPU scheduling in their Kernel.
### Updating KASM
### Upgrading KASM
In order to update kasm, first make sure you are using the latest docker image, and then perform the in app update in the admin panel. Docker image update and recreation of container alone won't update kasm.
In order to upgrade kasm, first make sure you are using the latest docker image, and then perform the in app update in the admin panel. Docker image update and recreation of container alone won't upgrade kasm.
Following the upgrade, you will need to update any workspace image tags to match the new version.
### GPU Support

View file

@ -8,6 +8,11 @@ fi
# Workaround for running in a rootless docker environment
sed -i '/set -e/d' /etc/init.d/docker
# Clean up old socket
if [[ -S /var/run/docker.sock ]]; then
rm -f /var/run/docker.sock
fi
# Login to Dockerhub
if [[ -n "${DOCKER_HUB_USERNAME}" ]]; then
docker login --username "${DOCKER_HUB_USERNAME}" --password "${DOCKER_HUB_PASSWORD}"

View file

@ -1,14 +1,3 @@
#!/usr/bin/with-contenv bash
_term() {
if [ -f "/opt/kasm/bin/stop" ]; then
echo "Caught SIGTERM signal!"
echo "Stopping Kasm Containers"
/opt/kasm/bin/stop
pid=$(pidof stop)
# terminate when the stop process dies
tail --pid=${pid} -f /dev/null
fi
}
exec /usr/local/bin/dockerd-entrypoint.sh -l error --data-root /opt/docker

View file

@ -1,11 +1,8 @@
#!/usr/bin/with-contenv bash
# Wait for docker to be up
while true; do
if [[ -S "/var/run/docker.sock" ]]; then
break
fi
sleep 1
while [[ ! -S /var/run/docker.sock ]]; do
sleep 1
done
# Don't do anything if wizard is disabled

View file

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-kasm/finish

View file

@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
/opt/kasm/bin/stop

View file

@ -0,0 +1,15 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
while [[ ! -S /var/run/docker.sock ]]; do
sleep 1
done
# Stop any running containers that shouldn't be
docker ps -q | xargs docker stop &> /dev/null
if [[ -f /opt/kasm/bin/start ]]; then
/opt/kasm/bin/start
else
sleep infinity
fi

View file

@ -0,0 +1 @@
oneshot

View file

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-kasm/run