Commit 040f522b authored by Larkin Heintzman's avatar Larkin Heintzman

image pipeline updates

parent 59a8d1bd
...@@ -2,9 +2,11 @@ ARG from=ros:noetic ...@@ -2,9 +2,11 @@ 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 iputils-ping net-tools sudo 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 net-tools sudo nano ros-noetic-cv-bridge
RUN echo "el freshen up"
RUN pip3 install git+https://github.com/catkin/catkin_tools.git RUN pip3 install git+https://github.com/catkin/catkin_tools.git
RUN pip install opencv-python
# clone ros package repo # clone ros package repo
ENV ROS_WS /opt/ros_ws ENV ROS_WS /opt/ros_ws
...@@ -12,6 +14,10 @@ RUN mkdir -p $ROS_WS/src ...@@ -12,6 +14,10 @@ RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS WORKDIR $ROS_WS
RUN git -C src clone https://git.caslab.ece.vt.edu/hlarkin3/base-station-ros/ RUN git -C src clone https://git.caslab.ece.vt.edu/hlarkin3/base-station-ros/
WORKDIR $ROS_WS/src/base-station-ros
RUN git submodule init && git submodule update
WORKDIR $ROS_WS
# install ros package dependencies # install ros package dependencies
RUN apt-get update && \ RUN apt-get update && \
rosdep update && \ rosdep update && \
...@@ -25,18 +31,23 @@ RUN catkin config \ ...@@ -25,18 +31,23 @@ RUN catkin config \
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN useradd -m -s /bin/bash -p $(openssl passwd -1 password) webssh RUN useradd -m -s /bin/bash -p $(openssl passwd -1 password) ssher
RUN usermod -aG sudo ssher
RUN chmod 755 /usr/local/bin/ros_entrypoint.sh RUN chmod 755 /usr/local/bin/ros_entrypoint.sh
# make ssh-ing easier # make ssh-ing easier
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/webssh/.bashrc RUN echo "source /opt/ros/noetic/setup.bash" >> /home/ssher/.bashrc
RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/webssh/.bashrc RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/ssher/.bashrc
RUN echo "ssh-keyscan -H service-master >> /home/ssher/.ssh/known_hosts" >> /home/ssher/.bashrc
RUN echo "ssh-keyscan -H service-drone >> /home/ssher/.ssh/known_hosts" >> /home/ssher/.bashrc
# just doing this with hosts file now
# put rsa key in image # put rsa key in image
RUN mkdir -p /home/webssh/.ssh RUN mkdir -p /home/ssher/.ssh
# COPY selfkey.pub /home/webssh/.ssh/authorized_keys # COPY selfkey.pub /home/ssher/.ssh/authorized_keys
RUN chown -R webssh:webssh /home/webssh/.ssh RUN chown -R ssher:ssher /home/ssher/.ssh
# RUN chmod 600 /home/webssh/.ssh/authorized_keys # RUN chmod 600 /home/ssher/.ssh/authorized_keys
RUN service ssh start RUN service ssh start
EXPOSE 22 EXPOSE 22
......
...@@ -7,6 +7,10 @@ source "/opt/ros/$ROS_DISTRO/setup.bash" ...@@ -7,6 +7,10 @@ source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well # might need to source the devel space as well
source "$ROS_WS/devel/setup.bash" source "$ROS_WS/devel/setup.bash"
# put some stuff in the hosts file
# echo "service-master.default.svc.cluster.local base-0" >> /etc/hosts
service ssh start service ssh start
echo "==> Container ready" echo "==> Container ready"
exec "$@" exec "$@"
...@@ -5,10 +5,13 @@ FROM ${from} ...@@ -5,10 +5,13 @@ 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 iputils-ping net-tools openssh-server sudo 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 net-tools openssh-server sudo nano ros-noetic-cv-bridge
RUN apt-get update && apt-get install -y ros-noetic-tf RUN apt-get update && apt-get install -y ros-noetic-tf
# RUN echo "blah"
RUN pip3 install git+https://github.com/catkin/catkin_tools.git RUN pip3 install git+https://github.com/catkin/catkin_tools.git
RUN pip install opencv-python
RUN pip install pyproj
# set up udev and usb stuff # set up udev and usb stuff
WORKDIR /opt WORKDIR /opt
...@@ -42,6 +45,12 @@ RUN mkdir -p $ROS_WS/src ...@@ -42,6 +45,12 @@ RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS WORKDIR $ROS_WS
RUN git -C src clone http://git.caslab.ece.vt.edu/hlarkin3/drone-ros-packages.git -b replicants RUN git -C src clone http://git.caslab.ece.vt.edu/hlarkin3/drone-ros-packages.git -b replicants
WORKDIR $ROS_WS/src/drone-ros-packages
RUN git submodule init && git submodule update
WORKDIR $ROS_WS
ENV ROS_IP service-drone
# install ros package dependencies # install ros package dependencies
RUN apt-get update && \ RUN apt-get update && \
rosdep update && \ rosdep update && \
...@@ -59,21 +68,40 @@ COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh ...@@ -59,21 +68,40 @@ COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN useradd -m -s /bin/bash -p $(openssl passwd -1 password) ssher RUN useradd -m -s /bin/bash -p $(openssl passwd -1 password) ssher
RUN usermod -aG sudo ssher
RUN chmod 755 /usr/local/bin/bashCheckRoscore.sh && chmod 755 /usr/local/bin/ros_entrypoint.sh RUN chmod 755 /usr/local/bin/bashCheckRoscore.sh && chmod 755 /usr/local/bin/ros_entrypoint.sh
# make ssh-ing easier # make ssh-ing easier
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/ssher/.bashrc RUN echo "source /opt/ros/noetic/setup.bash" >> /home/ssher/.bashrc
RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/ssher/.bashrc RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/ssher/.bashrc
# also need to put env variables in here # also need to put env variables in here
RUN echo "ssh-keyscan -H service-master >> /home/ssher/.ssh/known_hosts" >> /home/ssher/.bashrc
RUN echo "ssh-keyscan -H service-drone >> /home/ssher/.ssh/known_hosts" >> /home/ssher/.bashrc
# these will be run with env loader but also nice to have from an ssh
RUN echo "export ROS_MASTER_URI=http://service-master:11311" >> /home/ssher/.bashrc RUN echo "export ROS_MASTER_URI=http://service-master:11311" >> /home/ssher/.bashrc
RUN echo "export ROS_HOSTNAME=service-drone" >> /home/ssher/.bashrc RUN echo "export ROS_HOSTNAME=service-drone" >> /home/ssher/.bashrc
# put rsa key in image # put environment file in ros folder, to be referenced by base station machines.launch file
RUN touch /opt/ros/noetic/kube_setup.sh \
&& echo "#!/bin/bash" > /opt/ros/noetic/kube_setup.sh \
&& echo "export ROS_WS=/opt/ros_ws" >> /opt/ros/noetic/kube_setup.sh \
&& echo "source /opt/ros_ws/devel/setup.bash" >> /opt/ros/noetic/kube_setup.sh \
&& echo "export PATH=/opt/ros/noetic/share/ros/bin:/opt/ros/noetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" >> /opt/ros/noetic/kube_setup.sh \
&& echo "export ROS_PACKAGE_PATH=/opt/ros_ws/src/drone-ros-packages/audio_common/audio_common:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_common_msgs:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_capture:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_play:/opt/ros_ws/src/drone-ros-packages/Onboard-SDK-ROS:/opt/ros_ws/src/drone-ros-packages/position_sync:/opt/ros_ws/src/drone-ros-packages/puredata:/opt/ros_ws/src/drone-ros-packages/audio_common/sound_play:/opt/ros/noetic/share:/opt/ros_ws" >> /opt/ros/noetic/kube_setup.sh \
&& echo "export ROS_MASTER_URI=http://service-master:11311" >> /opt/ros/noetic/kube_setup.sh \
&& echo "export ROS_HOSTNAME=service-drone" >> /opt/ros/noetic/kube_setup.sh \
&& echo 'exec "$@"' >> /opt/ros/noetic/kube_setup.sh
# also need to own and execute said setup file
RUN chown ssher /opt/ros/noetic/kube_setup.sh \
&& chmod +x /opt/ros/noetic/kube_setup.sh
# set up ssh stuff
RUN mkdir -p /home/ssher/.ssh RUN mkdir -p /home/ssher/.ssh
# COPY selfkey.pub /home/ssher/.ssh/authorized_keys # COPY selfkey.pub /home/ssher/.ssh/authorized_keys
RUN chown -R ssher:ssher /home/ssher/.ssh RUN chown -R ssher:ssher /home/ssher/.ssh
# RUN chmod 600 /home/ssher/.ssh/authorized_keys # RUN chmod 600 /home/ssher/.ssh/authorized_keys
RUN sudo service ssh start RUN service ssh start
EXPOSE 22 EXPOSE 22
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
......
#!/bin/bash #!/bin/bash
# set -e # set -e
# make sure to source ros work space so we can use the rostopic command # make sure to source ros work space so we can use the rostopic command
# source stuff
source /home/ssher/.bashrc
FILE="./resp.txt" FILE="./resp.txt"
OUT="confirm" OUT="confirm"
until [[ $OUT != "confirm" ]] until [[ $OUT != "confirm" ]]
......
...@@ -7,5 +7,12 @@ source "/opt/ros/$ROS_DISTRO/setup.bash" ...@@ -7,5 +7,12 @@ source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well # might need to source the devel space as well
source "$ROS_WS/devel/setup.bash" source "$ROS_WS/devel/setup.bash"
# put some stuff in the hosts file
# echo "service-drone.default.svc.cluster.local drone-0" >> /etc/hosts
# echo "service-master.default.svc.cluster.local base-0" >> /etc/hosts
# add service-base to known hosts
# ssh-keyscan -H service-drone
echo "==> Container ready" echo "==> Container ready"
exec "$@" exec "$@"
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: base-deployment name: base
labels: labels:
app: llhcluster app: cluster
node: base node: base
spec: spec:
# serviceName: service-master # must match metadata-name on headless service below
# statefulset.kubernetes.io/pod-name: service-master
replicas: 1 replicas: 1
# The deployment handles all matching templated pods # The deployment handles all matching templated pods
selector: selector:
matchLabels: matchLabels:
node: base node: base
# Template for a replica. app: cluster
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template: template:
metadata: metadata:
labels: labels:
app: cluster # gotta match spec-template-metadata-labels
node: base node: base
spec: spec:
hostname: service-master
containers: containers:
- name: base - name: base
image: llh/basestation:v0 image: llh/basestation:v0
args: command: ["/bin/bash"]
- roscore args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/ros_entrypoint.sh && roscore"]
ports: ports:
- containerPort: 11311 - containerPort: 11311
name: baseport name: baseport
# env:
# - name: ROS_IP
# value: service-master
nodeSelector: nodeSelector:
name: base name: base
...@@ -37,11 +42,18 @@ kind: Service ...@@ -37,11 +42,18 @@ kind: Service
metadata: metadata:
name: service-master name: service-master
labels: labels:
app: llhcluster app: cluster
node: base node: base
spec: spec:
# type: LoadBalancer
# externalTrafficPolicy: Local
selector:
# statefulset.kubernetes.io/pod-name: service-master
node: base
clusterIP: None clusterIP: None
ports: ports:
- port: 11311 - port: 11311
name: base
selector: selector:
node: base node: base
app: cluster
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: drone-deployment name: drone
labels: labels:
app: llhcluster app: cluster
node: drone node: drone
spec: spec:
# serviceName: "service-drone"
# statefulset.kubernetes.io/pod-name: service-drone
replicas: 1 replicas: 1
# The deployment handles all matching templated pods # The deployment handles all matching templated pods
selector: selector:
matchLabels: matchLabels:
node: drone node: drone
# Template for a replica. app: cluster
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template: template:
metadata: metadata:
labels: labels:
app: cluster
node: drone node: drone
spec: spec:
hostname: service-drone
containers: containers:
- name: drone - name: drone
securityContext: securityContext:
...@@ -28,20 +30,26 @@ spec: ...@@ -28,20 +30,26 @@ spec:
name: ttyacm name: ttyacm
- mountPath: /dev/dji_usb - mountPath: /dev/dji_usb
name: ttydji name: ttydji
- mountPath: /dev/video0
name: devvideo0
- mountPath: /dev/video1
name: devvideo1
image: llh/drone:v0 image: llh/drone:v0
command: ["/bin/bash"] command: [ "/bin/bash"] # You need to run some task inside a
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/ros_entrypoint.sh && sudo service ssh restart && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 armReady std_msgs/String 'ready'"] args: ["-c", "source /opt/ros_ws/devel/setup.bash && sudo service ssh restart && /usr/local/bin/ros_entrypoint.sh && while true; do sleep 10; done;"] # Our simple program just sleeps inside
# 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/ros_entrypoint.sh"]
# command: ["/bin/bash"]
# not running && /usr/local/bin/bashCheckRoscore.sh AND && sudo service ssh restart
ports: ports:
- containerPort: 11311 - containerPort: 11311
name: droneport name: droneport
env: env:
- name: ROS_MASTER_URI - name: ROS_MASTER_URI
value: http://service-master:11311 value: service-master
- name: ROS_HOSTNAME - name: ROS_HOSTNAME
value: service-drone value: service-drone
nodeSelector: nodeSelector:
name: base name: base # temp for testing purposes
volumes: volumes:
- name: ttyacm - name: ttyacm
hostPath: hostPath:
...@@ -49,6 +57,12 @@ spec: ...@@ -49,6 +57,12 @@ spec:
- name: ttydji - name: ttydji
hostPath: hostPath:
path: /dev/dji_usb path: /dev/dji_usb
- name: devvideo0
hostPath:
path: /dev/video0
- name: devvideo1
hostPath:
path: /dev/video1
--- ---
...@@ -57,14 +71,16 @@ kind: Service ...@@ -57,14 +71,16 @@ kind: Service
metadata: metadata:
name: service-drone name: service-drone
labels: labels:
app: llhcluster app: cluster
node: drone node: drone
spec: spec:
# Start a headless service # type: LoadBalancer
# https://kubernetes.io/docs/concepts/services-networking/service/#headless-services # externalTrafficPolicy: Local
selector:
app: cluster
# statefulset.kubernetes.io/pod-name: service-drone
node: drone
clusterIP: None clusterIP: None
ports: ports:
# Dummy port
- port: 11311 - port: 11311
selector: name: drone
node: drone
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