diff --git a/docker/Dockerfile.vlkb b/docker/Dockerfile.vlkb index 7673df84b90bc16569694b9a2dc4a9542934c596..7ffbf3fb0c1c26fe7f6e856b49170f9baa06dbe0 100644 --- a/docker/Dockerfile.vlkb +++ b/docker/Dockerfile.vlkb @@ -1,71 +1,60 @@ -FROM debian:bullseye-slim -LABEL Description="vlkb tomcat9" +# bullseye-slim = debian11 +#FROM debian:bullseye-slim +#LABEL Description="debian11 devel-env" +# Jammy Jellyfish = ubuntu22 +FROM tomcat:9-jre17-temurin-jammy +LABEL Description="ubuntu22 devel-env" -WORKDIR /root -ENV HOME /root +COPY deps/ast_9.2.9-1_amd64.deb /tmp/ RUN apt -y update \ - && apt -y install sudo procps psmisc tree wget curl vim make build-essential checkinstall git \ - libcfitsio-dev libpqxx-dev librabbitmq-dev libcsv-dev gfortran \ - openjdk-17-jre-headless unzip \ - rabbitmq-server openjdk-17-jre openjdk-17-jdk tomcat9 tomcat9-admin \ - postgresql-client \ - time montage + && apt -y install sudo procps psmisc curl wget vim make build-essential checkinstall tree htop unzip \ + libcfitsio-dev libpqxx-dev librabbitmq-dev libcsv-dev libdavix0v5 davix-dev gfortran \ + && dpkg -i /tmp/ast_9.2.9-1_amd64.deb \ + && echo "/usr/local/lib" > /etc/ld.so.conf.d/ast.conf \ + && ldconfig \ + && apt -y install rabbitmq-server openjdk-17-jre openjdk-17-jdk tomcat9 tomcat9-admin openssh-server \ + postgresql-client git -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 -ENV CATALINA_BASE=/var/lib/tomcat9 -ENV CATALINA_HOME=/usr/share/tomcat9 -ENV CATALINA_TMPDIR=/tmp -ENV WEBAPP_DIR=/webapps/vlkb-soda +USER root +COPY deps/tomcat-users.xml /etc/tomcat9/ +ENV CATALINA_BASE=/var/lib/tomcat9 \ + CATALINA_HOME=/usr/share/tomcat9 \ + CATALINA_TMPDIR=/tmp -COPY deps/ast_9.2.9-1_amd64.deb ./ -RUN dpkg -i /root/ast_9.2.9-1_amd64.deb && ldconfig \ - && mkdir -p ${WEBAPP_DIR} \ - && mkdir -p /srv/surveys && mkdir -p /srv/cutouts \ - && mkdir -p /etc/pki/tls +RUN useradd -ms /bin/bash devel \ + && usermod -aG sudo devel +USER devel +ENV USER=devel +WORKDIR /home/devel +ENV HOME=/home/devel -ARG VLKB_VERSION +RUN echo "alias vlkb-obscore-dbadd='vlkb-obscore /usr/local/etc/vlkb-obscore/datasets.conf dbadd '" > .bash_aliases -COPY vlkb-${VLKB_VERSION}.deb vlkb-obscore-${VLKB_VERSION}.deb vlkbd-${VLKB_VERSION}.deb ./ -COPY vlkb-soda-${VLKB_VERSION}.war ${WEBAPP_DIR}/ -RUN dpkg -i vlkb-${VLKB_VERSION}.deb vlkb-obscore-${VLKB_VERSION}.deb vlkbd-${VLKB_VERSION}.deb \ - && cd ${WEBAPP_DIR} && jar -xf vlkb-soda-${VLKB_VERSION}.war - -# Tomcat must load DB-driver (postgresql_*.jar), vlkb-soda does not explicitely load DB-drivers -COPY deps/postgresql-*.jar /var/lib/tomcat9/lib +# allow sudo without pwd and sudo no checks on hosts +USER root +RUN echo 'devel ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/develallowallcmds \ + && echo 'Defaults !fqdn' > /etc/sudoers.d/nodns +RUN mkdir /var/run/sshd \ + && echo 'root:deb11develenv' | chpasswd \ + && sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ + && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd -# configure instance +EXPOSE 22 +# vlkb-obscore*.deb installs to /usr/local +ARG VLKB_VERSION +COPY vlkb-obscore-${VLKB_VERSION}.deb ./ +RUN dpkg -i vlkb-obscore-${VLKB_VERSION}.deb ENV INST_DIR=/usr/local -COPY deps/vlkbd_exec.sh ${INST_DIR}/bin - -RUN mkdir -p ${INST_DIR}/etc/vlkb-obscore \ - && mkdir -p ${INST_DIR}/etc/vlkbd \ - && echo "${INST_DIR}/lib" > /etc/ld.so.conf.d/ast.conf \ - && ldconfig \ - && echo "fits_path_surveys=/srv/surveys" > $WEBAPP_DIR/WEB-INF/classes/cutout.properties - -# configure during docker build-time - -COPY deps/vlkb-obscore.datasets.conf ${INST_DIR}/etc/vlkb-obscore/datasets.conf -COPY deps/vlkbd.datasets.conf ${INST_DIR}/etc/vlkbd/datasets.conf - -# precofigure port 8080 (no SSL) -COPY deps/server.xml deps/server-connector.xml /etc/tomcat9/ - -# configure during docker run-time - -COPY start-soda.sh /root - -RUN echo "alias log-catalina='ls -t /var/log/tomcat9/catalina*.log | head -n 1 | xargs tail -200 '" >> /root/.bashrc$ -# run +COPY entrypoint.sh /root +RUN chmod +x /root/entrypoint.sh +CMD ["sh", "-c", "/root/entrypoint.sh"] -RUN pwd && chmod +x /root/start-soda.sh -CMD ["sh", "-c", "/root/start-soda.sh"] diff --git a/docker/Makefile b/docker/Makefile index a1c84524fab6c190b76ef4673471136d918e1b94..f8ff482dba8b36870153786c99657ceab2bd90c3 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -35,8 +35,8 @@ ast-9.2.9.tar.gz: build-soda: docker build --build-arg VLKB_VERSION=$(VERSION) -t soda -f Dockerfile.soda . -build-vlkb: - docker build --build-arg VLKB_VERSION=$(VERSION) -t vlkb -f Dockerfile.vlkb . +build-ingestion: + docker build --build-arg VLKB_VERSION=$(VERSION) -t ingestion -f Dockerfile.vlkb . # the docker-login below needed a ca-cert(?) which in the middle of the certificate-chain, @@ -47,10 +47,10 @@ build-vlkb: # to download: use image: ... in compose.yaml or # docker run ... git.ia2.inaf.it:5050/vialactea/vlkb-soda -publish-locally-soda: - docker tag soda git.ia2.inaf.it:5050/vialactea/vlkb-soda/soda:$(VERSION) - docker push git.ia2.inaf.it:5050/vialactea/vlkb-soda/soda:$(VERSION) - docker image rm git.ia2.inaf.it:5050/vialactea/vlkb-soda/soda:$(VERSION) +publish-locally-ingestion: + docker tag ingestion git.ia2.inaf.it:5050/vialactea/vlkb-soda/ingestion:$(VERSION) + docker push git.ia2.inaf.it:5050/vialactea/vlkb-soda/ingestion:$(VERSION) + docker image rm git.ia2.inaf.it:5050/vialactea/vlkb-soda/ingestion:$(VERSION) ##docker login registry.gitlab.com --> robert.butora xC*n diff --git a/docker/deps/tomcat-users.xml b/docker/deps/tomcat-users.xml new file mode 100644 index 0000000000000000000000000000000000000000..6587e75e97ec68e52749cd93b9e2a54f5a28e76d --- /dev/null +++ b/docker/deps/tomcat-users.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<tomcat-users xmlns="http://tomcat.apache.org/xml" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" + version="1.0"> +<!-- + NOTE: By default, no user is included in the "manager-gui" role required + to operate the "/manager/html" web application. If you wish to use this app, + you must define such a user - the username and password are arbitrary. It is + strongly recommended that you do NOT use one of the users in the commented out + section below since they are intended for use with the examples web + application. +--> +<!-- + NOTE: The sample user and role entries below are intended for use with the + examples web application. They are wrapped in a comment and thus are ignored + when reading this file. If you wish to configure these users for use with the + examples web application, do not forget to remove the <!.. ..> that surrounds + them. You will also need to set the passwords to something appropriate. +--> +<!-- + <role rolename="tomcat"/> + <role rolename="role1"/> + <user username="tomcat" password="<must-be-changed>" roles="tomcat"/> + <user username="both" password="<must-be-changed>" roles="tomcat,role1"/> + <user username="role1" password="<must-be-changed>" roles="role1"/> +--> + + <role rolename="manager-script"/> + <user username="admin" password="IA2lbt09" roles="manager-script"/> +</tomcat-users> + diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..6b99de38d2051abe8b6ab563b17fb3d067a338b1 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + + +{ +# echo "fits_path_datasets=/srv/datasets +echo "pg_uri=$OBSCORE_DB_URI" +echo "pg_schema=$OBSCORE_DB_SCHEMA" +echo "obscore_access_url=$OBSCORE_ACCESS_URL" +# echo obscore_access_format=application/fits +# echo log_dir=/tmp +# echo log_filename=vlkb-obscore.log +} > $INST_DIR/etc/vlkb-obscore/datasets.conf + + +/usr/sbin/sshd -D & + +wait -n + diff --git a/docker/example-compose-vlkb.yaml b/docker/example-compose-vlkb.yaml index 9268806e37b36dbf1dde81e37a6bc0794549d804..a2544195ed3272e8b2ebb1566b6a9d5df6fbba13 100644 --- a/docker/example-compose-vlkb.yaml +++ b/docker/example-compose-vlkb.yaml @@ -1,10 +1,12 @@ -version: '2' +#version: '2' services: + # from hot running the docker: psql -U postgres -l localhost vlkb-db: container_name: vlkb-db - image: git.ia2.inaf.it:5050/butora/vlkb-datasets/postgres-pgsphere:latest + image: git.ia2.inaf.it:5050/vialactea/vlkb-db/postgres-pgsphere:latest + #image: git.ia2.inaf.it:5050/butora/vlkb-datasets/postgres-pgsphere:latest #image: registry.gitlab.com/ska-telescope/src/visivo-vlkb-soda:1.5.2 hostname: vlkb-db ports: @@ -22,27 +24,20 @@ services: container_name: vlkb #image: soda:latest #image: git.ia2.inaf.it:5050/butora/vlkb-datasets/soda:latest - image: git.ia2.inaf.it:5050/vialactea/vlkb-soda/soda:1.6.3 + image: git.ia2.inaf.it:5050/vialactea/vlkb-soda/ingestion:1.7.10-7-g70b03e9 hostname: vlkb ports: - 8080:8080 environment: - #- SECURITY= - #- SECURITY=ia2token - #- VLKBOBSCORE_PG_URI=postgresql://vialactea:ia2vlkb@pasquale.ia2.inaf.it:5432/vialactea - - ACCESS_CONTEXT_ROOT=vlkb#datasets - #- URL_CUTOUTS=vlkb-devel.ia2.inaf.it:8004/cutouts - - URL_CUTOUTS=http://localhost:8080/vlkb/datasets/cutouts - - RESPONSE_FORMAT=application/x-vlkb+xml - #- RESPONSE_FORMAT=application/fits - #- RESPONSE_FORMAT=application/fits;createfile=yes - #- AMQP_QUEUE_NAME=vlkb#datasets + #-OBSCORE_DB_URI=postgresql://vialactea:ia2vlkb@pasquale.ia2.inaf.it:5432/vialacteadevel + - OBSCORE_DB_URI=postgresql://vialactea:ia2vlkb@vlkb-db:5432/vialactea + - OBSCORE_DB_SCHEMA=datasets + - OBSCORE_ACCESS_URL="somedummytext" volumes: - - /srv/vlkb/surveys:/srv/surveys:ro - - /srv/vlkb/cutouts:/srv/cutouts:rw + #- /media/robi/WORK/w/git/vlkb-soda/docker/start-vlkb.log:/tmp/start-vlkb.log:rw + - /srv/vlkb/surveys:/srv/datasets:ro #restart: always - volumes: postgres-data: