Merge branch 'bugfix/KASM-7566-add_obsidian_workspace_develop' into 'develop'

Resolve KASM-7566 "Bugfix/ add obsidian workspace develop"

Closes KASM-7566

See merge request kasm-technologies/internal/workspaces-images!322
This commit is contained in:
Richard Koliser 2025-09-02 23:00:11 +00:00
commit 09e6b2d9b2
7 changed files with 194 additions and 0 deletions

View file

@ -126,6 +126,15 @@ multiImages:
- src/ubuntu/install/chromium/**
- src/ubuntu/install/nessus/**
- src/ubuntu/install/cleanup/**
- name: obsidian
runset: set-a
singleapp: true
base: core-ubuntu-jammy
dockerfile: dockerfile-kasm-obsidian
changeFiles:
- dockerfile-kasm-obsidian
- src/ubuntu/install/obsidian/**
- src/ubuntu/install/chrome/**
- name: opensuse-15-desktop
runset: set-a
singleapp: false

41
dockerfile-kasm-obsidian Normal file
View file

@ -0,0 +1,41 @@
ARG BASE_TAG="develop"
ARG BASE_IMAGE="core-ubuntu-jammy"
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
# FROM kasmweb/core-ubuntu-jammy:1.17.0-rolling-daily
USER root
ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME
######### Customize Container Here ###########
# Install Obsidian
COPY ./src/ubuntu/install/obsidian $INST_SCRIPTS/obsidian/
RUN bash $INST_SCRIPTS/obsidian/install_obsidian.sh && rm -rf $INST_SCRIPTS/obsidian/
# Install Google Chrome
COPY ./src/ubuntu/install/chrome $INST_SCRIPTS/chrome/
RUN bash $INST_SCRIPTS/chrome/install_chrome.sh && rm -rf $INST_SCRIPTS/chrome/
COPY ./src/ubuntu/install/obsidian/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh
RUN chmod 755 $STARTUPDIR/custom_startup.sh
# Update the desktop environment to be optimized for a single application
RUN cp $HOME/.config/xfce4/xfconf/single-application-xfce-perchannel-xml/* $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/
RUN cp /usr/share/backgrounds/bg_kasm.png /usr/share/backgrounds/bg_default.png
RUN apt-get remove -y xfce4-panel
######### End Customizations ###########
RUN chown 1000:0 $HOME
ENV HOME /home/kasm-user
WORKDIR $HOME
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
USER 1000

7
docs/obsidian/README.md Normal file
View file

@ -0,0 +1,7 @@
# About This Image
This Image contains a browser-accessible version of [Obsidian](https://obsidian.md/).
![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/image-screenshots/obsidian.png "Image Screenshot"

9
docs/obsidian/demo.txt Normal file
View file

@ -0,0 +1,9 @@
# Live Demo
<a href="https://app.kasmweb.com/#/cast/9365782355" target="_blank"><img src="https://info.kasmweb.com/hubfs/dockerhub/GIFs/obsidian.gif" width="640" height="360"></a>
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/9365782355" target="_blank">Live Demo</a>.
<a href="https://app.kasmweb.com/#/cast/9365782355" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/casting-buttons/obsidian.png" width="300" height="104"></a>
&lowast;*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.*

View file

@ -0,0 +1 @@
Obsidian for Kasm Workspaces

View file

@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -ex
START_COMMAND="/opt/Obsidian/squashfs-root/launcher"
PGREP="obsidian"
export MAXIMIZE="true"
export MAXIMIZE_NAME="Obsidian"
MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh
DEFAULT_ARGS=""
ARGS=${APP_ARGS:-$DEFAULT_ARGS}
options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit
eval set -- "$options"
while [[ $1 != -- ]]; do
case $1 in
-g|--go) GO='true'; shift 1;;
-a|--assign) ASSIGN='true'; shift 1;;
-u|--url) OPT_URL=$2; shift 2;;
*) echo "bad option: $1" >&2; exit 1;;
esac
done
shift
# Process non-option arguments.
for arg; do
echo "arg! $arg"
done
FORCE=$2
kasm_exec() {
if [ -n "$OPT_URL" ] ; then
URL=$OPT_URL
elif [ -n "$1" ] ; then
URL=$1
fi
# Since we are execing into a container that already has the browser running from startup,
# when we don't have a URL to open we want to do nothing. Otherwise a second browser instance would open.
if [ -n "$URL" ] ; then
/usr/bin/filter_ready
/usr/bin/desktop_ready
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $ARGS $OPT_URL
else
echo "No URL specified for exec command. Doing nothing."
fi
}
kasm_startup() {
if [ -n "$KASM_URL" ] ; then
URL=$KASM_URL
elif [ -z "$URL" ] ; then
URL=$LAUNCH_URL
fi
if [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ; then
echo "Entering process startup loop"
set +x
while true
do
if ! pgrep -x $PGREP > /dev/null
then
/usr/bin/filter_ready
/usr/bin/desktop_ready
set +e
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $ARGS $URL
set -e
fi
sleep 1
done
set -x
fi
}
if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then
kasm_exec
else
kasm_startup
fi

View file

@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -ex
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
apt-get update
apt-get install -y jq
# Use GitHub API to get latest stable release of Obsidian
LATEST_RELEASE=$(curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest | jq -r .tag_name)
# Use GitHub API to get download URL for amd64
if [ "$ARCH" == "amd64" ]; then
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest | jq -r '.assets[] | select(.name | test("AppImage$") and (contains("arm64") | not)) | .browser_download_url')
else
apt-get install -y zlib1g-dev libfuse2
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest | jq -r '.assets[] | select(.name | test("arm64") and test("AppImage$")) | .browser_download_url')
fi
# Download App Image
mkdir -p /opt/Obsidian
cd /opt/Obsidian
wget -q $DOWNLOAD_URL -O Obsidian.AppImage
chmod +x Obsidian.AppImage
# Extract and create launcher
./Obsidian.AppImage --appimage-extract
rm Obsidian.AppImage
chown -R 1000:1000 /opt/Obsidian
cat >/opt/Obsidian/squashfs-root/launcher <<EOL
#!/usr/bin/env bash
export APPDIR=/opt/Obsidian/squashfs-root
/opt/Obsidian/squashfs-root/AppRun --no-sandbox "$@"
EOL
chmod +x /opt/Obsidian/squashfs-root/launcher
sed -i 's@^Exec=.*@Exec=/opt/Obsidian/squashfs-root/launcher@g' /opt/Obsidian/squashfs-root/obsidian.desktop
sed -i 's@^Icon=.*@Icon=/opt/Obsidian/squashfs-root/obsidian.png@g' /opt/Obsidian/squashfs-root/obsidian.desktop
cp /opt/Obsidian/squashfs-root/obsidian.desktop $HOME/Desktop
cp /opt/Obsidian/squashfs-root/obsidian.desktop /usr/share/applications/
chmod +x $HOME/Desktop/obsidian.desktop
chmod +x /usr/share/applications/obsidian.desktop