Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge build/rmf branch to main #7

Merged
merged 18 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
##############################################################
## Configurations
##############################################################
env:
builder_ns: ghcr.io/open-rmf/rmf_deployment_template
base_registry: docker.io
domain_url: rmf-deployment-template.open-rmf.org
##############################################################
steps:
# ###
# Login to github packages, our container registry
# ###
- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
-
name: Checkout
uses: actions/checkout@v3
-
name: Install and run vcs import rmf
run: |
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install python3-vcstool -y
mkdir rmf-src
vcs import rmf-src < rmf/rmf.repos
# ###
# build builder images
# ###
-
name: Build builder-rosdep
uses: docker/build-push-action@v3
with:
context: .
file: rmf/builder-rosdep.Dockerfile
build-args: |
BASE_REGISTRY=${{ env.base_registry }}
# push: true
tags: ${{ env.builder_ns }}/builder-rosdep:latest
-
name: Build builder-rmf
uses: docker/build-push-action@v3
with:
context: .
file: rmf/builder-rmf.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
# push: true
tags: ${{ env.builder_ns }}/builder-rmf:latest
-
name: run vcs import rmf-web
run: |
mkdir rmf-web-src
vcs import rmf-web-src < rmf-web/rmf-web.repos
-
name: Build builder-rmf-web
uses: docker/build-push-action@v3
with:
context: .
file: rmf-web/builder-rmf-web.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
# push: true
tags: ${{ env.builder_ns }}/builder-rmf-web:latest
-
name: run vcs import rmf-simulation
run: |
mkdir rmf-simulation-src
vcs import rmf-simulation-src < rmf-simulation/rmf-simulation.repos
-
name: Build builder-rmf-simulation
uses: docker/build-push-action@v3
with:
context: .
file: rmf-simulation/builder-rmf-simulation.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
# push: true
tags: ${{ env.builder_ns }}/builder-rmf-simulation:latest
# ###
# build rmf image
# ###
-
name: Build rmf docker img
uses: docker/build-push-action@v3
with:
context: .
file: rmf/rmf.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
push: true
tags: ${{ env.builder_ns }}/rmf:latest
# ###
# build rmf simulation images
# ###
-
name: Build rmf-simulation
uses: docker/build-push-action@v3
with:
context: .
file: rmf-simulation/rmf-simulation.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
push: true
tags: ${{ env.builder_ns }}/rmf-simulation:latest
# ###
# build rmf web images
# ###
-
name: Build rmf-web-rmf-server
uses: docker/build-push-action@v3
with:
context: .
file: rmf-web/rmf-web-rmf-server.Dockerfile
build-args: |
BUILDER_NS=${{ env.builder_ns }}
push: true
tags: ${{ env.builder_ns }}/rmf-web-rmf-server:latest
-
name: Build rmf-web-dashboard
uses: docker/build-push-action@v3
with:
context: .
file: rmf-web/rmf-web-dashboard.Dockerfile
build-args: |
BASE_REGISTRY=${{ env.base_registry }}
DOMAIN_URL=${{ env.domain_url }}
BUILDER_NS=${{ env.builder_ns }}
push: true
tags: ${{ env.builder_ns }}/rmf-web-dashboard:latest
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![.github/workflows/docker-image.yml](https://github.com/open-rmf/rmf_deployment_template/actions/workflows/docker-image.yml/badge.svg)](https://github.com/open-rmf/rmf_deployment_template/actions/workflows/docker-image.yml)

# RMF Deployment Template
This repo provides a sample template to build, deploy and manage an RMF installation (i.e. GitOps for RMF)

This repo is structured as -
- `main` - Intro
- `build/rmf` - Build Dockerfiles and CI pipeline
- `cloud_infra` - Cloud cluster bringup scripts and docs and runtime configs
- `main` - Contains Dockerfiles and CI pipeline to build images for this example deployment
- `build/rmf-site` - Contains example rmf-site related resources, dockerfiles and CI process
- `cloud_infra` - Cloud cluster bringup scripts, resources and runtime configs

_(These branches may be setup as independant repos for a production environment, the intent in having them as branches here is to provide a concise one-stop location for easy reference.)_

Expand Down
34 changes: 34 additions & 0 deletions rmf-simulation/builder-rmf-simulation.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG BUILDER_NS="open-rmf/rmf_deployment_template"

FROM $BUILDER_NS/builder-rmf

SHELL ["bash", "-c"]

RUN apt update
WORKDIR /opt/rmf

# copy rmf-simulation source files
COPY rmf-simulation-src src

RUN rosdep update --rosdistro $ROS_DISTRO
RUN rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO \
--skip-keys roscpp \
--skip-keys actionlib \
--skip-keys rviz \
--skip-keys catkin \
--skip-keys move_base \
--skip-keys amcl \
--skip-keys turtlebot3_navigation \
--skip-keys turtlebot3_bringup \
--skip-keys move_base_msgs \
--skip-keys dwa_local_planner \
--skip-keys map_server \
-y

RUN . /opt/ros/$ROS_DISTRO/setup.sh \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

RUN sed -i '$isource "/opt/rmf/install/setup.bash"' /ros_entrypoint.sh

ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
12 changes: 12 additions & 0 deletions rmf-simulation/rmf-simulation.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG BUILDER_NS="open-rmf/rmf_deployment_template"

FROM $BUILDER_NS/builder-rmf-simulation

SHELL ["bash", "-c"]

ENV RMF_SIMULATION_MAP_PACKAGE=rmf_demos_maps
ENV RMF_SIMULATION_MAP_NAME=office
ENV GAZEBO_VERSION=11

ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
5 changes: 5 additions & 0 deletions rmf-simulation/rmf-simulation.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
rmf/rmf_demos:
type: git
url: https://github.com/open-rmf/rmf_demos.git
version: main
21 changes: 21 additions & 0 deletions rmf-web/builder-rmf-web.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG BUILDER_NS="open-rmf/rmf_deployment_template"

FROM $BUILDER_NS/builder-rmf

SHELL ["bash", "-c"]

# copy rmf-web source files
COPY rmf-web-src src

RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get update && apt-get install -y nodejs
RUN pip3 install pipenv

RUN cd /opt/rmf/src/rmf-web && \
sed -i '$ d' Pipfile && \
npm install -g npm@latest && \
npm config set unsafe-perm && \
npm ci

ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
Binary file added rmf-web/dashboard_resources/caddy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rmf-web/dashboard_resources/cleanerBotA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rmf-web/dashboard_resources/cleanerBotE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rmf-web/dashboard_resources/deliveryRobot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rmf-web/dashboard_resources/headerLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions rmf-web/dashboard_resources/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"dispensers":{},
"robots":{
"cleanerBotA":{
"icons":{
"cleanerBotA":"/cleanerBotA.png"
}
},
"cleanerBotE":{
"icons":{
"cleanerBotE":"/cleanerBotE.png"
}
},
"caddy":{
"icons":{
"caddy":"/caddy.png"
}
},
"deliveryRobot":{
"icons":{
"deliveryRobot":"/deliveryRobot.png"
}
},
"tinyRobot":{
"icons":{
"tinyRobot":"/tinyRobot.png"
}
}
},
"logos":{
"headerLogo":{
"icons":{
"headerLogo":"/headerLogo.png"
}
}
}
}

Binary file added rmf-web/dashboard_resources/tinyRobot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions rmf-web/rmf-web-dashboard.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ARG BUILDER_NS="open-rmf/rmf_deployment_template"
ARG BASE_REGISTRY="docker.io"

###################################################################
FROM $BUILDER_NS/builder-rmf-web
ARG DOMAIN_URL="rmf-deployment-template.open-rmf.org"

SHELL ["bash", "-c"]

RUN mkdir /opt/rmf/src/rmf-web/packages/dashboard/src/assets/resources
COPY rmf-web/dashboard_resources/* /opt/rmf/src/rmf-web/packages/dashboard/src/assets/resources/

RUN . /opt/rmf/install/setup.bash

WORKDIR /opt/rmf/src/rmf-web

ENV PUBLIC_URL="/dashboard"
ENV REACT_APP_TRAJECTORY_SERVER="wss://${DOMAIN_URL}/trajectory"
ENV REACT_APP_RMF_SERVER="https://${DOMAIN_URL}/rmf/api/v1"
ENV REACT_APP_AUTH_PROVIDER="keycloak"
ENV REACT_APP_KEYCLOAK_CONFIG='{"realm": "rmf-web", "clientId": "dashboard", "url" : "https://'${DOMAIN_URL}'/auth"}'

RUN echo "DOMAIN_URL: $DOMAIN_URL"\
&& echo "REACT_APP_TRAJECTORY_SERVER: $REACT_APP_TRAJECTORY_SERVER"\
&& echo "REACT_APP_RMF_SERVER: $REACT_APP_RMF_SERVER"\
&& echo "REACT_APP_AUTH_PROVIDER: $REACT_APP_AUTH_PROVIDER"\
&& echo "REACT_APP_KEYCLOAK_CONFIG: $REACT_APP_KEYCLOAK_CONFIG"

RUN cd /opt/rmf/src/rmf-web/packages/dashboard && npm run build

###
FROM $BASE_REGISTRY/nginx:stable
COPY --from=0 /opt/rmf/src/rmf-web/packages/dashboard/build /usr/share/nginx/html/dashboard

SHELL ["bash", "-c"]
RUN echo -e 'server {\n\
listen 80;\n\
server_name localhost;\n\
\n\
location / {\n\
root /usr/share/nginx/html;\n\
index index.html index.htm;\n\
try_files $uri /dashboard/index.html;\n\
}\n\
\n\
error_page 500 502 503 504 /50x.html;\n\
location = /50x.html {\n\
root /usr/share/nginx/html;\n\
}\n\
}\n' > /etc/nginx/conf.d/default.conf
30 changes: 30 additions & 0 deletions rmf-web/rmf-web-rmf-server.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG BUILDER_NS="open-rmf/rmf_deployment_template"

FROM $BUILDER_NS/builder-rmf-web

SHELL ["bash", "-c"]

ENV RMF_SERVER_USE_SIM_TIME=true

RUN . /opt/rmf/install/setup.bash && \
cd /opt/rmf/src/rmf-web/packages/api-server && npm run prepack

FROM $BUILDER_NS/builder-rmf-web

COPY --from=0 /opt/rmf/src/rmf-web/packages/api-server/dist/ .

SHELL ["bash", "-c"]
RUN pip3 install $(ls -1 | grep '.*.whl')[postgres]
RUN pip3 install paho-mqtt

# cleanup
RUN rm -rf /opt/rmf/src
RUN rm -rf /var/lib/apt/lists && \
npm cache clean --force

RUN echo -e '#!/bin/bash\n\
. /opt/rmf/install/setup.bash\n\
exec rmf_api_server "$@"\n\
' > /docker-entry-point.sh && chmod +x /docker-entry-point.sh

ENTRYPOINT ["/docker-entry-point.sh"]
5 changes: 5 additions & 0 deletions rmf-web/rmf-web.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
rmf-web:
type: git
url: https://github.com/open-rmf/rmf-web
version: main
Loading