forked from Lichtblick-Suite/lichtblick
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37996ca
commit 9126615
Showing
17 changed files
with
2,730 additions
and
4,323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
.DS_Store | ||
.webpack/ | ||
dist/ | ||
demo/ | ||
node_modules/ | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,11 @@ | |
1. Launch the development environment: | ||
|
||
```sh | ||
# To launch the desktop app (run both scripts concurrently): | ||
$ yarn desktop:serve # start webpack | ||
$ yarn desktop:start # launch electron | ||
|
||
# To launch the browser app: | ||
# To launch the app: | ||
$ yarn web:serve | ||
|
||
# To launch the storybook: | ||
$ yarn storybook | ||
|
||
# Advanced usage: running webpack and electron on different computers (or VMs) on the same network | ||
$ yarn desktop:serve --host 192.168.xxx.yyy # the address where electron can reach the webpack dev server | ||
$ yarn dlx [email protected] .webpack # launch the version of electron for the current computer's platform | ||
``` | ||
|
||
### Other useful commands | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
:8080 { | ||
handle_path /ws { | ||
reverse_proxy http://127.0.0.1:8765 | ||
} | ||
|
||
handle_path /* { | ||
root * /src | ||
|
||
# Handle IPv6 clients | ||
@ipv6Client { | ||
expression {http.request.host}.startsWith("fc94") | ||
} | ||
|
||
handle @ipv6Client { | ||
redir /ui /?ds=foxglove-websocket&ds.url=ws%3A%2F%2F%5B{http.request.host}%5D%3A8765 | ||
} | ||
|
||
# Handle all other requests (from non-IPv6 clients) | ||
handle { | ||
redir /ui /?ds=foxglove-websocket&ds.url=ws%3A%2F%2F{http.request.host}%3A8765 | ||
} | ||
|
||
templates { | ||
mime "text/html" | ||
} | ||
|
||
file_server | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
# Build stage | ||
FROM node:16 as build | ||
ARG ROS_DISTRO=humble | ||
|
||
# =========================== Foxglove builder =============================== | ||
FROM node:16 AS foxglove_build | ||
WORKDIR /src | ||
COPY . ./ | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y git-lfs && \ | ||
git clone -b improvements https://github.com/husarion/foxglove-docker . && \ | ||
git lfs pull | ||
|
||
RUN corepack enable | ||
RUN yarn install --immutable | ||
|
||
RUN yarn run web:build:prod | ||
|
||
# Release stage | ||
FROM caddy:2.5.2-alpine | ||
# =========================== Release stage =============================== | ||
FROM caddy:2.6.2-alpine | ||
WORKDIR /src | ||
COPY --from=build /src/web/.webpack ./ | ||
|
||
RUN apk update && apk add \ | ||
bash \ | ||
nss-tools | ||
|
||
COPY --from=foxglove_build /src/web/.webpack ./ | ||
|
||
COPY disable_cache.js / | ||
COPY disable_interaction.js / | ||
|
||
COPY Caddyfile /etc/caddy/ | ||
COPY entrypoint.sh / | ||
|
||
EXPOSE 8080 | ||
|
||
COPY <<EOF /entrypoint.sh | ||
# Optionally override the default layout with one provided via bind mount | ||
mkdir -p /foxglove | ||
touch /foxglove/default-layout.json | ||
index_html=\$(cat index.html) | ||
replace_pattern='/*FOXGLOVE_STUDIO_DEFAULT_LAYOUT_PLACEHOLDER*/' | ||
replace_value=\$(cat /foxglove/default-layout.json) | ||
echo "\${index_html/"\$replace_pattern"/\$replace_value}" > index.html | ||
|
||
# Continue executing the CMD | ||
exec "\$@" | ||
EOF | ||
|
||
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] | ||
CMD ["caddy", "file-server", "--listen", ":8080"] | ||
ENV DISABLE_INTERACTION=false | ||
ENV DISABLE_CACHE=true | ||
|
||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] | ||
CMD caddy run --config /etc/caddy/Caddyfile --adapter caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localStorage.clear(); | ||
sessionStorage.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
document.addEventListener("DOMContentLoaded", function() { | ||
var blocker = document.createElement("div"); | ||
|
||
blocker.style.position = "fixed"; | ||
blocker.style.top = "0"; | ||
blocker.style.left = "0"; | ||
blocker.style.width = "100%"; | ||
blocker.style.height = "100%"; | ||
blocker.style.backgroundColor = "rgba(0, 0, 0, 0)"; | ||
blocker.style.zIndex = "9999"; | ||
blocker.style.pointerEvents = "all"; | ||
|
||
document.body.appendChild(blocker); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cp /foxglove/default-layout.json /foxglove/local-layout.json | ||
if [ -n "$ROBOT_NAMESPACE" ]; then | ||
sed -i "s|<robot_namespace>|/$ROBOT_NAMESPACE|g" /foxglove/local-layout.json | ||
else | ||
sed -i "s|<robot_namespace>||g" /foxglove/local-layout.json | ||
fi | ||
|
||
# Optionally override the default layout with one provided via bind mount | ||
index_html=$(cat index.html) | ||
replace_pattern='/*FOXGLOVE_STUDIO_DEFAULT_LAYOUT_PLACEHOLDER*/' | ||
replace_value=$(cat /foxglove/local-layout.json) | ||
echo "${index_html/"$replace_pattern"/$replace_value}" > index.html | ||
|
||
# Check if ENABLE_SCRIPT1 is set to true | ||
if [[ "$DISABLE_CACHE" == "true" ]]; then | ||
echo "Cache is disabled" | ||
# Read the content of script1.js into a variable | ||
script1_content=$(</disable_cache.js) | ||
|
||
# Escape certain characters in the content that might break sed | ||
escaped_script1_content=$(echo "$script1_content" | sed 's/[&/\]/\\&/g') | ||
|
||
# Use sed to insert the content into index.html just before </body> | ||
sed -i "s|<div id=\"root\"></div>|<script>\n$(echo $escaped_script1_content)\n</script>\n&|" index.html | ||
fi | ||
|
||
# Check if ENABLE_SCRIPT2 is set to true | ||
if [[ "$DISABLE_INTERACTION" == "true" ]]; then | ||
echo "Interaction is disabled" | ||
# Read the content of script2.js into a variable | ||
script2_content=$(</disable_interaction.js) | ||
|
||
# Escape certain characters in the content that might break sed | ||
escaped_script2_content=$(echo "$script2_content" | sed 's/[&/\]/\\&/g') | ||
|
||
# Use sed to insert the content into index.html just before </body> | ||
sed -i "s|<div id=\"root\"></div>|<script>\n$(echo $escaped_script2_content)\n</script>\n&|" index.html | ||
fi | ||
|
||
# Continue executing the CMD | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
{ | ||
"//": "Our top level jest config to reference all the projects under our monorepo. We exclude the desktop test since it involves performing a webpack build and doesn't support 'watch' or 'debug' in the same way", | ||
"projects": [ | ||
"<rootDir>/ci/jest.config.json", | ||
"<rootDir>/desktop/jest.config.json", | ||
"<rootDir>/packages/*/jest.config.json" | ||
] | ||
"//": "Our top level jest config to reference all the projects under our monorepo", | ||
"projects": ["<rootDir>/ci/jest.config.json", "<rootDir>/packages/*/jest.config.json"] | ||
} |
Oops, something went wrong.