-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathscript.sh.erb
More file actions
executable file
·80 lines (66 loc) · 2.71 KB
/
Copy pathscript.sh.erb
File metadata and controls
executable file
·80 lines (66 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/bash -l
<% is_sofia = OodAppkit.clusters.any? { |c| c.id.to_s == "sofia" } %>
<%= ERB.new(File.read('../common_files/work_directory_change.sh.erb'), eoutvar: 'child').result(binding) %>
# Benchmark info
echo "TIMING - Starting main script at: $(date)"
# Set XDG_DATA_HOME to redirect the rstudio cache
if [[ -z "$XDG_DATA_HOME" ]]; then
export XDG_DATA_HOME="<%= is_sofia ? '$HOME' : '$VSC_DATA' %>/.local/share"
echo "setting XDG_DATA_HOME=$XDG_DATA_HOME"
fi
TOOLCHAIN=<%= context.toolchain %>
modules_to_load=()
case "${TOOLCHAIN}" in
2022a )
modules_to_load+=("RStudio-Server/2022.07.2+576-foss-2022a-Java-11-R-4.2.1")
modules_to_load+=("R-bundle-Bioconductor/3.15-foss-2022a-R-4.2.1")
;;
2023a )
modules_to_load+=("RStudio-Server/2023.12.1+402-gfbf-2023a-Java-11-R-4.3.2")
modules_to_load+=("R-bundle-Bioconductor/3.18-foss-2023a-R-4.3.2")
;;
2024a )
modules_to_load+=("RStudio-Server/2024.12.0+467-foss-2024a-R-4.4.2")
modules_to_load+=("R-bundle-Bioconductor/3.20-foss-2024a-R-4.4.2")
;;
2025a )
modules_to_load+=("RStudio-Server/2025.09.2+418-foss-2025a-R-4.5.1")
modules_to_load+=("R-bundle-Bioconductor/3.22-foss-2025a-R-4.5.1")
;;
* )
echo "ERROR: Unsupported toolchain selected"
exit 1
;;
esac
module load "${modules_to_load[@]}"
# PAM auth helper used by RStudio
export RSTUDIO_AUTH="$OOD_SESSION_STAGED_ROOT/bin/auth"
export RSESSION_LOG_FILE="$OOD_SESSION_STAGED_ROOT/rsession.log"
<%- unless context.global_prerun.empty? -%>
<%= context.global_prerun.gsub("\r", "") %>
<%- end -%>
# System preferences at $RSTUDIO_CONFIG_DIR/rstudio-prefs.json (default location = /etc/rstudio)
# User preferences have priority over system preferences
export RSTUDIO_CONFIG_DIR="$OOD_SESSION_STAGED_ROOT/config_dir"
CLEAN_WORKSPACE=<%= context.clean_workspace %>
if [[ "${CLEAN_WORKSPACE}" == "no" ]]; then
prefs_file=$RSTUDIO_CONFIG_DIR/rstudio-prefs.json
prefs=$(<$prefs_file) && jq '.load_workspace = true' <<<$prefs >$prefs_file
fi
# write environment to a file.
export > "$OOD_SESSION_STAGED_ROOT/env.sh"
RSESSION_WRAPPER_SCRIPT="$OOD_SESSION_STAGED_ROOT/rsession.sh"
RSESSION_CONFIG="$OOD_SESSION_STAGED_ROOT/etc/rsession.conf"
# Launch the RStudio Server
echo "Starting up rserver on $HOSTNAME with password $RSTUDIO_PASSWORD for $USER"
$EBROOTRSTUDIOMINSERVER/bin/rserver \
--rsession-path "${RSESSION_WRAPPER_SCRIPT}" \
--rsession-config-file "${RSESSION_CONFIG}" \
--www-port "${port}" \
--auth-none 0 \
--auth-pam-helper-path "${RSTUDIO_AUTH}" \
--auth-encrypt-password 0 \
--database-config-file "$OOD_SESSION_STAGED_ROOT/bin/database.conf" \
--server-data-dir "/tmp/run-$USER" \
--server-working-dir "$OOD_WD" \
--server-user "$USER"