diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 28e86e2f5c..41ade523ce 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -246,7 +246,7 @@ runs: ${{ steps.meta-universe-vehicle-system.outputs.bake-file }} ${{ steps.meta-universe-devel.outputs.bake-file }} ${{ steps.meta-universe.outputs.bake-file }} - ${{ steps.meta-simulator-tools.outputs.bake-file }} + ${{ steps.meta-simulator-visualizer.outputs.bake-file }} provenance: false set: | ${{ inputs.build-args }} diff --git a/docker/simulator-visualizer/Dockerfile b/docker/simulator-visualizer/Dockerfile index 9a83f96375..b19a83678c 100644 --- a/docker/simulator-visualizer/Dockerfile +++ b/docker/simulator-visualizer/Dockerfile @@ -72,6 +72,13 @@ RUN openssl req -x509 -nodes -newkey rsa:2048 \ -days 365 \ -subj "/O=Autoware-OpenADKit/CN=localhost" +# Install ngrok +RUN curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \ + gpg --dearmor -o /etc/apt/keyrings/ngrok.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/ngrok.gpg] https://ngrok-agent.s3.amazonaws.com buster main" | \ + tee /etc/apt/sources.list.d/ngrok.list && \ + apt update && apt install ngrok + # Need to expose VNC and NoVNC ports when running the container EXPOSE 5900 6080 diff --git a/docker/simulator-visualizer/entrypoint.sh b/docker/simulator-visualizer/entrypoint.sh index a4926a2da9..177a0a7425 100644 --- a/docker/simulator-visualizer/entrypoint.sh +++ b/docker/simulator-visualizer/entrypoint.sh @@ -5,7 +5,7 @@ source "/opt/ros/$ROS_DISTRO/setup.bash" source /opt/autoware/setup.bash # Start VNC server -vncserver :1 -auth $HOME/.Xauthority -geometry 1024x768 -depth 16 > /dev/null 2>&1 +vncserver :1 -auth $HOME/.Xauthority -geometry 1024x768 -depth 16 -pixelformat rgb565 > /dev/null 2>&1 VNC_RESULT=$? if [ $VNC_RESULT -ne 0 ]; then @@ -16,14 +16,24 @@ fi sleep 2 # Start NoVNC -websockify --web=/usr/share/novnc/ --cert=/etc/ssl/certs/novnc.crt --key=/etc/ssl/private/novnc.key 6080 localhost:5901 & > /dev/null 2>&1 +websockify --daemon --web=/usr/share/novnc/ --cert=/etc/ssl/certs/novnc.crt --key=/etc/ssl/private/novnc.key 6080 localhost:5901 + +NOVNC_URL="localhost:6080" +# Configure ngrok if NGROK_AUTHTOKEN is set +if [ -n "$NGROK_AUTHTOKEN" ]; then + ngrok config add-authtoken $NGROK_AUTHTOKEN + + # Start ngrok tunnel for NoVNC + ngrok http --url=$NGROK_URL 6080 --log=stdout > ngrok.log & + + NOVNC_URL=https://$NGROK_URL +fi # Print message echo -e "\033[32m-------------------------------------------------------------------------\033[0m" -echo -e "\033[32mVNC server is running and accessible at localhost:5901\033[0m" -echo -e "\033[32mNoVNC web interface available at localhost:6080\033[0m" -echo -e "\033[32mYou can connect to the VNC server with a VNC viewer\033[0m" -echo -e "\033[32mYou can connect to the NoVNC web interface with a web browser\033[0m" +echo -e "Note: In order to access VNC and NoVNC on localhost, you need to expose ports 5901 and 6080 to the outside world respectively." +echo -e "\033[32mVNC server is running and accessible at localhost:5901 via VNC viewer\033[0m" +echo -e "\033[32mNoVNC web interface available at $NOVNC_URL/vnc.html via web browser\033[0m" echo -e "\033[32m-------------------------------------------------------------------------\033[0m" # Run command diff --git a/docker/vnc/entrypoint.sh b/docker/vnc/entrypoint.sh index 84bb956959..177a0a7425 100644 --- a/docker/vnc/entrypoint.sh +++ b/docker/vnc/entrypoint.sh @@ -5,7 +5,7 @@ source "/opt/ros/$ROS_DISTRO/setup.bash" source /opt/autoware/setup.bash # Start VNC server -vncserver :1 -auth $HOME/.Xauthority -geometry 1024x768 -depth 16 > /dev/null 2>&1 +vncserver :1 -auth $HOME/.Xauthority -geometry 1024x768 -depth 16 -pixelformat rgb565 > /dev/null 2>&1 VNC_RESULT=$? if [ $VNC_RESULT -ne 0 ]; then @@ -16,20 +16,24 @@ fi sleep 2 # Start NoVNC -websockify --web=/usr/share/novnc/ --cert=/etc/ssl/certs/novnc.crt --key=/etc/ssl/private/novnc.key 6080 localhost:5901 & > /dev/null 2>&1 +websockify --daemon --web=/usr/share/novnc/ --cert=/etc/ssl/certs/novnc.crt --key=/etc/ssl/private/novnc.key 6080 localhost:5901 -# Configure ngrok -ngrok config add-authtoken $NGROK_AUTH_TOKEN +NOVNC_URL="localhost:6080" +# Configure ngrok if NGROK_AUTHTOKEN is set +if [ -n "$NGROK_AUTHTOKEN" ]; then + ngrok config add-authtoken $NGROK_AUTHTOKEN -# Start ngrok tunnel -ngrok tcp 6080 --url=simviz.openadkit.ngrok.app + # Start ngrok tunnel for NoVNC + ngrok http --url=$NGROK_URL 6080 --log=stdout > ngrok.log & + + NOVNC_URL=https://$NGROK_URL +fi # Print message echo -e "\033[32m-------------------------------------------------------------------------\033[0m" -echo -e "\033[32mVNC server is running and accessible at localhost:5901\033[0m" -echo -e "\033[32mNoVNC web interface available at localhost:6080\033[0m" -echo -e "\033[32mYou can connect to the VNC server with a VNC viewer\033[0m" -echo -e "\033[32mYou can connect to the NoVNC web interface with a web browser\033[0m" +echo -e "Note: In order to access VNC and NoVNC on localhost, you need to expose ports 5901 and 6080 to the outside world respectively." +echo -e "\033[32mVNC server is running and accessible at localhost:5901 via VNC viewer\033[0m" +echo -e "\033[32mNoVNC web interface available at $NOVNC_URL/vnc.html via web browser\033[0m" echo -e "\033[32m-------------------------------------------------------------------------\033[0m" # Run command