Skip to content

Commit

Permalink
webui entrypoint
Browse files Browse the repository at this point in the history
- enable patching
- generate environment from env variables
  • Loading branch information
maany committed Jan 25, 2024
1 parent df75f9b commit fc41d57
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions webui/Dockerfile
Expand Up @@ -27,10 +27,10 @@ RUN python3 -m pip install --no-cache-dir j2cli

WORKDIR /opt/rucio/webui

ENV RUCIO_WEBUI_PATH=$(WORKDIR)
ENV RUCIO_WEBUI_PATH=/opt/rucio/webui

RUN curl https://raw.githubusercontent.com/rucio/rucio/master/tools/merge_rucio_configs.py --output /opt/rucio/merge_rucio_configs.py
RUN git clone --depth 1 -b ${TAG} -- https://github.com/rucio/webui.git /opt/rucio/webui
RUN git clone --depth 1 -b ${TAG} -- https://github.com/rucio/webui.git ${RUCIO_WEBUI_PATH}

RUN npm install
RUN npm run build
Expand Down
38 changes: 26 additions & 12 deletions webui/docker-entrypoint.sh
@@ -1,24 +1,36 @@
#!/bin/bash -e

log() {
echo "$(date -u) [rucio-webui] - $@"
}

generate_env_file() {
cd tools/env-generator && \

npm install liquidjs && \
npm run build && \
chmod +x ./dist/generate-env.js && \
./dist/generate-env.js make prod ../../.env --write

echo "Return code: $?"
cd ../..
}

echo "=================== /opt/rucio/webui/.env ==================="
if [ -f /opt/rucio/webui/.env ]; then
echo "/opt/rucio/webui/.env already mounted."
log "/opt/rucio/webui/.env already mounted."
else
echo "/opt/rucio/webui/.env not found. will generate one."
j2 /tmp/.env.default.j2 | sed '/^\s*$/d' > /opt/rucio/webui/.env
log "/opt/rucio/webui/.env not found. Will generate one now."
generate_env_file
fi

echo "=================== /opt/rucio/webui/.env ========================"
cat /opt/rucio/webui/.env
echo ""

if [ -d "/patch" ]
then
echo "Patches found. Trying to apply them"

TMP_PATCH_DIR="$(mktemp -d)"
trap 'rm -rf -- "$TMP_PATCH_DIR"' EXIT # Deletes temp dir when script exits

for patchfile in /patch/*.patch
echo "=================== Apply Patches ==================="
log "Patches found. Trying to apply them"
for patchfile in /patch/*
do
echo "Applying patch ${patchfile}"

Expand Down Expand Up @@ -50,7 +62,9 @@ then
fi
fi
done
log "Rebuilding the Rucio WebUI after applying patches!"
npm run build
fi

echo "=================== Starting RUCIO WEBUI ========================"
echo "=================== Starting RUCIO WEBUI ==================="
npm run start

0 comments on commit fc41d57

Please sign in to comment.