Skip to content

Commit

Permalink
Add M1M3TS deployment container.
Browse files Browse the repository at this point in the history
  • Loading branch information
wvreeven committed Feb 6, 2025
1 parent 111667f commit abb9f4c
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Jenkinsfile.cycle
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pipeline {
booleanParam defaultValue: false, description: "Build/push AudioTrigger Controller image.", name: 'build_audiotrigger_controller'
booleanParam defaultValue: false, description: "Build/push camera-specific GenericCamera images.", name: 'build_camspec_gencam'
booleanParam defaultValue: false, description: "Build/push M1M3 simulator image.", name: 'build_m1m3_sim'
booleanParam defaultValue: false, description: "Build/push M1M3 thermal image.", name: 'build_m1m3ts_sim'
booleanParam defaultValue: false, description: "Build/push VMS simulator image.", name: 'build_vms_sim'
booleanParam defaultValue: false, description: "Build/push pointing component deployment image.", name: 'build_ptg'
booleanParam defaultValue: false, description: "Build/push MTAOS image.", name: 'build_mtaos'
Expand Down Expand Up @@ -354,6 +355,34 @@ pipeline {
}
}
}
stage ('Build M1M3 thermal simulator') {
when {
expression { params.build_m1m3ts_sim }
}
steps {

script{

def cacheOption = params.set_cache_option ? "--no-cache" : ""

withEnv(["HOME=${env.WORKSPACE}"]) {
docker.withRegistry("https://ts-dockerhub.lsst.org/", "nexus3-lsst_jenkins") {
sh """
docker compose --env-file cycle/cycle.env -f cycle/docker-compose.yaml build ${cacheOption} mtm1m3ts_sim
docker compose --env-file cycle/cycle.env -f cycle/docker-compose.yaml build mtm1m3ts_sim_c
"""
}
}
}
script {
docker.withRegistry("https://ts-dockerhub.lsst.org/", "nexus3-lsst_jenkins") {
sh """
docker compose --env-file cycle/cycle.env -f cycle/docker-compose.yaml push mtm1m3ts_sim mtm1m3ts_sim_c
"""
}
}
}
}
stage ('Build VMS simulator') {
when {
expression { params.build_vms_sim }
Expand Down
88 changes: 88 additions & 0 deletions build/mtm1m3ts_sim/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
ARG cycle
ARG hub

FROM ${hub}/deploy-env:${cycle}

LABEL maintainer Tiago Ribeiro <[email protected]>

USER root

RUN dnf install -y dnf-plugins-core epel-release && \
dnf config-manager --set-enabled powertools && \
dnf -y --enablerepo=extras install make \
gcc-toolset-11 \
git \
catch-devel \
boost1.78 \
boost1.78-devel \
readline-devel \
snappy-devel \
spdlog-devel \
jansson \
iproute \
yaml-cpp-devel && \
dnf clean all

RUN ln -s /usr/lib64/libboost_filesystem.so.1.78.0 /usr/lib64/libboost_filesystem.so && \
ln -s /usr/lib64/libboost_iostreams.so.1.78.0 /usr/lib64/libboost_iostreams.so && \
ln -s /usr/lib64/libboost_program_options.so.1.78.0 /usr/lib64/libboost_program_options.so && \
ln -s /usr/lib64/libboost_system.so.1.78.0 /usr/lib64/libboost_system.so && \
ln -s /usr/lib64/libcurl.so.4 /usr/lib64/libcurl.so && \
ln -s /usr/lib64/libjansson.so.4 /usr/lib64/libjansson.so

ARG rpm

RUN dnf install -y \
--enablerepo=lsst-ts-test \
--disablerepo=lsst-ts \
MTM1M3TS-22.1.1-10.0.0.el8

ENV LSST_SDK_INSTALL=/opt/lsst/ts_sal/
ENV SAL_WORK_DIR=/opt/lsst/ts_sal/
ENV LSST_SAL_PREFIX=/opt/lsst/ts_sal/

USER saluser
WORKDIR /home/saluser/

ARG m1m3ts
ARG crio_cpp
ARG config

RUN git clone https://github.com/lsst-ts/ts_m1m3thermal && \
git clone https://github.com/lsst-ts/ts_cRIOcpp && \
git clone https://github.com/lsst-ts/ts_config_mttcs.git

WORKDIR /home/saluser/ts_config_mttcs

RUN /home/saluser/.checkout_repo.sh ${config}

WORKDIR /home/saluser/ts_cRIOcpp/

RUN /home/saluser/.checkout_repo.sh ${crio_cpp} && \
source /home/saluser/.setup_sal_env.sh && \
source scl_source enable gcc-toolset-11 && \
sed -i 's/boost169/boost1.78/' Makefile.inc && \
make

ENV WITH_SAL_KAFKA=1

WORKDIR /home/saluser/ts_m1m3thermal/

RUN /home/saluser/.checkout_repo.sh ${m1m3ts} && \
source /home/saluser/.setup_sal_env.sh && \
source scl_source enable gcc-toolset-11 && \
make simulator

WORKDIR /home/saluser/

COPY mtm1m3ts_sim/startup.sh /home/saluser/.startup.sh
COPY mtm1m3ts_sim/sal_setup.sh /home/saluser/.sal_setup.sh
COPY mtm1m3ts_sim/create_topics_mtm1m3ts.py /home/saluser/.create_topics_mtm1m3ts.py
USER root
RUN chown saluser:saluser /home/saluser/.startup.sh && \
chown saluser:saluser /home/saluser/.create_topics_mtm1m3ts.py && \
chmod a+x /home/saluser/.create_topics_mtm1m3ts.py && \
chmod a+x /home/saluser/.startup.sh
USER saluser

ENV RUN_ARG=""
11 changes: 11 additions & 0 deletions build/mtm1m3ts_sim/create_topics_mtm1m3ts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import asyncio
from lsst.ts import salobj


async def main():
async with salobj.Controller("MTM1M3TS"):
await asyncio.sleep(1)


if __name__ == "__main__":
asyncio.run(main())
58 changes: 58 additions & 0 deletions build/mtm1m3ts_sim/sal_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Configuration file to setup SAL environment. Default config assumes
# ts_opensplice is available in the same directory as ts_sal. You don't need to
# edit this file for the default config described in README.md.
#
# If needed, please change the LSST_SDK_INSTALL and OSPL_HOME to the actual
# locations before running the script.

BS_DIRNAME=$(dirname $BASH_SOURCE)
if [ $BS_DIRNAME = "." ]; then
export LSST_SDK_INSTALL=${LSST_SDK_INSTALL:=$(pwd)}
else
export LSST_SDK_INSTALL=${LSST_SDK_INSTALL:=$(pwd)/${BS_DIRNAME}}
fi


echo "LSST_SDK_INSTALL $LSST_SDK_INSTALL"

export SAL_HOME=$LSST_SDK_INSTALL/lsstsal
export SAL_WORK_DIR=$LSST_SDK_INSTALL/test

export SAL_CPPFLAGS=-m64
source $SAL_HOME/salenv.sh

if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
fi

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${SAL_HOME}/lib
export PATH=$JAVA_HOME/bin:${LSST_SDK_INSTALL}/bin:${PATH}

export SAL_IDL_DIR=${SAL_WORK_DIR}/idl-templates/validated/sal

export LSST_KAFKA_IP=`ip route get 1 | awk '{print $7;exit}'`
export LSST_KAFKA_SCHEMA_REGISTRY=${LSST_SCHEMA_REGISTRY_URL}
export LSST_KAFKA_HOST=${LSST_KAFKA_BROKER_ADDR%:*}
export LSST_KAFKA_BROKER_PORT=${LSST_KAFKA_BROKER_ADDR##*:}
export LSST_KAFKA_LOCAL_SCHEMAS=${LSST_SDK_INSTALL}
export LSST_KAFKA_PREFIX=${LSST_TOPIC_SUBNAME}
export LSST_KAFKA_SECURITY_PROTOCOL=SASL_PLAINTEXT
export LSST_KAFKA_SECURITY_MECHANISM=SCRAM-SHA-512
export OSPL_RELEASE=0.0.0

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${SAL_WORK_DIR}/lib:${LSST_SDK_INSTALL}/lib:/opt/lsst/ts_sal/lib
export TS_SAL_DIR=$LSST_SDK_INSTALL
export TS_XML_DIR=$LSST_SDK_INSTALL/../ts_xml
export AVRO_RELEASE=`$SAL_DIR/avro_release.tcl`
export AVRO_HOME=$SAL_HOME/lib
export AVRO_INCL=$SAL_HOME/include/avro
export AVRO_PREFIX=lsst.sal
export AVRO_CLASSPATH=lsst/sal

mkdir -p $LSST_SDK_INSTALL/lsstsal/lib
pushd $LSST_SDK_INSTALL
sal_version=`git describe --tags --dirty`
popd
export SAL_VERSION=$sal_version
echo "LSST middleware toolset environment "$sal_version" (Kafka) is configured."
echo "LSST_SDK_INSTALL=$LSST_SDK_INSTALL"
13 changes: 13 additions & 0 deletions build/mtm1m3ts_sim/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/bash

source ${HOME}/.setup_sal_env.sh
source ${HOME}/.sal_setup.sh
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/lsst/ts_sal/lib/

python ${HOME}/.create_topics_mtm1m3ts.py

/home/saluser/ts_m1m3thermal/ts-M1M3thermald ${RUN_ARG} -c /home/saluser/ts_m1m3thermal/SettingFiles &

pid="$!"

wait ${pid}
28 changes: 28 additions & 0 deletions cycle/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,26 @@ x-mtm1m3_sim:
config: ${ts_config_mttcs}
sal: ${ts_sal}

x-mtm1m3ts_sim:
&base-mtm1m3ts_sim
build:
context: ../build/
dockerfile: ./mtm1m3ts_sim/Dockerfile
labels:
com.description: "M1M3 thermal deployment image for cycle/revision ${CYCLE}${rev}."
sal: ${ts_sal}
xml: ${ts_xml}
m1m3ts: ${ts_m1m3thermal}
crio_cpp: ${ts_cRIOcpp}
args:
cycle: ${CYCLE}
hub: ${hub}
rpm: ${ts_xml}-${ts_sal}.el8.x86_64
m1m3ts: ${ts_m1m3thermal}
crio_cpp: ${ts_cRIOcpp}
config: ${ts_config_mttcs}
sal: ${ts_sal}

x-vms_sim:
&base-vms_sim
build:
Expand Down Expand Up @@ -1358,6 +1378,14 @@ services:
image: ${hub}/mtm1m3_sim:${CYCLE}
<<: *base-mtm1m3_sim

mtm1m3ts_sim:
image: ${hub}/mtm1m3ts_sim:${CYCLE}${rev}
<<: *base-mtm1m3ts_sim

mtm1m3ts_sim_c:
image: ${hub}/mtm1m3ts_sim:${CYCLE}
<<: *base-mtm1m3ts_sim

vms_sim:
image: ${hub}/vms_sim:${CYCLE}${rev}
<<: *base-vms_sim
Expand Down

0 comments on commit abb9f4c

Please sign in to comment.