SciCatProject / scicatlive

Simple getting started procedure for SciCat
9 stars 10 forks source link

Add SciCat LandingPage container #29

Closed minottic closed 1 month ago

rkweehinzmann commented 5 months ago

The idea was to adopt the working example of PSI for a setup of a LandingPage Server to DESY's specifics. Using scicatlive we aimed at including the setup of the new server as a another service in scicatlive. As very first step we exercised the setup locally (on a Mac). Following https://github.com/SciCatProject/scicatlive?tab=readme-ov-file#add-a-new-service we adopted for step 3 this compose.yaml

services:
  landingpage:

    build:
      context: /Users/regina/Documents/work/scicatlive/LandingPageServer/.
      dockerfile: /Users/regina/Documents/work/scicatlive/LandingPageServer/Dockerfile

    ports:
      - 4201:80

    user: 0:0

However before running it we made sure that LandingPageServer image builds.

The build is successful using:

ROM node:20-alpine AS builder

RUN sed -i -e 's/^root::/root:!:/' /etc/shadow
RUN apk update && apk upgrade && \
    apk add --no-cache bash git openssh

RUN npm config set registry http://registry.npmjs.org/
RUN npm config set strict-ssl false

ARG env=production

# Prepare app directory
WORKDIR /home/node/app
COPY package*.json ./

# set up local user to avoid running as root
RUN chown -R node:node /home/node/app
USER node

# Install our packages
RUN npm ci
RUN ls -l /home/node/app
COPY --chown=node:node . /home/node/app/

# Build app
RUN npx ng build --configuration=${env}

FROM nginx:alpine

RUN sed -i -e 's/^root::/root:!:/' /etc/shadow
RUN rm -rf /usr/share/nginx/html/*

COPY --from=builder /home/node/app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY CI/ESS/google43e14584df796f63.html /usr/share/nginx/html

EXPOSE 80

where it's clear that some adoptions still need to be made. My guess would be now to run the compose.yaml as mentioned above.

minottic commented 5 months ago

this is building from a local Dockerfile (the one you have in /Users/regina/Documents/work/scicatlive/LandingPageServer/Dockerfile. What if you try to use this image? Does it work or gives any error?

rkweehinzmann commented 5 months ago

will try it! no errors sofar. But what do I have up to now? I have not entered the DataCite credentials anywhere which should go to some .env of a SciCat BE I think.

rkweehinzmann commented 5 months ago

there is a problem with this image, it contains configuration code, e.g. see https://github.com/SciCatProject/LandingPageServer/blob/develop/src/environments/environment.ts#L12 which fixes the backend connection. There are two options:

We go for the cleaner and more efficient option B.

minottic commented 4 months ago

I think the upstream already implements the option to pass config at run time. To double check, but if so, this is not blocked anymore by upstream