Commit 28b3b53d authored by Larkin Heintzman's avatar Larkin Heintzman

clean up!

parent e3a65930
...@@ -2,7 +2,7 @@ ARG from=ros:noetic ...@@ -2,7 +2,7 @@ ARG from=ros:noetic
FROM ${from} FROM ${from}
RUN apt-get update && apt-get install -y python3-pip git ca-certificates RUN apt-get update && apt-get install -y python3-pip git ca-certificates
RUN apt-get update && apt-get install -y libsdl2-dev libusb-1.0-0-dev build-essential cmake && apt-get install -y openssh-server RUN apt-get update && apt-get install -y libsdl2-dev libusb-1.0-0-dev build-essential cmake && apt-get install -y openssh-server iputils-ping sudo
RUN pip3 install git+https://github.com/catkin/catkin_tools.git RUN pip3 install git+https://github.com/catkin/catkin_tools.git
...@@ -22,8 +22,6 @@ RUN apt-get update && \ ...@@ -22,8 +22,6 @@ RUN apt-get update && \
RUN catkin config \ RUN catkin config \
--extend /opt/ros/$ROS_DISTRO && \ --extend /opt/ros/$ROS_DISTRO && \
catkin build --cmake-args -DCMAKE_CXX_FLAGS="-std=c++17" catkin build --cmake-args -DCMAKE_CXX_FLAGS="-std=c++17"
# \
# roscpp_tutorials
# might need something different in the bash script # might need something different in the bash script
# COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh # COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
...@@ -37,9 +35,23 @@ RUN chmod 755 /usr/local/bin/ros_entrypoint.sh && \ ...@@ -37,9 +35,23 @@ RUN chmod 755 /usr/local/bin/ros_entrypoint.sh && \
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/webssh/.bashrc RUN echo "source /opt/ros/noetic/setup.bash" >> /home/webssh/.bashrc
RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/webssh/.bashrc RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/webssh/.bashrc
# put rsa key in image
RUN mkdir -p /home/webssh/.ssh
COPY selfkey.pub /home/webssh/.ssh/authorized_keys
RUN chown -R webssh:webssh /home/webssh/.ssh
RUN chmod 600 /home/webssh/.ssh/authorized_keys
# RUN echo "Host remotehost\n\tStrictHostKeyChecking no\n" >> /home/webssh/.ssh/config
RUN service ssh start
EXPOSE 22
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
CMD ["/usr/sbin/sshd","-D"]
CMD ["bash"] CMD ["bash"]
# CMD ["service ssh start"] # CMD ["service ssh start"]
# run ros package launch file # run ros package launch file
......
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC+1wxuQlF2SEKtg7g2KllzaBp7Fx3bbkrdNVeMtbthr63CLsqane27yCKV2xCbQbn5BTBbyhjPFI3yJL2ohYH3POMqBRl/QriJ9a8ATDC2TofMKIBJrtZXbLCg8exQvHwJbtVnKZk7IBmySDl8lVEtPbAyvbDt15bHcDVdc7hOQBV5u7nAAQAZTBwmf8bDywrri0bX2ZPuFgtFHKoVV2HrB7gY+xghlkXaYtf1I37T9dFEOHy7RUA2q6ykBlGQBr/2vOKuvKa+QkpWVz5R3EHkaK7Xqsxv20VAceIo9h+RMoW/e1T+RJmQKm5JpeBC1Io5KYzKoHzDb1wd48vPZtqtD9kVrC97pvLMhaUcPk3WPP1TWxr9j+drUMMOLnY6JjrLTOKB6bO/AIfFTXIFY9L6zDEibFJOnMOvLNgf8dsF72qQFpBE4rAeVUTwYjvj2QRtHMIiAYjh4ieE1qHiwERYKsjUNvsKAihvo+v+TbwLSwj97ZAsH3KEvjjmpFAnY3k= llh@pop-os
...@@ -5,9 +5,10 @@ FROM ${from} ...@@ -5,9 +5,10 @@ FROM ${from}
# python-catkin-tools \ # python-catkin-tools \
# && rm -rf /var/lib/apt/lists/* # && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y python3-pip git ca-certificates RUN apt-get update && apt-get install -y python3-pip git ca-certificates
RUN apt-get update && apt-get install -y libsdl2-dev libusb-1.0-0-dev build-essential cmake ffmpeg python3-opencv libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev RUN apt-get update && apt-get install -y libsdl2-dev libusb-1.0-0-dev build-essential cmake ffmpeg python3-opencv libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev iputils-ping
RUN apt-get update && apt-get install -y ros-noetic-tf RUN apt-get update && apt-get install -y ros-noetic-tf
RUN pip3 install git+https://github.com/catkin/catkin_tools.git RUN pip3 install git+https://github.com/catkin/catkin_tools.git
# set up udev and usb stuff # set up udev and usb stuff
...@@ -37,6 +38,7 @@ WORKDIR /usr/local/include/ ...@@ -37,6 +38,7 @@ WORKDIR /usr/local/include/
RUN git clone https://gitlab.com/libeigen/eigen.git && mv eigen/ Eigen3/ RUN git clone https://gitlab.com/libeigen/eigen.git && mv eigen/ Eigen3/
# clone ros package repo # clone ros package repo
RUN echo "test"
ENV ROS_WS /opt/ros_ws ENV ROS_WS /opt/ros_ws
RUN mkdir -p $ROS_WS/src RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS WORKDIR $ROS_WS
......
ARG from=ros:noetic
FROM ${from}
# install build tools
RUN apt-get update && apt-get install -y python3-pip git
# work around as the apt-get version fails
RUN pip3 install git+https://github.com/catkin/catkin_tools.git
# clone ros package repo
ENV ROS_WS /opt/ros_ws
RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS
RUN git -C src clone \
-b $ROS_DISTRO-devel \
https://github.com/ros/ros_tutorials.git
# install ros package dependencies
RUN apt-get update && rosdep update && rosdep install -y --from-paths src/ros_tutorials/roscpp_tutorials --ignore-src
# build ros package source
RUN catkin config \
--extend /opt/ros/$ROS_DISTRO && \
catkin build \
roscpp_tutorials
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN chmod 755 /usr/local/bin/ros_entrypoint.sh
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
CMD ["roscore"]
# source ros package from entrypoint
# RUN sed --in-place --expression \
# '$isource "$ROS_WS/devel/setup.bash"' \
# /ros_entrypoint.sh
# run ros package launch file
# CMD ["roslaunch", "roscpp_tutorials", "talker_listener.launch"]
#!/bin/bash
set -e
echo "==> Executing master image entrypoint ..."
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well
source "$ROS_WS/devel/setup.bash"
echo "==> Container ready"
exec "$@"
ARG from=ros:noetic
FROM ${from}
# install build tools
# RUN apt-get update && apt-get install -y \
# python-catkin-tools \
# && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y python3-pip git
RUN pip3 install git+https://github.com/catkin/catkin_tools.git
# clone ros package repo
ENV ROS_WS /opt/ros_ws
RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS
RUN git -C src clone \
-b $ROS_DISTRO-devel \
https://github.com/ros/ros_tutorials.git
# install ros package dependencies
RUN apt-get update && \
rosdep update && \
rosdep install -y \
--from-paths \
src/ros_tutorials/roscpp_tutorials \
--ignore-src && \
rm -rf /var/lib/apt/lists/*
# build ros package source
RUN catkin config \
--extend /opt/ros/$ROS_DISTRO && \
catkin build \
roscpp_tutorials
COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN chmod 755 /usr/local/bin/bashCheckRoscore.sh && chmod 755 /usr/local/bin/ros_entrypoint.sh
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
# CMD [""]
CMD ["bash"]
# run ros package launch file
# CMD ["roslaunch", "roscpp_tutorials", "talker_listener.launch"]
#!/bin/bash
# set -e
# make sure to source ros work space so we can use the rostopic command
FILE="./resp.txt"
OUT="confirm"
until [[ $OUT != "confirm" ]]
do
rostopic list &> $FILE
echo $OUT
OUT=$(awk '/ERR/ { print "confirm" }' $FILE)
sleep 1
done
echo "found roscore!"
rm $FILE
# exit 1
#!/usr/bin/env python3
import sys
import rospy
if rospy.is_shutdown():
print("Waiting roscore ...")
sys.exit(1)
# if not rosgraph.is_master_online():
# print("Waiting roscore ...")
# sys.exit(1)
print("roscore found!")
#!/bin/bash
set -e
echo "==> Executing node image entrypoint ..."
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well
source "$ROS_WS/devel/setup.bash"
echo "==> Container ready"
exec "$@"
version: '2.4'
services:
master:
image: llhcluster/master:v0
build:
context: ./master/
args:
from: ros:noetic
node:
image: llhcluster/node:v0
build:
context: ./node/
args:
from: ros:noetic
...@@ -28,7 +28,7 @@ spec: ...@@ -28,7 +28,7 @@ spec:
name: ttyacm name: ttyacm
- mountPath: /dev/dji_usb - mountPath: /dev/dji_usb
name: ttydji name: ttydji
image: llh/dronearm:v0 image: llh/drone:v0
command: ["/bin/bash"] command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 armReady std_msgs/String 'ready'"] args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 armReady std_msgs/String 'ready'"]
# args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh"] # args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh"]
......
apiVersion: apps/v1
kind: Deployment
metadata:
name: listener-deployment
labels:
app: llhcluster
node: listener
spec:
replicas: 1
# The deployment handles all matching templated pods
selector:
matchLabels:
node: listener
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template:
metadata:
labels:
node: listener
spec:
# Wait roscore to be running before starting the pod.
# An initContainer is executed when this pod is created
# and tries to connect to the rocore which is running in
# a container in the master pod deployment.
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
# initContainers:
# - name: init-service-listener
# image: llh/node:v0
# args:
# - bashCheckRoscore.sh
# env:
# - name: ROS_MASTER_URI
# value: http://service-master:11311
# - name: ROS_HOSTNAME
# value: service-listener
containers:
# The real node container
- name: llhclusterpublisher
image: llh/node:v0
command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic echo /chatter"]
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
- name: ROS_HOSTNAME
value: service-listener
nodeSelector:
name: plath
# When the roscore container stops or fails, all the node
# containers need to be restarted because the ros network
# configuration is lost.
# This liveness probe restarts the node container if the
# 'chatter' topic is not anymore listed in the ROS network.
# This is required because the node doesn't fail automatically
# when roscore stops / restarts.
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
# livenessProbe:
# exec:
# command: ["/bin/bash -c 'ros_entrypoint.sh && rostopic info /chatter'"]
# # args: ["-c", "ros_entrypoint.sh && rostopic info /chatter"]
# initialDelaySeconds: 3
# periodSeconds: 3
---
apiVersion: v1
kind: Service
metadata:
name: service-listener
labels:
app: llhcluster
node: listener
spec:
# Start a headless service
# https://kubernetes.io/docs/concepts/services-networking/service/#headless-services
clusterIP: None
ports:
# Dummy port
- port: 11311
selector:
node: listener
apiVersion: apps/v1
kind: Deployment
metadata:
name: roscore-deployment
labels:
app: llhcluster
node: roscore
spec:
replicas: 1
# The deployment handles all matching templated pods
selector:
matchLabels:
node: roscore
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template:
metadata:
labels:
node: roscore
spec:
containers:
- name: roscore
image: llh/master:v0
args:
- roscore
ports:
- containerPort: 11311
name: roscoreport
nodeSelector:
name: master
---
apiVersion: v1
kind: Service
metadata:
name: service-master
labels:
app: llhcluster
node: roscore
spec:
clusterIP: None
ports:
- port: 11311
selector:
node: roscore
apiVersion: apps/v1
kind: Deployment
metadata:
name: talker-deployment
labels:
app: llhcluster
node: talker
spec:
replicas: 1
# The deployment handles all matching templated pods
selector:
matchLabels:
node: talker
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template:
metadata:
labels:
node: talker
spec:
# Wait roscore to be running before starting the pod.
# An initContainer is executed when this pod is created
# and tries to connect to the rocore which is running in
# a container in the master pod deployment.
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
# initContainers:
# - name: init-service-talker
# image: llh/node:v0
# args:
# - bashCheckRoscore.sh
# env:
# - name: ROS_MASTER_URI
# value: http://service-master:11311
# - name: ROS_HOSTNAME
# value: service-talker
containers:
# The real node container
- name: llhclusterpublisher
image: llh/node:v0
command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 chatter std_msgs/String 'hello worl'"]
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
- name: ROS_HOSTNAME
value: service-talker
nodeSelector:
name: plath
# When the roscore container stops or fails, all the node
# containers need to be restarted because the ros network
# configuration is lost.
# This liveness probe restarts the node container if the
# 'chatter' topic is not anymore listed in the ROS network.
# This is required because the node doesn't fail automatically
# when roscore stops / restarts.
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
# livenessProbe:
# exec:
# command: ["/bin/bash -c 'ros_entrypoint.sh && rostopic info /chatter'"]
# # command:
# # - ros_entrypoint.sh
# # - /opt/ros/melodic/bin/rostopic
# # - info
# # - chatter
# initialDelaySeconds: 3
# periodSeconds: 3
---
apiVersion: v1
kind: Service
metadata:
name: service-talker
labels:
app: llhcluster
node: talker
spec:
# Start a headless service
# https://kubernetes.io/docs/concepts/services-networking/service/#headless-services
clusterIP: None
ports:
# Dummy port
- port: 11311
selector:
node: talker
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment