firejox / omnetpp-dock

OMNET++ with Simu5G in docker
MIT License
1 stars 1 forks source link

Run in Kubernetes #2

Closed DiogoCruz40 closed 2 years ago

DiogoCruz40 commented 2 years ago

Is there a way to run simu5g in kubernetes using containerd runtime, instead of docker? I dont know how to run GUI of this in Kubernetes instead of x11docker...

firejox commented 2 years ago

Yes, it is possible. It requires display system (eg. X window) and remote desktop server (eg. vnc server) installed on the same container. Then you can access GUI via remote desktop client. Maybe I can build another image on next update.

DiogoCruz40 commented 2 years ago

It's possible to access via the container itself, and open a GUI in windows? I would appreciate that, do you have a date to publish next update? I am a researcher at CISUC, and this is for a project that we are developing.

firejox commented 2 years ago

Now there is an experimental image firejox/omnetpp-dock:xpra for remote access. It requires xpra installed on the client side to access as seamless GUI application. You can try it whether resolve your problem.

DiogoCruz40 commented 2 years ago

Hey, thank you for your contribution. I didn't explain myself well, so the purpose is to open the GUI by running a command inside the container, not needing external services to open it. Are you familiar with some technology to do that?

firejox commented 2 years ago

AFAIK, there is no way to run as native GUI on heterogeneous windowing system without external services. It requires the client windowing system to accept container's draw event for display. If the container is based on Linux and client is Windows, it is impossible to open GUI as native GUI without external program.

If the container is based on Linux and the client has X Window System, then you can do as what ssh x11 forwarding do. You need to setup the container's DISPLAY environment variable with client's ip and display number. And then using xhost or xauth makes client's X Window System able to accept remote draw event.

If you do not care about native GUI, you can try to display the GUI as web page. noVNC and Xpra can display container's GUIs in web page. The disadvantages of web GUI is that could suffer from performance issue and usually require the full desktop environment. The noVNC will proxy VNC protocol to WebSocket protocol, so all command running inside the container will be display on web page. To use noVNC, it recommends to install full desktop environment in container. For Xpra, I think it is not mature enough. In my experience, Xpra will be slower than noVNC.

DiogoCruz40 commented 2 years ago

Hey @firejox, So i tried testing simu5g in xpra and it seems that it doesn't work. It opens the omnetpp IDE and when you try to launch the simu5g project it gives an error.

Edit: Captura de ecrã de 2022-07-08 19-58-08 Edit2:

from dorowu/ubuntu-desktop-lxde-vnc

copy --from=firejox/omnetpp-dock /omnetpp /omnetpp
run /bin/sh -c chown -hR 1000 /omnetpp && echo '[ -f "/omnetpp/setenv" ] && cd /omnetpp && source ./setenv -f && cd ~-' > /etc/profile.d/omnetpp.sh && sed -i 's/&//g' /omnetpp/bin/omnetpp # buildkit && \
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - && \
apt-get update -y  && apt-get upgrade -y  && \ 
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends --yes \
gcc g++ gdb bison flex make \
git python3 python3-pip python3-dev openscenegraph libopenscenegraph-dev curl \
openmpi-bin libopenmpi-dev \
gdal-bin libgdal-dev minizip rocksdb-tools duktape cmake \
default-jre default-jdk openjfx \
swig doxygen graphviz libpcap-dev tcl libqt5svg5 libqt5opengl5-dev \
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
ffmpeg && \
apt-get clean && \
python3 -m pip install --upgrade pip && \
pip install posix-ipc numpy scipy pandas matplotlib  && \
rm -rf /var/lib/apt/lists/*

EXPOSE 6080 80
CMD ["/bin/bash" "-l" "-c" "omnetpp"]

This is the dockerfile im trying to build

DiogoCruz40 commented 2 years ago

I gonna leave the way i solved the problem... Simu5g with vnc server

FROM dorowu/ubuntu-desktop-lxde-vnc as env-build
VOLUME [ "/dev/shm" ]
ENV VNC_PASSWORD=mypassword
ENV RESOLUTION=1920x1080
RUN \
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - && \
apt-get update -y  && apt-get upgrade -y  && \ 
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends --yes \
gcc g++ gdb bison flex make \
git python3 python3-pip python3-dev openscenegraph libopenscenegraph-dev curl \
openmpi-bin libopenmpi-dev \
gdal-bin libgdal-dev minizip rocksdb-tools duktape cmake \
default-jre default-jdk openjfx \
swig doxygen graphviz libpcap-dev tcl libqt5svg5 libqt5opengl5-dev \
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
ffmpeg && \
apt-get clean && \
python3 -m pip install --upgrade pip && \
pip install posix-ipc numpy scipy pandas matplotlib  && \
rm -rf /var/lib/apt/lists/*

from env-build as omnetpp-build
shell ["/bin/bash", "-c"]
run cd / && curl -L https://github.com/omnetpp/omnetpp/releases/download/omnetpp-6.0pre11/omnetpp-6.0pre11-src-linux.tgz|tar -zxv &&\
    cd /omnetpp-6.0pre11 && \
    source ./setenv -f && ./configure WITH_OSGEARTH=no PREFER_CLANG=no && make

from env-build as inet-build
copy --from=omnetpp-build /omnetpp-6.0pre11 /omnetpp-6.0pre11
shell ["/bin/bash", "-c"]
run cd /omnetpp-6.0pre11 && source ./setenv -f && \
    curl -L https://github.com/inet-framework/inet/releases/download/v4.3.2/inet-4.3.2-src.tgz | tar -zxv -C /omnetpp-6.0pre11/samples && \
    cd /omnetpp-6.0pre11/samples/inet4.3 && \
    source ./setenv -f && make makefiles && make

from env-build as simu5g-build
copy --from=inet-build /omnetpp-6.0pre11 /omnetpp-6.0pre11
shell ["/bin/bash", "-c"]
run cd /omnetpp-6.0pre11 && source ./setenv -f && cd /omnetpp-6.0pre11/samples/inet4.3 && source ./setenv -f && \
    curl -L https://github.com/Unipisa/Simu5G/archive/refs/tags/v1.2.0.tar.gz | tar -zxv -C /omnetpp-6.0pre11/samples && \
    cd /omnetpp-6.0pre11/samples/Simu5G-1.2.0 && \
    source ./setenv -f && make makefiles && make

from env-build
label maintainer.name="Firejox"
label maintainer.email="firejox@gmail.com"

copy --from=simu5g-build /omnetpp-6.0pre11 /omnetpp-6.0pre11
run chown -hR 1000 /omnetpp-6.0pre11 && apt-get update && apt-get install nano
EXPOSE 5900
cmd ["/bin/bash"]