Commit ce73f3a6 authored by Philipp Sebastian Sommer's avatar Philipp Sebastian Sommer
Browse files

Merge branch 'thredds-server' into 'main'

Thredds server

See merge request !1
parents 960f7fc9 5abd55ba
......@@ -147,3 +147,7 @@ users_config/
*.env
!docker/workspace/templates/*.env
docker/workspace/config/extensions/*.vsix
# thredds config and data
thredds/config
thredds/data
\ No newline at end of file
......@@ -6,11 +6,12 @@ ENV PYTHONUNBUFFERED=1
# install necessary libraries using apt-get
RUN apt-get update && \
apt-get install -y \
bash-completion vim \
bash-completion vim iputils-ping \
graphviz \
libpq-dev build-essential \
python3-venv python3-dev python3-psycopg2 \
python3.8-venv python3.8-dev
python3.8-venv python3.8-dev && \
rm -rf /var/lib/apt/lists/*
# install git-mob
RUN npm i -g git-mob
......@@ -21,4 +22,6 @@ RUN make -C /config/git-user-management install
ADD . /config/workspace_src
ENV PATH="/config/bin:${PATH}"
EXPOSE 8443
......@@ -7,7 +7,8 @@ networks:
volumes:
pgdata:
thredds-data:
thredds-config:
workspace:
users_config:
x-op-restart-policy: &restart_policy
restart: unless-stopped
......@@ -35,12 +36,12 @@ services:
code-server:
build: "."
hostname: "${CODE_SERVER_HOST:-code-server}"
<<: *restart_policy
volumes:
- "thredds-data:/config/workspace/thredds/data"
- "thredds-config:/config/workspace/thredds/config"
- "./workspace:/config/workspace"
- "./users_config:/config/users_config"
- "${TDS_DATA:-thredds-data}:/config/workspace/thredds/data"
- "${WORKSPACE_VOLUME:-workspace}:/config/workspace"
- "${USERS_CONFIG:-users_config}:/config/users_config"
networks:
- frontend
- backend
......@@ -55,6 +56,9 @@ services:
PUID: "${PUID:-1000}"
PGID: "${PGID:-1000}"
TZ: "${TZ:-Europe/Berlin}"
TDS_HOST: "${TDS_HOST:-thredds-server}"
TDS_MANAGER_USER: "${TDS_MANAGER_USER:-}"
TDS_MANAGER_PASSWORD: "${TDS_MANAGER_PASSWORD:-}"
DEFAULT_GIT_USER_NAME: "${DEFAULT_GIT_USER_NAME:-}"
DEFAULT_GIT_USER_EMAIL: "${DEFAULT_GIT_USER_EMAIL:-}"
depends_on:
......@@ -71,8 +75,25 @@ services:
PGID: "${PGID:-1000}"
TZ: "${TZ:-Europe/Berlin}"
volumes:
- "thredds-data:/config/workspace/thredds/data"
- "thredds-config:/config/workspace/thredds/config"
- "./workspace:/config/workspace"
- "${TDS_DATA:-thredds-data}:/config/workspace/thredds/data"
- "${WORKSPACE_VOLUME:-workspace}:/config/workspace"
ports:
- "${OPENSSHPORT:-2222}:2222"
thredds-server:
build: "./docker/thredds/"
hostname: "${TDS_HOST:-thredds-server}"
<<: *restart_policy
expose:
- "8080"
ports:
- "${TDS_PORT:-80}:8080"
volumes:
- "${TDS_DATA:-thredds-data}:/usr/local/tomcat/content/thredds/"
environment:
ALLOWED_MANAGER_HOSTS: "${CODE_SERVER_HOST:-code-server},${TDS_HOST:-thredds-server}"
MANAGER_USER: "${TDS_MANAGER_USER:-}"
MANAGER_PASSWORD: "${TDS_MANAGER_PASSWORD:-}"
networks:
- frontend
- backend
FROM unidata/thredds-docker:5.0-beta8
RUN cp -r /usr/local/tomcat/webapps.dist/manager/ /usr/local/tomcat/webapps
COPY custom_startup.sh /custom_startup.sh
ENTRYPOINT [ "/custom_startup.sh" ]
CMD ["catalina.sh", "run"]
\ No newline at end of file
#!/bin/bash
set -e
# insert user password
sed -i "\|^</tomcat-users>|i <role rolename=\"admin-gui\"/>" /usr/local/tomcat/conf/tomcat-users.xml
sed -i "\|^</tomcat-users>|i <role rolename=\"manager-gui\"/>" /usr/local/tomcat/conf/tomcat-users.xml
sed -i "\|^</tomcat-users>|i <role rolename=\"manager-script\"/>" /usr/local/tomcat/conf/tomcat-users.xml
if [[ "${MANAGER_USER}" != "" ]] && [[ "${MANAGER_PASSWORD}" != "" ]]; then
DIGEST_OUTPUT=`/usr/local/tomcat/bin/digest.sh -a "sha-512" ${MANAGER_PASSWORD}`
IFS=":" read -r -a SPLITTED <<< "${DIGEST_OUTPUT}"
DIGESTED_PW=${SPLITTED[1]}
sed -i "\|^</tomcat-users>|i <user username=\"${MANAGER_USER}\" password=\"${DIGESTED_PW}\" roles=\"admin-gui,manager-gui,manager-script\"/>" /usr/local/tomcat/conf/tomcat-users.xml
fi
# add hosts for manager app
if [[ "${ALLOWED_MANAGER_HOSTS}" != "" ]]; then
IFS="," read -r -a SPLITTED_HOSTS <<< "${ALLOWED_MANAGER_HOSTS}"
for ALLOWED_HOST in "${SPLITTED_HOSTS[@]}"; do
for HOST_IP in $(getent hosts ${ALLOWED_HOST} | awk '{ print $1 }'); do
ALLOWED_HOST_IPS=${ALLOWED_HOST_IPS}${HOST_IP}'|'
done
done
sed -i "s/allow=\"127.*\"/allow=\"${ALLOWED_HOST_IPS::-1}\"/g" /usr/local/tomcat/webapps/manager/META-INF/context.xml
fi
/entrypoint.sh "$@"
#!/bin/bash
curl --user ${TDS_MANAGER_USER}:${TDS_MANAGER_PASSWORD} http://${TDS_HOST}:8080/manager/text/reload?path=/thredds
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment