Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
Signed-off-by: Oguz Ozturk <[email protected]>
  • Loading branch information
oguzkaganozt committed Nov 21, 2024
1 parent ceb5159 commit 128d547
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
7 changes: 7 additions & 0 deletions docker/simulator-visualizer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 16 additions & 6 deletions docker/simulator-visualizer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 14 additions & 10 deletions docker/vnc/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 128d547

Please sign in to comment.