-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docker dir and update epics libs
- Loading branch information
Showing
8 changed files
with
202 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SINAP Timing Epics IOC | ||
|
||
> LNLS - Brazilian Synchrotron Light Laboratory | ||
> CNPEM - Brazilian Center for Research in Energy and Materials | ||
## Running the IOC | ||
|
||
See the repository registry to find the image. The image uses [ProcServ](https://linux.die.net/man/1/procserv) to run the IOC with parameters: | ||
|
||
- `i`: Configure IP address to connect to device | ||
- `t`: Configure procServ telnet port | ||
- `P`: Configure value of \$(P) macro | ||
- `R`: Configure value of \$(R) macro | ||
- `p`: Configure IP port number to connect to device | ||
- `d`: Configure Sinap Timing device type [EVG<number>|EVR<number>|EVE<number>|FOUT<number>] | ||
- `l`: Configure High-level events link to load at EVG | ||
|
||
E.g.: | ||
|
||
`docker run -d --name EVE01 -it -v /ioc-autosave/EVE01:/opt/epics/startup/ioc/sinap-timing-epics-ioc/iocBoot/ioctiming/autosave --net host ghcr.io/lnls-dig/sinap-timing-epics-ioc -i 192.168.0.1 -t 1000 -p 1001 -d EVE01 -P TEST: -R EVE01:` | ||
|
||
### How to build docker image | ||
|
||
Run `docker compose` from docker directory saving COMMIT_ID as environemnt variable: | ||
|
||
`COMMIT_ID=$(git rev-parse --short HEAD) docker compose build --build-arg .env` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*/O.*/ | ||
iocBoot/ioctiming/envPaths |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
BASE_VERSION=3.15.6 | ||
#COMMIT_ID=$(git rev-parse --short HEAD) | ||
DEBIAN_VERSION=debian:11.6-slim | ||
IOC_GROUP=lnls-dig | ||
IOC_REPO=sinap-timing-epics-ioc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#Start from image | ||
ARG DEBIAN_VERSION | ||
FROM ${DEBIAN_VERSION} | ||
|
||
#Define Environment Variables | ||
ARG BASE_VERSION | ||
ARG IOC_REPO | ||
ENV BOOT_DIR ioctiming | ||
|
||
#Install first dependencies | ||
RUN apt update && apt install -y \ | ||
build-essential \ | ||
procserv \ | ||
wget \ | ||
python3 && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
#Define Work directory as ioc repo | ||
WORKDIR /opt/epics/${IOC_REPO} | ||
|
||
#Install epics base and modules | ||
COPY ./docker/epics_setup.sh ./ | ||
RUN ./epics_setup.sh ${BASE_VERSION} && \ | ||
rm ./epics_setup.sh | ||
|
||
#Copy ioc files and compile | ||
COPY ./Makefile ./ | ||
COPY ./configure ./configure | ||
COPY ./timingApp ./timingApp | ||
COPY ./iocBoot ./iocBoot | ||
COPY ./install ./install | ||
RUN make install clean | ||
|
||
#Remove unused packages | ||
RUN apt update && \ | ||
apt remove -y \ | ||
build-essential \ | ||
wget && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set work directory to ioc boot and set ProcServ as entrypoint | ||
WORKDIR /opt/epics/startup/ioc/${IOC_REPO}/iocBoot/${BOOT_DIR} | ||
ENTRYPOINT ["./runProcServ.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "3.8" | ||
services: | ||
ioc: | ||
image: ghcr.io/${IOC_GROUP}/${IOC_REPO}:${COMMIT_ID} | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile | ||
labels: | ||
org.opencontainers.image.revision: ${COMMIT_ID} | ||
org.opencontainers.image.source: https://github.com/${IOC_GROUP}/${IOC_REPO} | ||
org.opencontainers.image.description: "SINAP Timing EPICS IOC container" | ||
args: | ||
BASE_VERSION: ${BASE_VERSION} | ||
COMMIT_ID: ${COMMIT_ID} | ||
DEBIAN_VERSION: ${DEBIAN_VERSION} | ||
IOC_GROUP: ${IOC_GROUP} | ||
IOC_REPO: ${IOC_REPO} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
export BASE="3.15.6" | ||
else | ||
export BASE=$1 | ||
fi | ||
|
||
# Versions to be installed | ||
export ASYN="4-33" | ||
export SEQ="2-2-6" | ||
export STREAM="2.8.8" | ||
export CALC="3-7-1" | ||
export AUTOSAVE="5-9" | ||
|
||
#Run apt update | ||
apt update | ||
|
||
# EPICS Base | ||
apt install -y libreadline-dev | ||
cd /opt | ||
mkdir epics-R${BASE} | ||
cd epics-R${BASE} | ||
wget https://epics-controls.org/download/base/base-${BASE}.tar.gz | ||
tar -xvzf base-${BASE}.tar.gz | ||
rm base-${BASE}.tar.gz | ||
mv base-${BASE} base | ||
cd base | ||
make install clean | ||
cd /opt/epics-R${BASE} | ||
mkdir modules | ||
|
||
# asynDriver | ||
cd /opt/epics-R${BASE}/modules | ||
wget https://github.com/epics-modules/asyn/archive/refs/tags/R${ASYN}.tar.gz | ||
tar -xvzf R${ASYN}.tar.gz | ||
rm R${ASYN}.tar.gz | ||
cd asyn-R${ASYN} | ||
sed -i -e "s|^.*EPICS_BASE=.*$|EPICS_BASE=/opt/epics-R${BASE}/base|" \ | ||
-e "s|^.*SNCSEQ=.*$|#SNCSEQ=|" \ | ||
-e "s|^.*CALC=.*$|#CALC=|" \ | ||
-e "s|^.*IPAC=.*$|#IPAC=|" \ | ||
-e "s|^.*SUPPORT=.*$|#SUPPORT=|" \ | ||
configure/RELEASE | ||
make install clean | ||
|
||
# Sequencer | ||
apt install -y re2c | ||
cd /opt/epics-R${BASE}/modules | ||
wget https://github.com/icshwi/sequencer-2-2/archive/refs/tags/R${SEQ}.tar.gz | ||
tar -xvzf R${SEQ}.tar.gz | ||
rm R${SEQ}.tar.gz | ||
cd /opt/epics-R${BASE}/modules/sequencer-2-2-R${SEQ} | ||
sed -i -e "s|^.*EPICS_BASE=.*$|EPICS_BASE=/opt/epics-R${BASE}/base|" configure/RELEASE | ||
make install clean | ||
|
||
#Calc | ||
cd /opt/epics-R${BASE}/modules | ||
wget https://github.com/epics-modules/calc/archive/R${CALC}.tar.gz | ||
tar -xvzf R${CALC}.tar.gz | ||
rm R${CALC}.tar.gz | ||
cd calc-R${CALC} | ||
sed -i -e "s|^.*SUPPORT=.*$|#SUPPORT=|" \ | ||
-e "8s/^/#/" \ | ||
-e "s|^.*SSCAN=.*$|#SSCAN=|" \ | ||
-e "s|^.*EPICS_BASE=.*$|EPICS_BASE=/opt/epics-R${BASE}/base|" \ | ||
configure/RELEASE | ||
make install clean | ||
|
||
#Stream | ||
apt install -y libpcre3 libpcre3-dev | ||
cd /opt/epics-R${BASE}/modules | ||
wget https://github.com/paulscherrerinstitute/StreamDevice/archive/${STREAM}.tar.gz | ||
tar -xvzf ${STREAM}.tar.gz | ||
rm ${STREAM}.tar.gz | ||
cd StreamDevice-${STREAM} | ||
sed -i -e "s|^.*EPICS_BASE=.*$|EPICS_BASE=/opt/epics-R${BASE}/base|" \ | ||
-e "s|^.*ASYN=.*$|ASYN=/opt/epics-R${BASE}/modules/asyn-R${ASYN}|" \ | ||
-e "s|^.*CALC=.*$|CALC=/opt/epics-R${BASE}/modules/calc-R${CALC}|" \ | ||
-e "23cPCRE_INCLUDE=/usr/include/pcre" \ | ||
-e "24cPCRE_LIB=/usr/lib64" \ | ||
configure/RELEASE | ||
make install clean | ||
|
||
# Autosave | ||
cd /opt/epics-R${BASE}/modules | ||
wget https://github.com/epics-modules/autosave/archive/R${AUTOSAVE}.tar.gz | ||
tar -xvzf R${AUTOSAVE}.tar.gz | ||
rm R${AUTOSAVE}.tar.gz | ||
cd autosave-R${AUTOSAVE} | ||
sed -i -e "s|^.*EPICS_BASE=.*$|EPICS_BASE=/opt/epics-R${BASE}/base|" \ | ||
-e "s|^.*SUPPORT=.*$|#SUPPORT=|" \ | ||
configure/RELEASE | ||
make install clean | ||
|
||
#Clean apt to reduce layer size | ||
apt clean | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters