Integration - onboarding scripts execution

Has anyone integrated user onboarding automation into Open OnDemand for first login?

We currently have a set of commands/scripts that we run manually to onboard each new user. We are trying to avoid doing this by hand and would like to know whether Open OnDemand provides a clean way to hook this into the login flow.

What we would like is something like this:

when a user logs into Open OnDemand for the first time, a script is triggered automatically so the required onboarding steps are executed without manual intervention.

Has anyone implemented something similar?

Best regards!

Hi Christian!

There’s a couple ways in OOD I think this can be done that I know of. We have a pun_pre_hook_root_cmd which can be used if you need to do things in this onboarding like:

  • Write outside the user’s home directory
  • do anything with quotas
  • account provisioning
  • maybe more, but essentially anything the user can’t do themselves but needs root to do for them.

You can read about it here: ood_portal.yml — Open OnDemand 4.1.0 documentation

The other path forward is to use the rails initializer pattern as that runs for each user on login to spin up their rails environment. This would be for things like:

  • do anything within the user’s home directory
  • copy a config maybe
  • get info from the backend the user may need such as groups or accounts or favorites for the files app

I’m not sure this pattern is documented now that I search, but you likely know it: just have a file in the rails app under /etc/ood/config/apps/dashboard/initializers/ and it will be picked up automatically on each user’s dashboard load.

So, we do have some paths here but I’m not sure what it is the script does to decide which path.

1 Like

We do this with /etc/ood/profile which is run as root before the PUN starts.

The script looks like

# Get the username from the SUDO_COMMAND variable

OOD_USER=$(echo $SUDO_COMMAND | awk '{print $4}')
OOD_GID=$(id -g $OOD_USER)
OOD_HOME=/home/$OOD_USER

# Check if a home directory exists - if it does then we assume that the account is configured


if [ -d $OOD_HOME ]; then
  source /opt/ood/nginx_stage/etc/profile
  return
else
  echo “Adding $OOD_USER at $(date)” >> /var/log/ood_users.log
fi

# Set up the account
..
..
1 Like

Dear Christian,

what you referred to as onboarding is mostly similar to bootstrapping Kubernetes in Open OnDemand. I’ve already completed this setup and can confirm what Travis mentioned — that the OOD pun_pre_hook_root_cmd is indeed the critical point. Please find the relevant document below.

Kind regards,

2 Likes

Hi everyone!

I see a couple of interesting options here. The option that @travert described fits perfectly for us, but I’ll take a look at the other options too!

Thanks!