Hi everyone,
I have followed the instructions to install the RStudio Server app in GitHub - uabrc/bc_uab_rstudio_server: RStudio Server app for Open OnDemand and got to the point where I can see the Launch button. The rserver version 2023.12.0 and is run as an installed module in our system. I ssh into the compute node and see that the rserver process is running and listening to an open port.
However, when I click on the Launch button, the Sign In page shows up with Temporary server error. I searched over the OOD Discourse and found that there might be issue with the csrf_token generated and in use for authentication such as this thread: RStudio Server Issues - #9 by brad.traver.
Apparently, I miss something important in my configuration in template/before.script.erb
, submit.yaml.erb
and view.html.erb
as below, but cannot figure it out:
template/before.script.erb
:
export ONDEMAND_DIR="/tmp/${USER}/ood-rstudio-${SLURM_JOB_ID}"
mkdir -p "${ONDEMAND_DIR}"
# Create a flag to indicate script is starting
touch "${ONDEMAND_DIR}/starting"
# Set system library path
export LD_LIBRARY_PATH="/lib64:${LD_LIBRARY_PATH}"
# Define a password and export it for RStudio authentication
export password="$(create_passwd 16)"
export PASSWORD="${password}"
# Define CSRF_TOKEN and export it for auth
<%-
require 'securerandom'
csrftoken=SecureRandom.uuid
-%>
export csrf_token="<%= csrftoken %>"
submit.yml.erb
:
---
cluster: "midway3"
script:
native:
<% if !custom_account.blank? %>
- "-A"
- "<%= custom_account %>"
<% end %>
content: "template/script.sh.erb"
batch_connect:
template: "basic"
conn_params:
- csrf_token
form: "form.yml.erb"
attributes:
job_environment:
TERM: "xterm-256color"
USER: "<%= ENV['USER'] %>"
view.html.erb
:
<%-
base_url = "/rnode/#{host}/#{port}"
full_url = "#{base_url}"
%>
<head>
<meta charset="UTF-8">
</head>
<pre>
username: "<%= ENV["USER"] %>"
password: "<%= password %>"
token: "<%= csrf_token %>"
</pre>
<script>
document.cookie = "csrf-token=<%= csrf_token %>; path=/rnode/<%= host %>/<%= port %>; secure";
</script>
<form action="<%= full_url %>/auth-do-sign-in" method="post" target="_blank">
<input type="hidden" name="username" value="<%= ENV["USER"] %>">
<input type="hidden" name="password" value="<%= password %>">
<input type="hidden" name="staySignedIn" value="1">
<input type="hidden" name="appUri" value="">
<input type="hidden" name="csrf-token" value="<%= csrf_token %>" >
<button class="btn btn-primary" type="submit">
<i class="fa fa-registered"></i> Connect to RStudio Server
</button>
</form>
I added the <pre> ... </pre>
section to print out the info used for the http request for debugging purposes to make sure they are consistent with that in the output,log
file.
Could you please help me resolve the issue with the Temporary server error issue, or point me to where to look at? The rserver.log file doesn’t contain anything useful, other than the exec command that launched the rserver.
Looking at the RStudio Job in the OOD documentation
it seems to fail at steps 15-17 in the diagram.
Thanks in advance
-Trung