diff --git a/Jenkinsfile b/Jenkinsfile index ea9bc57..b4d0d88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,7 +148,7 @@ ansiColor('xterm') { 'workbench': { node('docker') { checkout scm - def launcher_image = pullBuildPush( + def workbench_image = pullBuildPush( image_name: 'workbench', image_tag: "${RSPVersion}", build_args: "--build-arg RSP_VERSION=${RSPVersion}", @@ -160,7 +160,7 @@ ansiColor('xterm') { registry_url: 'https://075258722956.dkr.ecr.us-east-1.amazonaws.com', push: pushImage ) - print "Finished launcher" + print "Finished workbench" } }, '4.0': { diff --git a/helper/workbench/startup.sh b/helper/workbench/startup.sh index bf7b801..be970eb 100644 --- a/helper/workbench/startup.sh +++ b/helper/workbench/startup.sh @@ -24,6 +24,30 @@ deactivate() { } trap deactivate EXIT +# usage: use_init_files [file [file [...]]] +# ie: use_init_files /mydir/* +# execute or source initialization files (file extensions and permissions) +use_init_files() { + echo + local file + for file; do + case "$file" in + *.sh) + if [ -x "$file" ]; then + echo "$0: executing file $file" + "$file" + else + echo "$0: sourcing file $file" + echo "$0: no execute bit set" + . "$file" + fi + ;; + *) echo "$0: ignoring $file" ;; + esac + echo + done +} + # touch log files to initialize them su rstudio-server -c 'touch /var/lib/rstudio-server/monitor/log/rstudio-server.log' mkdir -p /var/lib/rstudio-launcher @@ -63,10 +87,16 @@ else fi fi +# Execute or source *.sh files from /entrypoint.d/ +# - note that order should be deterministic thanks to * magic +use_init_files /entrypoint.d/* + # Start Launcher if [ "$RSP_LAUNCHER" == "true" ]; then - /usr/lib/rstudio-server/bin/rstudio-launcher >> /var/log/rstudio-launcher.log 2>&1 & + /usr/lib/rstudio-server/bin/rstudio-launcher > /var/log/rstudio-launcher.log 2>&1 & wait-for-it.sh localhost:5559 -t $RSP_LAUNCHER_TIMEOUT +else + touch /var/log/rstudio-launcher.log fi tail -n 100 -f \ @@ -79,4 +109,4 @@ tail -n 100 -f \ # the main container process # cannot use "exec" or the "trap" will be lost -/usr/lib/rstudio-server/bin/rserver --server-daemonize 0 >> /var/log/rstudio-server.log 2>&1 +/usr/lib/rstudio-server/bin/rserver --server-daemonize 0 > /var/log/rstudio-server.log 2>&1