webepics / basic_ioc_interface

This contains containerized copies of the epics2web tomcat server, and two caproto testing IOCs.
2 stars 2 forks source link

Need to integrate epics2web max-bytes argument into docker build, rather than recompiling the .war #5

Open travisvalenti opened 5 years ago

travisvalenti commented 5 years ago

The max bytes argument in the epics2web config needed to be higher to support the large amount of PVs.

I couldn't at first find a way to use parameters or configs to do this through docker or similar, so I had to decompile the war, change the value, and recompile.

Perhaps there's a way to do this in a docker script?

travisvalenti commented 5 years ago

See the epics2web documentation

am50em commented 5 years ago

This appears to work.

FROM alpine as builder

ARG bbs=16384

ENV BBS=$bbs
ENV CATALINA_HOME /usr/local/tomcat
ENV EW_DIR /var/tmp/epics2web
ENV PATH $CATALINA_HOME/bin:$PATH
ENV TOMCAT_MAJOR 8
ENV TOMCAT_VERSION 8.5.38
ENV TOMCAT_TGZ_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz

RUN apk add apache-ant git openjdk8 curl

RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME
RUN set -x \
    && curl -fSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
    && curl -fSL "$TOMCAT_TGZ_URL.asc" -o tomcat.tar.gz.asc \
    && tar -xvf tomcat.tar.gz --strip-components=1 \
    && rm bin/*.bat \
    && rm tomcat.tar.gz*

RUN git clone https://github.com/JeffersonLab/epics2web.git $EW_DIR
WORKDIR $EW_DIR
RUN sed -i.orig "/<param-name>org.apache.tomcat.websocket.binaryBufferSize<\/param-name>/{n;s/<param-value>.*<\/param-value>/<param-value>${BBS}<\/param-value>/}" web/WEB-INF/web.xml
RUN ant war

FROM tomcat:8-alpine

ENV EW_DIR /var/tmp/epics2web
COPY lib/* /usr/local/tomcat/lib/
COPY --from=builder $EW_DIR/dist/epics2web.war /usr/local/tomcat/webapps/

ARG epics_ca_addr_list
ENV EPICS_CA_ADDR_LIST=$epics_ca_addr_list

EXPOSE 8080:8080

CMD ["catalina.sh", "run"]

Notes:

am50em commented 5 years ago
am50em commented 5 years ago
cd /work/mah131/Docker
git clone https://github.com/webepics/basic_ioc_interface.git
cd basic_ioc_interface
git branch tonym
git checkout tony
git branch
  master
* tonymi
git add docker-compose.yml ioc_to_websocket/Dockerfile
 git commit
[tonym ebf024f] Added multistage build and changed docker-compose.yml to use version 2 instaeaad of 3. This allows me to buil
 2 files changed, 34 insertions(+), 2 deletions(-)

Have not run this set yet

git push
fatal: The current branch tonym has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin tonym