Merge pull request 'Initial support to workspace mount.' (#14) from andrea.dellamico/docker-jenkins-integration-test:master into master
Reviewed-on: #14
This commit is contained in:
commit
f9b1df95c9
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/var/log/workspace-lib/fuse-workspace.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>./var/log/workspace-lib/fuse-workspace.log%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
<totalSizeCap>100MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="org.gcube.data.access.storagehub.fs" level="WARN" />
|
||||
<logger name="org.gcube" level="WARN" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
|
||||
echo "Manage the user's workspace"
|
||||
workspace_dir='/workspace'
|
||||
workspace_logdir='/var/log/workspace-lib'
|
||||
workspace_libdir='/opt/workspace-lib'
|
||||
workspace_fuse_jar="$workspace_libdir/fuse-workspace.jar"
|
||||
|
||||
_decode_base64_url() {
|
||||
local len=$((${#1} % 4))
|
||||
local result="$1"
|
||||
if [ $len -eq 2 ]; then result="$1"'=='
|
||||
elif [ $len -eq 3 ]; then result="$1"'='
|
||||
fi
|
||||
echo "$result" | tr '_-' '/+' | base64 -d
|
||||
}
|
||||
|
||||
# $1 => JWT to decode
|
||||
# $2 => either 1 for header or 2 for body (default is 2)
|
||||
decode_jwt() { _decode_base64_url $(echo -n $1 | cut -d "." -f ${2:-2}) | jq .; }
|
||||
|
||||
|
||||
[[ ! -d "$workspace_dir" ]] || [[ -z `ls -A "$workspace_dir"` ]] || mv $workspace_dir ${workspace_dir}.old
|
||||
|
||||
mkdir -p $workspace_dir
|
||||
chown ${USER}:${USER} $workspace_dir
|
||||
chown -R ${USER}:${USER} $workspace_logdir
|
||||
|
||||
_retval=
|
||||
/bin/rm /home/${USER}/workspace
|
||||
_retval=$?
|
||||
if [ $_retval -ne 0 ]; then
|
||||
echo "The user has a directory named 'workspace' inside their home directory"
|
||||
echo "Not starting the workspace mount"
|
||||
exit
|
||||
else
|
||||
ln -s /home/${USER}/workspace $workspace_dir
|
||||
fi
|
||||
|
||||
echo "Mount the workspace"
|
||||
su - "$USER" -c "/usr/bin/java -cp .:${workspace_dir}:${workspace_logdir}/ -Dlogback.configurationFile=${workspace_logdir}/logback.xml -jar $workspace_fuse_jar $SHINYPROXY_OIDC_ACCESS_TOKEN $workspace_dir" >/dev/null 2>&1 &
|
||||
|
||||
exit ?$
|
11
Dockerfile
11
Dockerfile
|
@ -12,12 +12,10 @@ ENV DEFAULT_USER=rstudio
|
|||
ENV PANDOC_VERSION=default
|
||||
ENV PATH=/usr/lib/rstudio-server/bin:$PATH
|
||||
|
||||
|
||||
RUN /rocker_scripts/install_rstudio.sh
|
||||
RUN /rocker_scripts/install_pandoc.sh
|
||||
|
||||
# Add the mountpoint for the workspace
|
||||
RUN mkdir /workspace
|
||||
RUN apt-get update && apt-get install -y fuse zip jq
|
||||
|
||||
# This part comes from https://github.com/openanalytics/shinyproxy-rstudio-ide-demo/blob/master/Dockerfile
|
||||
RUN echo "www-frame-origin=same" >> /etc/rstudio/disable_auth_rserver.conf
|
||||
|
@ -32,6 +30,13 @@ ADD 03_setup_root_path.sh /etc/cont-init.d/03_setup_root_path
|
|||
#ADD 04_copy_env.sh /etc/cont-init.d/04_copy_env
|
||||
ADD 05_setup_rsession_parameters.sh /etc/cont-init.d/05_setup_rsession_parameters
|
||||
|
||||
# Prepare the workspace environment
|
||||
RUN mkdir -p /opt/workspace-lib
|
||||
RUN mkdir /var/log/workspace-lib
|
||||
ADD https://maven.d4science.org/nexus/content/repositories/gcube-snapshots/org/gcube/data-access/sh-fuse-integration/2.0.0-SNAPSHOT/sh-fuse-integration-2.0.0-20211005.090627-1-jar-with-dependencies.jar /workspace-lib/fuse-workspace.jar
|
||||
ADD 06_workspace_mount.sh /etc/cont-init.d/06_workspace_mount
|
||||
ADD 06-fuse-logback.xml /workspace-lib/logback.xml
|
||||
|
||||
EXPOSE 8787
|
||||
|
||||
CMD ["/init"]
|
||||
|
|
Loading…
Reference in New Issue