From cc1359fef247c8e9f151ac7ba8095ee0a596cd4f Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 08:58:59 +0000 Subject: [PATCH 01/27] Basic build and upload for dashboad Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 35 +++++++++++++++++++++++++++++++++ .github/workflows/dashboard.yml | 19 ++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .github/dashboard/Dockerfile diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile new file mode 100644 index 000000000..03573f585 --- /dev/null +++ b/.github/dashboard/Dockerfile @@ -0,0 +1,35 @@ +ARG BASE_IMAGE +FROM $BASE_IMAGE +ARG BRANCH=main + +### Build dashboard + +# fetch sources +RUN mkdir -p /ws \ + && curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ + && tar zxf rmf_web.tar.gz -C /ws --strip-components=1 + +# install deps +RUN cd /ws \ + && pnpm install --filter rmf-dashboard... + +# build +RUN cd /ws/packages/dashboard \ + && pnpm run build + +### Set up bare minimum dashboard image + +FROM docker.io/ubuntu:24.04 +COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard + +RUN curl -fsSL https://get.pnpm.io/install.sh | bash - +# shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually +ENV PNPM_HOME /root/.local/share/pnpm +ENV PATH "$PNPM_HOME:$PATH" + +# nodejs seems to have changed the official mirror, the default in pnpm is very slow now +RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts + +RUN npm install --global serve + +ENTRYPOINT serve -s /opt/dashboard/ diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index 8026f1d2e..aa18f2d8c 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -43,3 +43,22 @@ jobs: uses: codecov/codecov-action@v1 with: flags: dashboard + build-docker-image: + name: Push Docker images to GitHub Packages + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to docker + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: ghcr.io/${{ github.repository }}/dashboard + context: .github/dashboard From 5e105c5d8eaded8be79cdc3f59aa70546a2b8d4a Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 09:29:46 +0000 Subject: [PATCH 02/27] Default base image Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 +- .github/workflows/dashboard.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 03573f585..2620ee016 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE +ARG BASE_IMAGE=docker.io/ubuntu:24.04 FROM $BASE_IMAGE ARG BRANCH=main diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index aa18f2d8c..f86f55f6a 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -44,6 +44,7 @@ jobs: with: flags: dashboard build-docker-image: + # needs: unit-tests name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: From 464097746e018a512d51716c70e2e3df5c187e3d Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 09:33:00 +0000 Subject: [PATCH 03/27] install curl Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 2620ee016..db27d5de8 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -4,6 +4,8 @@ ARG BRANCH=main ### Build dashboard +RUN apt update && apt install -y curl + # fetch sources RUN mkdir -p /ws \ && curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ From 058a78cd50c92c547c87f6e79cab926b07cc1de8 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 09:46:11 +0000 Subject: [PATCH 04/27] Passing build args Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 +- .github/workflows/dashboard.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index db27d5de8..26b6ce105 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=docker.io/ubuntu:24.04 +ARG BASE_IMAGE FROM $BASE_IMAGE ARG BRANCH=main diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index f86f55f6a..44d0a60f6 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -61,5 +61,7 @@ jobs: uses: docker/build-push-action@v5 with: push: true + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard From 682811bc8e4103d745ee12ce8b8747f9db78e94d Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 09:51:48 +0000 Subject: [PATCH 05/27] Install curl in second step image Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 26b6ce105..a864e515d 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -4,8 +4,6 @@ ARG BRANCH=main ### Build dashboard -RUN apt update && apt install -y curl - # fetch sources RUN mkdir -p /ws \ && curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ @@ -24,6 +22,8 @@ RUN cd /ws/packages/dashboard \ FROM docker.io/ubuntu:24.04 COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard +RUN apt update && apt install -y curl + RUN curl -fsSL https://get.pnpm.io/install.sh | bash - # shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually ENV PNPM_HOME /root/.local/share/pnpm From eba275fb2c212a747bf2a6bd87b50824981a73ad Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 10:10:12 +0000 Subject: [PATCH 06/27] Not install serve globally Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index a864e515d..7950d51b5 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -32,6 +32,6 @@ ENV PATH "$PNPM_HOME:$PATH" # nodejs seems to have changed the official mirror, the default in pnpm is very slow now RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts -RUN npm install --global serve +RUN npm i -S serve ENTRYPOINT serve -s /opt/dashboard/ From 77caa8f53ded8ae7bb30226007c511dbb4219a9a Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 10:15:35 +0000 Subject: [PATCH 07/27] Adding npm bin to path Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 7950d51b5..ffa6e8bf7 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -32,6 +32,7 @@ ENV PATH "$PNPM_HOME:$PATH" # nodejs seems to have changed the official mirror, the default in pnpm is very slow now RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts -RUN npm i -S serve +RUN npm install --global serve +ENV PATH "$(npm bin -g):$PATH" ENTRYPOINT serve -s /opt/dashboard/ From 44e7c683dcee9cb360fc4453fb889bdd4b40f84b Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 8 Aug 2024 11:04:49 +0000 Subject: [PATCH 08/27] Fix entry point with bash too Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index ffa6e8bf7..33527123a 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,4 +35,4 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -ENTRYPOINT serve -s /opt/dashboard/ +ENTRYPOINT ['/bin/bash serve -s /opt/dashboard/'] From f9f3c056a3ff780cd2df2a21d2d6b700de4b9255 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 12:49:20 +0800 Subject: [PATCH 09/27] Use CMD instead of ENTRYPOINT Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 33527123a..dc9c5e46d 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,4 +35,4 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -ENTRYPOINT ['/bin/bash serve -s /opt/dashboard/'] +CMD ['/bin/bash serve -s /opt/dashboard/'] From 488c1056feb836e4254ccce182c4183505e9d262 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 12:53:51 +0800 Subject: [PATCH 10/27] Just use bash at the moment to debug Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index dc9c5e46d..4f45e859d 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,4 +35,5 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -CMD ['/bin/bash serve -s /opt/dashboard/'] +# CMD ['/bin/bash serve -s /opt/dashboard/'] +CMD ["bash"] From ca85e47fb4e5e437faaace0ce9b7e3471a72a510 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 13:00:57 +0800 Subject: [PATCH 11/27] Use npx Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 6 ++++-- .github/dashboard/entrypoint.sh | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .github/dashboard/entrypoint.sh diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 4f45e859d..bcbc1afee 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,5 +35,7 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -# CMD ['/bin/bash serve -s /opt/dashboard/'] -CMD ["bash"] +COPY ./entrypoint.sh / +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/dashboard/entrypoint.sh b/.github/dashboard/entrypoint.sh new file mode 100644 index 000000000..b25407f9a --- /dev/null +++ b/.github/dashboard/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/bash +npx serve -s /opt/dashboard From 822df45ff902658377fdcfe7340e6cad55adb387 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 15:42:53 +0800 Subject: [PATCH 12/27] Basic api-server image Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 25 +++++++++++++++++++++++++ .github/dashboard/Dockerfile | 7 ++++--- .github/workflows/api-server.yml | 23 +++++++++++++++++++++++ .github/workflows/dashboard.yml | 2 +- 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 .github/api-server/Dockerfile diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile new file mode 100644 index 000000000..26110f817 --- /dev/null +++ b/.github/api-server/Dockerfile @@ -0,0 +1,25 @@ +ARG BASE_IMAGE +FROM $BASE_IMAGE +ARG BRANCH=main +ARG ROS_DISTRO=jazzy + +### Build api-server + +RUN apt update && apt install -y python3-pip ros-$ROS_DISTRO-rmw-cyclonedds-cpp + +# fetch sources +RUN mkdir -p /ws \ + && curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ + && tar zxf rmf_web.tar.gz -C /ws --strip-components=1 + +# install deps +RUN cd /ws \ + && pnpm install --filter api-server... + +# cleanup +RUN rm -rf \ + /var/lib/apt/lists \ + /dist + +WORKDIR /ws/packages/api-server +ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && pnpm start"] diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index bcbc1afee..5429c72c1 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,7 +35,8 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -COPY ./entrypoint.sh / -RUN chmod +x /entrypoint.sh +# COPY ./entrypoint.sh / +# RUN chmod +x /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] +# ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index 0549c42eb..5e7a327c1 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -42,3 +42,26 @@ jobs: uses: codecov/codecov-action@v1 with: flags: api-server + build-docker-image: + # needs: tests + name: Push Docker images to GitHub Packages + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to docker + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf + ROS_DISTRO=jazzy + tags: ghcr.io/${{ github.repository }}/api-server + context: .github/api-server diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index 44d0a60f6..df10e6200 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -44,7 +44,7 @@ jobs: with: flags: dashboard build-docker-image: - # needs: unit-tests + needs: unit-tests name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: From 6cc90c7c9a35d495053384aa1537b62fef27e49c Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 16:42:39 +0800 Subject: [PATCH 13/27] Revert dashboard entry script, api-server to enter bash for debugging Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 5 +++-- .github/dashboard/Dockerfile | 4 ---- .github/dashboard/entrypoint.sh | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .github/dashboard/entrypoint.sh diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index 26110f817..5419ce5b6 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -21,5 +21,6 @@ RUN rm -rf \ /var/lib/apt/lists \ /dist -WORKDIR /ws/packages/api-server -ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && pnpm start"] +# WORKDIR /ws/packages/api-server +# ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && pnpm start"] +ENTRYPOINT ["bash"] \ No newline at end of file diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 5429c72c1..ddecd9b5e 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,8 +35,4 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" -# COPY ./entrypoint.sh / -# RUN chmod +x /entrypoint.sh - -# ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] diff --git a/.github/dashboard/entrypoint.sh b/.github/dashboard/entrypoint.sh deleted file mode 100644 index b25407f9a..000000000 --- a/.github/dashboard/entrypoint.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -npx serve -s /opt/dashboard From 1b63a5e8d80f11728ddf95c7f1e727feac1703a0 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 12 Aug 2024 16:50:02 +0800 Subject: [PATCH 14/27] Source minimal rmf instead of ros, before starting api-server Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 5 ++--- .github/workflows/api-server.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index 5419ce5b6..a13dc71fc 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -21,6 +21,5 @@ RUN rm -rf \ /var/lib/apt/lists \ /dist -# WORKDIR /ws/packages/api-server -# ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && pnpm start"] -ENTRYPOINT ["bash"] \ No newline at end of file +WORKDIR /ws/packages/api-server +ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && pnpm start"] diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index 5e7a327c1..dc206c607 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -43,7 +43,7 @@ jobs: with: flags: api-server build-docker-image: - # needs: tests + needs: tests name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: From 369517dfe976098e828869ad84dfc7c9fe7dbe7e Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 14 Aug 2024 07:00:40 +0000 Subject: [PATCH 15/27] Make api-server image smaller Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 36 +++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index a13dc71fc..f24771205 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -1,12 +1,8 @@ ARG BASE_IMAGE -FROM $BASE_IMAGE +FROM $BASE_IMAGE as base ARG BRANCH=main ARG ROS_DISTRO=jazzy -### Build api-server - -RUN apt update && apt install -y python3-pip ros-$ROS_DISTRO-rmw-cyclonedds-cpp - # fetch sources RUN mkdir -p /ws \ && curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ @@ -21,5 +17,33 @@ RUN rm -rf \ /var/lib/apt/lists \ /dist +# WORKDIR /ws/packages/api-server +# ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && pnpm start"] + +### Set up minimal image + +FROM docker.io/library/ros:$ROS_DISTRO-ros-core + +RUN apt update && apt install -y ros-$ROS_DISTRO-rmw-cyclonedds-cpp + +# according to rosdep, the messages have no deps so we can just copy the files directly in! +# this reduces the image size by ~50%. +COPY --from=base /opt/rmf/include /opt/ros/$ROS_DISTRO/include +COPY --from=base /opt/rmf/install/lib /opt/ros/$ROS_DISTRO/lib +COPY --from=base /opt/rmf/install/local /opt/ros/$ROS_DISTRO/local +COPY --from=base /opt/rmf/install/share /opt/ros/$ROS_DISTRO/share + +# Copy over ws alongside the python virtual environment +RUN mkdir /ws +COPY --from=base /ws /ws + +# cleanup +RUN rm -rf \ + /var/lib/apt/lists \ + /dist + +# ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && rmf_api_server"] + +ENV RMF_API_SERVER_CONFIG /ws/packages/api-server/sqlite_local_config.py WORKDIR /ws/packages/api-server -ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && pnpm start"] +ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && mkdir -p run/cache && ../../.venv/bin/pipenv run python -m api_server"] From 141b9a6bc124c893b4fcaabc346de1c1f3608597 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 14 Aug 2024 07:34:53 +0000 Subject: [PATCH 16/27] Use strings in dockerfile Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index f24771205..15cc575f4 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -1,7 +1,8 @@ ARG BASE_IMAGE FROM $BASE_IMAGE as base -ARG BRANCH=main -ARG ROS_DISTRO=jazzy + +ARG BRANCH="main" +ARG ROS_DISTRO="jazzy" # fetch sources RUN mkdir -p /ws \ From c4a69c2521ac152f4f948575583512e53dd82a16 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 14 Aug 2024 07:41:06 +0000 Subject: [PATCH 17/27] Change default args for whole Dockerfile Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index 15cc575f4..de68633fd 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -1,8 +1,10 @@ +ARG BRANCH=main +ARG ROS_DISTRO=jazzy ARG BASE_IMAGE + FROM $BASE_IMAGE as base -ARG BRANCH="main" -ARG ROS_DISTRO="jazzy" +ARG BRANCH # fetch sources RUN mkdir -p /ws \ @@ -22,17 +24,17 @@ RUN rm -rf \ # ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && pnpm start"] ### Set up minimal image - FROM docker.io/library/ros:$ROS_DISTRO-ros-core +ARG ROS_DISTRO + RUN apt update && apt install -y ros-$ROS_DISTRO-rmw-cyclonedds-cpp # according to rosdep, the messages have no deps so we can just copy the files directly in! # this reduces the image size by ~50%. COPY --from=base /opt/rmf/include /opt/ros/$ROS_DISTRO/include -COPY --from=base /opt/rmf/install/lib /opt/ros/$ROS_DISTRO/lib -COPY --from=base /opt/rmf/install/local /opt/ros/$ROS_DISTRO/local -COPY --from=base /opt/rmf/install/share /opt/ros/$ROS_DISTRO/share +COPY --from=base /opt/rmf/lib /opt/ros/$ROS_DISTRO/lib +COPY --from=base /opt/rmf/share /opt/ros/$ROS_DISTRO/share # Copy over ws alongside the python virtual environment RUN mkdir /ws @@ -47,4 +49,4 @@ RUN rm -rf \ ENV RMF_API_SERVER_CONFIG /ws/packages/api-server/sqlite_local_config.py WORKDIR /ws/packages/api-server -ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && mkdir -p run/cache && ../../.venv/bin/pipenv run python -m api_server"] +ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && mkdir -p run/cache && ../../.venv/bin/pipenv run python -m api_server"] From 1bd9fd55115d1be0a7e76c6c56579dcf3ab4cf0a Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 14 Aug 2024 10:00:51 +0000 Subject: [PATCH 18/27] Set builds as nightly, update README Signed-off-by: Aaron Chong --- .github/api-server/Dockerfile | 5 ---- .github/workflows/api-server.yml | 23 ------------------- .github/workflows/dashboard.yml | 22 ------------------ .github/workflows/nightly.yml | 19 +++++++++++++++- README.md | 39 ++++++++++++++++++++++++-------- 5 files changed, 48 insertions(+), 60 deletions(-) diff --git a/.github/api-server/Dockerfile b/.github/api-server/Dockerfile index de68633fd..cb96ca6a0 100644 --- a/.github/api-server/Dockerfile +++ b/.github/api-server/Dockerfile @@ -20,9 +20,6 @@ RUN rm -rf \ /var/lib/apt/lists \ /dist -# WORKDIR /ws/packages/api-server -# ENTRYPOINT ["bash", "-c", ". /opt/rmf/setup.bash && pnpm start"] - ### Set up minimal image FROM docker.io/library/ros:$ROS_DISTRO-ros-core @@ -45,8 +42,6 @@ RUN rm -rf \ /var/lib/apt/lists \ /dist -# ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && rmf_api_server"] - ENV RMF_API_SERVER_CONFIG /ws/packages/api-server/sqlite_local_config.py WORKDIR /ws/packages/api-server ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && mkdir -p run/cache && ../../.venv/bin/pipenv run python -m api_server"] diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index dc206c607..0549c42eb 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -42,26 +42,3 @@ jobs: uses: codecov/codecov-action@v1 with: flags: api-server - build-docker-image: - needs: tests - name: Push Docker images to GitHub Packages - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to docker - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf - ROS_DISTRO=jazzy - tags: ghcr.io/${{ github.repository }}/api-server - context: .github/api-server diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index df10e6200..8026f1d2e 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -43,25 +43,3 @@ jobs: uses: codecov/codecov-action@v1 with: flags: dashboard - build-docker-image: - needs: unit-tests - name: Push Docker images to GitHub Packages - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to docker - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf - tags: ghcr.io/${{ github.repository }}/dashboard - context: .github/dashboard diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e916601f7..87b9d679f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,12 +20,29 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push + - name: Build and push minimal-rmf uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository }}/minimal-rmf context: .github/minimal-rmf + - name: Build and push dashboard + uses: docker/build-push-action@v5 + with: + push: true + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf + tags: ghcr.io/${{ github.repository }}/dashboard + context: .github/dashboard + - name: Build and push api-server + uses: docker/build-push-action@v5 + with: + push: true + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf + ROS_DISTRO=jazzy + tags: ghcr.io/${{ github.repository }}/api-server + context: .github/api-server # dashboard-e2e: # strategy: # matrix: diff --git a/README.md b/README.md index fd57be786..a351ec884 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ Open-RMF Web is a collection of packages that provide a web-based interface for users to visualize and control all aspects of Open-RMF deployments. -- [Getting started](#getting-started) +- [Quick start with docker](#quick-start-with-docker) +- [Getting started from source](#getting-started-from-source) - [API server](packages/api-server) - [API client](packages/api-client) - [Dashboard](packages/dashboard) @@ -14,7 +15,31 @@ Open-RMF Web is a collection of packages that provide a web-based interface for - [Contribution guide](#contribution-guide) - [Roadmap](https://github.com/open-rmf/rmf-web/wiki/Open-RMF-Web-Dashboard) -# Getting started +# Quick start with docker + +Start the dashboard with host network access. The dashboard will then accessible on `localhost:3000` by default. + +```bash +docker run \ + --network host \ + -it \ + ghcr.io/open-rmf/rmf-web/dashboard:latest +``` + +Start the API server with host network access, and set up the correct `ROS_DOMAIN_ID` and ROS 2 RMW implementation that will be used in the rest of the Open-RMF system. The API server will use the default port at `localhost:8000`. + +```bash +docker run \ + --network host \ + -it \ + -e ROS_DOMAIN_ID= \ + -e RMW_IMPLEMENTATION= \ + ghcr.io/open-rmf/rmf-web/api-server:latest +``` + +Users can also [configure the API server](packages/api-server/README.md/#configuration) using a mounted configuration file and setting the environment variable `RMF_API_SERVER_CONFIG`. In the default scenario, the API server will use an internal non-persistent database. + +# Getting started from source ### Prerequisites @@ -56,7 +81,7 @@ You may also install dependencies for only a subset of the packages pnpm install -w --filter ... ``` -### Launching +### Launching for development Source Open-RMF and launch the dashboard in development mode, @@ -81,19 +106,15 @@ Ensure that the fleet adapters in the Open-RMF deployment is configured to use t ros2 launch rmf_demos_gz office.launch.xml server_uri:="http://localhost:8000/_internal" ``` -### Launching for development +### Launching for development separately -For development purposes, it might be useful to start all the individual components separately, +When developing individual components, it may be useful to start the dashboard and api-server separately, ```bash # Start the dashboard in dev, this monitors for changes in the dashboard package and performs rebuilds. A browser refresh is required after all automated builds. cd packages/dashboard pnpm run start:react -# Start react-components in dev, this monitors for changes in react-components, which will in turn trigger a re-build in dashboard. -cd packages/react-components -pnpm run build:watch - # Start the API server, this will need to be restarted for any changes to be reflected cd packages/api-server pnpm run start From 0588b10c52942643ff4c4a6c6ef867669b4eb550 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 14 Aug 2024 10:20:58 +0000 Subject: [PATCH 19/27] Point to PMC board Signed-off-by: Aaron Chong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a351ec884..28ef6a439 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Open-RMF Web is a collection of packages that provide a web-based interface for - [Dashboard](packages/dashboard) - [Configuration](#configuration) - [Contribution guide](#contribution-guide) -- [Roadmap](https://github.com/open-rmf/rmf-web/wiki/Open-RMF-Web-Dashboard) +- [Roadmap](https://github.com/orgs/open-rmf/projects/10) # Quick start with docker From 31b6489a5c6b69a38900f3fb52dfdff5d6a43eaa Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 03:01:10 +0000 Subject: [PATCH 20/27] Share docker images between build steps with dependencies, update README Signed-off-by: Aaron Chong --- .github/workflows/nightly.yml | 47 +++++++++++++++++++++++++++++------ README.md | 10 ++++---- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 87b9d679f..06a42a2c2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,14 +1,19 @@ name: Nightly +# on: +# schedule: +# # 2am SGT +# - cron: '0 18 * * *' on: - schedule: - # 2am SGT - - cron: '0 18 * * *' + pull_request: + push: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build-docker-images: - name: Push Docker images to GitHub Packages + build-minimal-rmf-docker-images: + name: Push minimal-rmf Docker image to GitHub Packages runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -26,12 +31,40 @@ jobs: push: true tags: ghcr.io/${{ github.repository }}/minimal-rmf context: .github/minimal-rmf + outputs: type=docker,dest=/tmp/minimal-rmf.tar + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: minimal-rmf + path: /tmp/minimal-rmf.tar + build-docker-images: + needs: build-minimal-rmf-docker-images + name: Push Docker images to GitHub Packages + runs-on: ubuntu-24.04 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: minimal-rmf + path: /tmp + - name: Load image + run: | + docker load --input /tmp/minimal-rmf.tar + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to docker + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push dashboard uses: docker/build-push-action@v5 with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard - name: Build and push api-server @@ -39,7 +72,7 @@ jobs: with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest ROS_DISTRO=jazzy tags: ghcr.io/${{ github.repository }}/api-server context: .github/api-server diff --git a/README.md b/README.md index 28ef6a439..e3d26f6af 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,13 @@ Open-RMF Web is a collection of packages that provide a web-based interface for # Quick start with docker +These docker images are useful when trying out [`rmf_demos`](https://github.com/open-rmf/rmf_demos). + Start the dashboard with host network access. The dashboard will then accessible on `localhost:3000` by default. ```bash docker run \ - --network host \ - -it \ + --network host -it --rm \ ghcr.io/open-rmf/rmf-web/dashboard:latest ``` @@ -30,8 +31,7 @@ Start the API server with host network access, and set up the correct `ROS_DOMAI ```bash docker run \ - --network host \ - -it \ + --network host -it --rm \ -e ROS_DOMAIN_ID= \ -e RMW_IMPLEMENTATION= \ ghcr.io/open-rmf/rmf-web/api-server:latest @@ -100,7 +100,7 @@ This starts up the API server (by default at port 8000) which sets up endpoints If presented with a login screen, use `user=admin password=admin`. -Ensure that the fleet adapters in the Open-RMF deployment is configured to use the endpoints of the API server. By default it is `http://localhost:8000/_internal`. Launching a simulation from `rmf_demos_gz` for example, the command would be, +Ensure that the fleet adapters in the Open-RMF deployment is configured to use the endpoints of the API server. By default it is `http://localhost:8000/_internal`. Launching a simulation from [`rmf_demos_gz`](https://github.com/open-rmf/rmf_demos) for example, the command would be, ```bash ros2 launch rmf_demos_gz office.launch.xml server_uri:="http://localhost:8000/_internal" From 6e503064afd5cf6c3cbadda25fa0cad8af3dcc60 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 03:13:15 +0000 Subject: [PATCH 21/27] Use specific tags to ensure no pulling is involved Signed-off-by: Aaron Chong --- .github/workflows/nightly.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 06a42a2c2..322fc84df 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -50,6 +50,9 @@ jobs: - name: Load image run: | docker load --input /tmp/minimal-rmf.tar + - name: Tag image + run: | + docker image tag ghcr.io/${{ github.repository }}/minimal-rmf:latest ghcr.io/${{ github.repository }}/minimal-rmf:local - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -64,7 +67,7 @@ jobs: with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:local tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard - name: Build and push api-server @@ -72,7 +75,7 @@ jobs: with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:local ROS_DISTRO=jazzy tags: ghcr.io/${{ github.repository }}/api-server context: .github/api-server From ec9b4915c1b192cb67548944bc14bdd856964d8b Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 03:53:43 +0000 Subject: [PATCH 22/27] Revert to just use docker registry instead of manual loading Signed-off-by: Aaron Chong --- .github/workflows/nightly.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 322fc84df..0272cb644 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -31,28 +31,11 @@ jobs: push: true tags: ghcr.io/${{ github.repository }}/minimal-rmf context: .github/minimal-rmf - outputs: type=docker,dest=/tmp/minimal-rmf.tar - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: minimal-rmf - path: /tmp/minimal-rmf.tar build-docker-images: needs: build-minimal-rmf-docker-images name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: minimal-rmf - path: /tmp - - name: Load image - run: | - docker load --input /tmp/minimal-rmf.tar - - name: Tag image - run: | - docker image tag ghcr.io/${{ github.repository }}/minimal-rmf:latest ghcr.io/${{ github.repository }}/minimal-rmf:local - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -67,7 +50,7 @@ jobs: with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:local + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard - name: Build and push api-server @@ -75,7 +58,7 @@ jobs: with: push: true build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:local + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest ROS_DISTRO=jazzy tags: ghcr.io/${{ github.repository }}/api-server context: .github/api-server From 7dafc12a40968a824a8a641adea4879e01a85bab Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 03:54:11 +0000 Subject: [PATCH 23/27] Inject env script Signed-off-by: Aaron Chong --- .github/dashboard/99-inject-env.sh | 6 ++++++ .github/dashboard/Dockerfile | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 .github/dashboard/99-inject-env.sh diff --git a/.github/dashboard/99-inject-env.sh b/.github/dashboard/99-inject-env.sh new file mode 100644 index 000000000..b99df0c64 --- /dev/null +++ b/.github/dashboard/99-inject-env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash +set -e + +sed -i "s,__RMF_SERVER_URL__,${RMF_SERVER_URL},g" /opt/dashboard/index.html +sed -i "s,__TRAJECTORY_SERVER_URL__,${TRAJECTORY_SERVER_URL},g" /opt/dashboard/index.html +sed -i "s,__KEYCLOAK_URL__,${KEYCLOAK_URL},g" /opt/dashboard/index.html diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index ddecd9b5e..c9887e096 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -35,4 +35,6 @@ RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env RUN npm install --global serve ENV PATH "$(npm bin -g):$PATH" +COPY 99-inject-env.sh /docker-entrypoint.d + ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] From 5386df01c9b0db64193ce6234d09807fcd5f2917 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 04:23:35 +0000 Subject: [PATCH 24/27] Use configurable configs, inject envs before start Signed-off-by: Aaron Chong --- .github/dashboard/99-inject-env.sh | 1 - .github/dashboard/Dockerfile | 3 ++- .github/dashboard/app-config.json | 42 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/dashboard/app-config.json diff --git a/.github/dashboard/99-inject-env.sh b/.github/dashboard/99-inject-env.sh index b99df0c64..4284492cf 100644 --- a/.github/dashboard/99-inject-env.sh +++ b/.github/dashboard/99-inject-env.sh @@ -3,4 +3,3 @@ set -e sed -i "s,__RMF_SERVER_URL__,${RMF_SERVER_URL},g" /opt/dashboard/index.html sed -i "s,__TRAJECTORY_SERVER_URL__,${TRAJECTORY_SERVER_URL},g" /opt/dashboard/index.html -sed -i "s,__KEYCLOAK_URL__,${KEYCLOAK_URL},g" /opt/dashboard/index.html diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index c9887e096..05890bf7e 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -13,7 +13,8 @@ RUN mkdir -p /ws \ RUN cd /ws \ && pnpm install --filter rmf-dashboard... -# build +# replace configs and build +COPY app-config.json /ws/packages/dashboard/app-config.json RUN cd /ws/packages/dashboard \ && pnpm run build diff --git a/.github/dashboard/app-config.json b/.github/dashboard/app-config.json new file mode 100644 index 000000000..84626aeca --- /dev/null +++ b/.github/dashboard/app-config.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/rmf-web/main/packages/dashboard/app-config.schema.json", + "rmfServerUrl": "__RMF_SERVER_URL__", + "trajectoryServerUrl": "__TRAJECTORY_SERVER_URL__", + "authConfig": {}, + "helpLink": "https://osrf.github.io/ros2multirobotbook/rmf-core.html", + "reportIssue": "https://github.com/open-rmf/rmf-web/issues", + "pickupZones": [], + "defaultZoom": 20, + "defaultRobotZoom": 6, + "attributionPrefix": "OSRC-SG", + "defaultMapLevel": "L1", + "allowedTasks": [ + { + "taskDefinitionId": "patrol" + }, + { + "taskDefinitionId": "delivery" + }, + { + "taskDefinitionId": "compose-clean" + }, + { + "taskDefinitionId": "custom_compose" + } + ], + "resources": { + "default": { + "fleets": {}, + "logos": { + "header": "/resources/defaultLogo.png" + } + } + }, + "cartIds": [], + "buildConfig": { + "baseUrl": "/", + "authProvider": "stub", + "customTabs": false, + "adminTab": false + } +} From ede148b325244e8e985b2ca80108624fe421f895 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 05:09:50 +0000 Subject: [PATCH 25/27] Use nginx instead Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 32 ++++++++------- .github/dashboard/nginx.default.conf | 19 +++++++++ .github/workflows/nightly.yml | 58 ++++++++++++++-------------- 3 files changed, 67 insertions(+), 42 deletions(-) create mode 100644 .github/dashboard/nginx.default.conf diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 05890bf7e..121731d22 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -20,22 +20,28 @@ RUN cd /ws/packages/dashboard \ ### Set up bare minimum dashboard image -FROM docker.io/ubuntu:24.04 -COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard +FROM docker.io/nginx:stable +COPY --from=0 --chown=root:nginx /ws/packages/dashboard/dist /usr/share/nginx/html/dashboard -RUN apt update && apt install -y curl +COPY nginx.default.conf /etc/nginx/conf.d/default.conf +COPY 99-inject-env.sh /docker-entrypoint.d -RUN curl -fsSL https://get.pnpm.io/install.sh | bash - -# shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually -ENV PNPM_HOME /root/.local/share/pnpm -ENV PATH "$PNPM_HOME:$PATH" +# FROM docker.io/ubuntu:24.04 +# COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard -# nodejs seems to have changed the official mirror, the default in pnpm is very slow now -RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts +# RUN apt update && apt install -y curl -RUN npm install --global serve -ENV PATH "$(npm bin -g):$PATH" +# RUN curl -fsSL https://get.pnpm.io/install.sh | bash - +# # shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually +# ENV PNPM_HOME /root/.local/share/pnpm +# ENV PATH "$PNPM_HOME:$PATH" -COPY 99-inject-env.sh /docker-entrypoint.d +# # nodejs seems to have changed the official mirror, the default in pnpm is very slow now +# RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts + +# RUN npm install --global serve +# ENV PATH "$(npm bin -g):$PATH" + +# COPY 99-inject-env.sh /docker-entrypoint.d -ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] +# ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] diff --git a/.github/dashboard/nginx.default.conf b/.github/dashboard/nginx.default.conf new file mode 100644 index 000000000..5f7152452 --- /dev/null +++ b/.github/dashboard/nginx.default.conf @@ -0,0 +1,19 @@ +server { + listen 80; + + location ^~ /dashboard/assets { + root /usr/share/nginx/html; + add_header Cache-Control max-age=604800; + } + + location /dashboard { + root /usr/share/nginx/html; + index /dashboard/index.html; + try_files $uri /dashboard/index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0272cb644..67edc665f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,27 +12,27 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build-minimal-rmf-docker-images: - name: Push minimal-rmf Docker image to GitHub Packages - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to docker - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push minimal-rmf - uses: docker/build-push-action@v5 - with: - push: true - tags: ghcr.io/${{ github.repository }}/minimal-rmf - context: .github/minimal-rmf + # build-minimal-rmf-docker-images: + # name: Push minimal-rmf Docker image to GitHub Packages + # runs-on: ubuntu-24.04 + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + # - name: Login to docker + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} + # - name: Build and push minimal-rmf + # uses: docker/build-push-action@v5 + # with: + # push: true + # tags: ghcr.io/${{ github.repository }}/minimal-rmf + # context: .github/minimal-rmf build-docker-images: - needs: build-minimal-rmf-docker-images + # needs: build-minimal-rmf-docker-images name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: @@ -53,15 +53,15 @@ jobs: BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard - - name: Build and push api-server - uses: docker/build-push-action@v5 - with: - push: true - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest - ROS_DISTRO=jazzy - tags: ghcr.io/${{ github.repository }}/api-server - context: .github/api-server + # - name: Build and push api-server + # uses: docker/build-push-action@v5 + # with: + # push: true + # build-args: | + # BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest + # ROS_DISTRO=jazzy + # tags: ghcr.io/${{ github.repository }}/api-server + # context: .github/api-server # dashboard-e2e: # strategy: # matrix: From 3d322bf3f98bdf18c31e6de0f2f15b5b6d2e0f9a Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 05:21:20 +0000 Subject: [PATCH 26/27] Revert nginx use, run injection script during entrypoint command Signed-off-by: Aaron Chong --- .github/dashboard/Dockerfile | 32 ++++++++----------- .../{99-inject-env.sh => inject-env.sh} | 0 .github/dashboard/nginx.default.conf | 19 ----------- 3 files changed, 13 insertions(+), 38 deletions(-) rename .github/dashboard/{99-inject-env.sh => inject-env.sh} (100%) delete mode 100644 .github/dashboard/nginx.default.conf diff --git a/.github/dashboard/Dockerfile b/.github/dashboard/Dockerfile index 121731d22..6700897e0 100644 --- a/.github/dashboard/Dockerfile +++ b/.github/dashboard/Dockerfile @@ -20,28 +20,22 @@ RUN cd /ws/packages/dashboard \ ### Set up bare minimum dashboard image -FROM docker.io/nginx:stable -COPY --from=0 --chown=root:nginx /ws/packages/dashboard/dist /usr/share/nginx/html/dashboard +FROM docker.io/ubuntu:24.04 +COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard -COPY nginx.default.conf /etc/nginx/conf.d/default.conf -COPY 99-inject-env.sh /docker-entrypoint.d +RUN apt update && apt install -y curl -# FROM docker.io/ubuntu:24.04 -# COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard +RUN curl -fsSL https://get.pnpm.io/install.sh | bash - +# shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually +ENV PNPM_HOME /root/.local/share/pnpm +ENV PATH "$PNPM_HOME:$PATH" -# RUN apt update && apt install -y curl +# nodejs seems to have changed the official mirror, the default in pnpm is very slow now +RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts -# RUN curl -fsSL https://get.pnpm.io/install.sh | bash - -# # shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually -# ENV PNPM_HOME /root/.local/share/pnpm -# ENV PATH "$PNPM_HOME:$PATH" +RUN npm install --global serve +ENV PATH "$(npm bin -g):$PATH" -# # nodejs seems to have changed the official mirror, the default in pnpm is very slow now -# RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts +COPY inject-env.sh /opt/inject-env.sh -# RUN npm install --global serve -# ENV PATH "$(npm bin -g):$PATH" - -# COPY 99-inject-env.sh /docker-entrypoint.d - -# ENTRYPOINT ["bash", "-c", "npx serve -s /opt/dashboard"] +ENTRYPOINT ["bash", "-c", ". /opt/inject-env.sh && npx serve -s /opt/dashboard"] diff --git a/.github/dashboard/99-inject-env.sh b/.github/dashboard/inject-env.sh similarity index 100% rename from .github/dashboard/99-inject-env.sh rename to .github/dashboard/inject-env.sh diff --git a/.github/dashboard/nginx.default.conf b/.github/dashboard/nginx.default.conf deleted file mode 100644 index 5f7152452..000000000 --- a/.github/dashboard/nginx.default.conf +++ /dev/null @@ -1,19 +0,0 @@ -server { - listen 80; - - location ^~ /dashboard/assets { - root /usr/share/nginx/html; - add_header Cache-Control max-age=604800; - } - - location /dashboard { - root /usr/share/nginx/html; - index /dashboard/index.html; - try_files $uri /dashboard/index.html; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} From 61b81d1d8c1a450f0759468f041bbccfbd3909e8 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 16 Aug 2024 05:33:00 +0000 Subject: [PATCH 27/27] Revert testing changes, update README Signed-off-by: Aaron Chong --- .github/workflows/nightly.yml | 69 ++++++++++++++++------------------- README.md | 10 ++++- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 67edc665f..164e2aec9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,38 +1,33 @@ name: Nightly -# on: -# schedule: -# # 2am SGT -# - cron: '0 18 * * *' on: - pull_request: - push: - branches: - - main + schedule: + # 2am SGT + - cron: '0 18 * * *' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - # build-minimal-rmf-docker-images: - # name: Push minimal-rmf Docker image to GitHub Packages - # runs-on: ubuntu-24.04 - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 - # - name: Login to docker - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - name: Build and push minimal-rmf - # uses: docker/build-push-action@v5 - # with: - # push: true - # tags: ghcr.io/${{ github.repository }}/minimal-rmf - # context: .github/minimal-rmf + build-minimal-rmf-docker-images: + name: Push minimal-rmf Docker image to GitHub Packages + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to docker + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push minimal-rmf + uses: docker/build-push-action@v5 + with: + push: true + tags: ghcr.io/${{ github.repository }}/minimal-rmf + context: .github/minimal-rmf build-docker-images: - # needs: build-minimal-rmf-docker-images + needs: build-minimal-rmf-docker-images name: Push Docker images to GitHub Packages runs-on: ubuntu-24.04 steps: @@ -53,15 +48,15 @@ jobs: BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest tags: ghcr.io/${{ github.repository }}/dashboard context: .github/dashboard - # - name: Build and push api-server - # uses: docker/build-push-action@v5 - # with: - # push: true - # build-args: | - # BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest - # ROS_DISTRO=jazzy - # tags: ghcr.io/${{ github.repository }}/api-server - # context: .github/api-server + - name: Build and push api-server + uses: docker/build-push-action@v5 + with: + push: true + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/minimal-rmf:latest + ROS_DISTRO=jazzy + tags: ghcr.io/${{ github.repository }}/api-server + context: .github/api-server # dashboard-e2e: # strategy: # matrix: diff --git a/README.md b/README.md index e3d26f6af..a214d1a62 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,19 @@ Open-RMF Web is a collection of packages that provide a web-based interface for These docker images are useful when trying out [`rmf_demos`](https://github.com/open-rmf/rmf_demos). -Start the dashboard with host network access. The dashboard will then accessible on `localhost:3000` by default. +Start the dashboard with host network access, `RMF_SERVER_URL` and `TRAJECTORY_SERVER_URL` configured accordingly. The dashboard will then accessible on `localhost:3000` by default. ```bash docker run \ --network host -it --rm \ + -e RMF_SERVER_URL=http://localhost:8000 \ + -e TRAJECTORY_SERVER_URL=ws://localhost:8006 \ ghcr.io/open-rmf/rmf-web/dashboard:latest ``` +> **Note** +> The values provided for `RMF_SERVER_URL` and `TRAJECTORY_SERVER_URL` are default values when running the API server and `rmf_demos`, and can be modified to suit different setups. + Start the API server with host network access, and set up the correct `ROS_DOMAIN_ID` and ROS 2 RMW implementation that will be used in the rest of the Open-RMF system. The API server will use the default port at `localhost:8000`. ```bash @@ -37,7 +42,8 @@ docker run \ ghcr.io/open-rmf/rmf-web/api-server:latest ``` -Users can also [configure the API server](packages/api-server/README.md/#configuration) using a mounted configuration file and setting the environment variable `RMF_API_SERVER_CONFIG`. In the default scenario, the API server will use an internal non-persistent database. +> **Note** +> Users can also [configure the API server](packages/api-server/README.md/#configuration) using a mounted configuration file and setting the environment variable `RMF_API_SERVER_CONFIG`. In the default scenario, the API server will use an internal non-persistent database. # Getting started from source