Merge "Switch graphical console image to ubuntu by default"

This commit is contained in:
Zuul 2025-12-05 16:38:12 +00:00 committed by Gerrit Code Review
commit 6b6b932714
9 changed files with 66 additions and 19 deletions

View file

@ -1357,7 +1357,11 @@ function install_ironic {
# buildah required below to build the VNC container
install_package podman systemd-container slirp4netns buildah
pushd $IRONIC_DIR/tools/vnc-container
buildah bud -f ./Containerfile -t localhost/ironic-vnc-container
if is_ubuntu; then
buildah bud --from quay.io/opendevmirror/ubuntu:$VERSION_ID -f ./Containerfile.ubuntu -t localhost/ironic-vnc-container
elif is_fedora; then
buildah bud -f ./Containerfile.centos -t localhost/ironic-vnc-container
fi
popd
fi
}

View file

@ -242,7 +242,8 @@ packages = [
[tool.setuptools.data-files]
"share/ironic/vnc-container" = [
"tools/vnc-container/Containerfile",
"tools/vnc-container/Containerfile.ubuntu",
"tools/vnc-container/Containerfile.centos",
"tools/vnc-container/README.rst",
]
"share/ironic/vnc-container/bin" = [

View file

@ -0,0 +1,6 @@
---
features:
- |
Adds a new Ubuntu based container file for VNC graphical client
operation containers, which is above and beyond the stock Centos
based VNC.

View file

@ -20,6 +20,9 @@ ENV APP='fake'
ENV APP_INFO={}
ENV READ_ONLY=False
ENV DEBUG=0
ENV FIREFOX=firefox
ENV FIREFOX_CONFIG_DIR=/home/firefox/.mozilla/firefox
ENV EXTENSION_PATH="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/@ironic-console.openstack.org"
ADD bin/* /usr/local/bin
ADD drivers /drivers

View file

@ -0,0 +1,37 @@
FROM ubuntu:noble
# firefox-esr is installed from the mozillateam ppa because the ubuntu
# packaged fedora exits with a message to install the snap
RUN apt-get update && \
apt-get install -y \
dumb-init \
iproute2 \
procps \
psmisc \
python3-requests \
software-properties-common \
x11vnc \
xvfb && \
add-apt-repository ppa:mozillateam/ppa && \
apt-get install -y \
firefox-esr && \
useradd --create-home --shell /bin/bash firefox
ENV DISPLAY_WIDTH=1280
ENV DISPLAY_HEIGHT=960
ENV APP='fake'
ENV APP_INFO={}
ENV READ_ONLY=False
ENV DEBUG=0
ENV FIREFOX=firefox-esr
ENV FIREFOX_CONFIG_DIR=/home/firefox/.mozilla/firefox-esr
ENV EXTENSION_PATH="/usr/lib/firefox-esr-addons/extensions/@ironic-console.openstack.org"
ADD bin/* /usr/local/bin
ADD drivers /drivers
ADD extension /usr/lib/firefox-esr-addons/extensions/@ironic-console.openstack.org
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/local/bin/start-x11vnc.sh"]

View file

@ -18,7 +18,7 @@ Building and using
To build the container image for local use, install ``buildah`` and run the
following as the user which runs ironic-conductor::
buildah bud -f ./Containerfile -t localhost/ironic-vnc-container
buildah bud -f ./Containerfile.ubuntu -t localhost/ironic-vnc-container
The ``systemd`` container provider (or an external provider) can then be configured
to use this image in ``ironic.conf``:

View file

@ -2,16 +2,16 @@
set -ex
if pgrep -x firefox >/dev/null; then
if pgrep -x $FIREFOX >/dev/null; then
echo "Firefox is already running. Exiting."
exit 0
fi
rm -rf ~/.mozilla/firefox
rm -rf $FIREFOX_CONFIG_DIR
firefox -CreateProfile ironic-vnc
$FIREFOX -CreateProfile ironic-vnc
pushd ~/.mozilla/firefox/*.ironic-vnc
pushd $FIREFOX_CONFIG_DIR/*.ironic-vnc
cert-override.py > cert_override.txt
popd
@ -19,11 +19,11 @@ popd
DEBUG=${DEBUG:-0}
if [ "$DEBUG" = "2" ]; then
# show tabs and a javascript console
firefox -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc -jsconsole &
$FIREFOX -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc -jsconsole &
elif [ "$DEBUG" = "1" ]; then
# show tabs
firefox -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc &
$FIREFOX -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc &
else
# fully locked down kiosk mode
firefox -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc --kiosk &
$FIREFOX -width ${DISPLAY_WIDTH} -height ${DISPLAY_HEIGHT} -P ironic-vnc --kiosk &
fi

View file

@ -1,9 +1,6 @@
#!/bin/bash
set -ex
extension_path="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/@ironic-console.openstack.org"
set -x
set +e
APP_NAME=$(discover-app.py)
@ -11,17 +8,16 @@ if [ $? -ne 0 ]; then
export ERROR="${APP_NAME}"
APP_NAME="error"
fi
set -e
cat << EOF > "${extension_path}/config.js"
cat << EOF > "${EXTENSION_PATH}/config.js"
let config = {
app: "${APP_NAME}",
app_info: ${APP_INFO}
};
EOF
sed -i "s#APP_NAME#${APP_NAME}#g" "${extension_path}/manifest.json"
sed -i "s#APP_NAME#${APP_NAME}#g" "${EXTENSION_PATH}/manifest.json"
mkdir -p /etc/firefox/policies
policies.py > /etc/firefox/policies/policies.json

View file

@ -5,7 +5,7 @@ set -ex
connections=$(ss --no-header state established '( dport = :5900 or sport = :5900 )' | wc -l)
if [ "$connections" -eq 0 ]; then
killall -s SIGTERM firefox
killall -s SIGTERM $FIREFOX
else
echo "Active VNC connection detected, deferring firefox shutdown."
echo "Active VNC connection detected, deferring $FIREFOX shutdown."
fi