### Starter Def File for VNC Container Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html An example Singularity definition file (.def) for creating a VNC container. It includes environment setup and package installations for XFCE, Python, websockify, and turbovnc. ```dockerfile Bootstrap: docker From: rockylinux/rockylinux:8 %environment PATH=/opt/TurboVNC/bin:$PATH LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" %post dnf install -y epel-release dnf groupinstall -y xfce dnf install -y python3-pip xorg-x11-xauth pip3 install ts dnf install -y https://yum.osc.edu/ondemand/latest/compute/el8Server/x86_64/python3-websockify-0.10.0-1.el8.noarch.rpm dnf install -y https://yum.osc.edu/ondemand/latest/compute/el8Server/x86_64/turbovnc-2.2.5-1.el8.x86_64.rpm dnf clean all chown root:root /opt/TurboVNC/etc/turbovncserver-security.conf rm -rf /var/cache/dnf/* ``` -------------------------------- ### Bash Scripting: Example Main Script (Simple HTTP Server) Source: https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/template.html This `template/script.sh` example shows how to launch a simple HTTP web server using Python's `SimpleHTTPServer`. It first purges existing module environments, loads the Python module, and then starts the server on the dynamically assigned port. Authentication is not included in this basic example. ```bash #!/bin/bash -l # Purge the module environment to avoid conflicts with user-specified # initialization files module purge # Load the Python module module load python # Launch the simple HTTP web server python -m SimpleHTTPServer "${port}" ``` -------------------------------- ### Container Start Arguments Configuration Example Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html Defines additional arguments to be passed to the container start command. This can be used to customize the container's execution environment. ```yaml container_start_args: [] ``` ```yaml container_start_args: - "--fakeroot" ``` -------------------------------- ### Container Module Loading Configuration Example Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html Demonstrates how to specify the module to load before starting the container. This is useful for environments where specific software modules need to be activated. ```yaml container_module: "singularity" ``` ```yaml container_module: "singularity/1.1.3" ``` -------------------------------- ### Bash Scripting: Example Before Hook Source: https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/template.html This example demonstrates a `template/before.sh` script that utilizes `find_port` to get an available port and `create_passwd` to generate a password. It exports these as environment variables and creates a password file, which are essential for securing web server access. ```bash # Find available port to run web server on export port=$(find_port) # Define a password and password file used for authentication password="$(create_passwd 12)" export PASSWORD_FILE="${PWD}/passwd" # Create password file used by web server (umask 077 && echo "${password}" > "${PASSWORD_FILE}") ``` -------------------------------- ### Install Python Packages with requirements.txt Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/python-starter-app.html This snippet details how to specify application dependencies in a `requirements.txt` file and then install them within an activated virtual environment using pip. It includes creating the `requirements.txt` file and the commands to activate the environment and install the packages. ```text # requirements.txt flask ``` ```bash source python-hello-world/bin/activate python3 -m pip install -r requirements.txt ``` -------------------------------- ### Start Keycloak Server using systemd Source: https://osc.github.io/ood-documentation/latest/authentication/tutorial-oidc-keycloak-rhel7/install-keycloak.html This snippet defines a systemd service file (`keycloak.service`) to manage the Keycloak server. It specifies the user, group, and the command to start the Keycloak standalone script. It also includes commands to reload the systemd daemon, start the Keycloak service, and check its status. ```bash sudo cat > /etc/systemd/system/keycloak.service <" command: - "/bin/save_passwd_as_secret" - "user-<%= user.name %>" ``` -------------------------------- ### Enable and Start Dex Service Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.8-release-notes.html Enables the `ondemand-dex` service to start automatically on boot and then starts the service immediately. This is required if the `ondemand-dex` package was installed and Dex authentication is being used. ```shell sudo systemctl enable ondemand-dex.service sudo systemctl start ondemand-dex.service ``` -------------------------------- ### Install and Start ondemand_exporter via RPM Source: https://osc.github.io/ood-documentation/latest/how-tos/monitoring/prometheus.html Commands to install the exporter package on RHEL-based systems and initialize the service. ```bash sudo yum install ondemand_exporter sudo systemctl restart httpd sudo systemctl start ondemand_exporter ``` -------------------------------- ### Full submit.yml Example for Jupyter Notebook Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-interactive-apps/k8s-jupyter.html A comprehensive example of a submit.yml file for launching a Jupyter notebook. It includes script configurations, container settings, environment variables, port mapping, resource allocation, configmap setup, host/NFS mounts, and multiple init containers for pre-launch configuration. ```yaml # submit.yml.erb <% pwd_cfg = "c.NotebookApp.password=u'sha1:${SALT}:${PASSWORD_SHA1}'" host_port_cfg = "c.NotebookApp.base_url='/node/${HOST_CFG}/${PORT_CFG}/'" configmap_filename = "ondemand_config.py" configmap_data = "c.NotebookApp.port = 8080" utility_img = "docker.io/ohiosupercomputer/ood-k8s-utils:v1.0.0" user = OodSupport::User.new %> --- script: accounting_id: "<%= account %>" wall_time: "<%= wall_time.to_i * 3600 %>" native: # here's the bulk of setting up the container. You'll likely need to specify all of these. container: name: "jupyter" image: "docker.io/jupyter/scipy-notebook:python-3.9.7" command: "/usr/local/bin/start.sh /opt/conda/bin/jupyter notebook --config=/ood/ondemand_config.py" working_dir: "<%= Etc.getpwnam(ENV['USER']).dir %>" restart_policy: 'OnFailure' env: NB_UID: "<%= user.uid %>" NB_USER: "<%= user.name %>" NB_GID: "<%= user.group.id %>" HOME: "<%= user.home %>" port: "8080" cpu: "<%= cpu %>" memory: "<%= memory %>Gi" configmap: files: - filename: "<%= configmap_filename %>" data: | c.NotebookApp.port = 8080 c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.disable_check_xsrf = True c.NotebookApp.allow_origin = '*' c.Application.log_level = 'DEBUG' mount_path: '/ood' mounts: - type: host name: home host_type: Directory path: <%= user.home %> destination_path: <%= user.home %> init_containers: - name: "init-secret" image: "<%= utility_img %>" command: - "/bin/save_passwd_as_secret" - "user-<%= user.name %>" - name: "add-passwd-to-cfg" image: "<%= utility_img %>" command: - "/bin/bash" - "-c" - "source /bin/passwd_from_secret; source /bin/create_salt_and_sha1; /bin/add_line_to_configmap \"<%= pwd_cfg %>\" <%= configmap_filename %>" - name: "add-hostport-to-cfg" image: "<%= utility_img %>" command: - "/bin/bash" - "-c" - "source /bin/find_host_port; /bin/add_line_to_configmap \"<%= host_port_cfg %>\" <%= configmap_filename %>" ``` -------------------------------- ### Start and Enable libcgroup Services Source: https://osc.github.io/ood-documentation/latest/installation/resource-manager/linuxhost.html Commands to start and enable the `cgconfig` and `cgred` services, which are necessary for applying cgroup configurations and rules. ```bash sudo systemctl start cgconfig sudo systemctl start cgred sudo systemctl enable cgconfig sudo systemctl enable cgred ``` -------------------------------- ### Manage Ruby Dependencies Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/ruby-starter-app.html Defines application dependencies using a Gemfile and installs them locally into the vendor/bundle directory. ```ruby # frozen_string_literal: true source 'https://rubygems.org' gem 'sinatra' ``` ```bash bundle config path --local vendor/bundle bundle install ``` -------------------------------- ### Initialize cleanup environment Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/basic-bc-options.html Example of setting the PATH and sourcing the cleanup script in a shell environment. ```Bash PATH=$PATH:/opt/ood-clean/bin source clean.sh ``` -------------------------------- ### Start Listening Server with Netcat (Bash) Source: https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/setup/enable-reverse-proxy.html This bash command uses netcat (nc) to start a simple listening server on a specified port (5432 in this example). This is used to test the reverse proxy by allowing connections from the browser to a service running on a compute node. ```bash nc -l 5432 ``` -------------------------------- ### Install ondemand_exporter from Source Source: https://osc.github.io/ood-documentation/latest/how-tos/monitoring/prometheus.html Manual installation steps for downloading, extracting, and configuring the exporter binary and systemd service. ```bash VERSION="0.10.0" ARCHIVE="ondemand_exporter-${VERSION}.linux-amd64" wget -O /tmp/${ARCHIVE}.tar.gz https://github.com/OSC/ondemand_exporter/releases/download/v${VERSION}/${ARCHIVE}.tar.gz tar xf /tmp/${ARCHIVE}.tar.gz -C /tmp sudo install -o root -g root -m 0755 /tmp/${ARCHIVE}/ondemand_exporter /usr/bin/ondemand_exporter sudo install -o root -g root -m 0440 /tmp/${ARCHIVE}/files/sudo /etc/sudoers.d/ondemand_exporter sudo install -o root -g root -m 0644 /tmp/${ARCHIVE}/files/ondemand_exporter.service /etc/systemd/system/ sudo systemctl daemon-reload ``` -------------------------------- ### Build and install Dex from source Source: https://osc.github.io/ood-documentation/latest/authentication/dex.html Compiles the Dex binary from the official repository, sets up the required system user/group, and installs necessary web assets and systemd service files. ```bash GOPATH=$(go env GOPATH) go get github.com/dexidp/dex cd $GOPATH/src/github.com/dexidp/dex make build sudo install -m 0755 bin/dex /usr/sbin/ondemand-dex sudo groupadd -r ondemand-dex sudo useradd -r -d /var/lib/ondemand-dex -g ondemand-dex -s /sbin/nologin -c "OnDemand Dex" ondemand-dex cd /tmp git clone https://github.com/OSC/ondemand-dex sudo mkdir /usr/share/ondemand-dex sudo cp -R ondemand-dex/web /usr/share/ondemand-dex/web sudo install -m 0644 ondemand-dex/examples/ondemand-dex.service /etc/systemd/system/ondemand-dex.service ``` -------------------------------- ### Download and Unpack Keycloak Source: https://osc.github.io/ood-documentation/latest/authentication/tutorial-oidc-keycloak-rhel7/install-keycloak.html Downloads Keycloak 9.0.0 and unpacks it to the /opt directory. This is the initial step for setting up the Keycloak server. ```bash cd /opt sudo wget https://downloads.jboss.org/keycloak/9.0.0/keycloak-9.0.0.tar.gz sudo tar xzf keycloak-9.0.0.tar.gz ``` -------------------------------- ### Install Dex Authentication Package Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.8-release-notes.html Installs the `ondemand-dex` package, which is recommended for sites previously using Apache's Basic Auth (e.g., with LDAP) to switch to Dex Authentication. This package provides the Dex OIDC provider for OnDemand. ```shell sudo yum install ondemand-dex ``` -------------------------------- ### Download and Install Kubectl on OnDemand Web Node Source: https://osc.github.io/ood-documentation/latest/installation/resource-manager/kubernetes.html Downloads and installs the kubectl binary on the OnDemand web node. This allows the web node to communicate with the Kubernetes cluster. Replace $VERSION with the desired Kubernetes version. ```bash wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v$VERSION/bin/linux/amd64/kubectl chmod +x /usr/local/bin/kubectl ``` -------------------------------- ### Dex Frontend Configuration Example Source: https://osc.github.io/ood-documentation/latest/authentication/dex.html Example of configuring the frontend theme and directory for Dex. This setting affects the look and feel of the Dex interface. The 'dir' key specifies the web assets directory, and 'theme' sets the visual theme. ```yaml frontend: dir: "/usr/share/ondemand-dex/web" theme: "ondemand" ``` -------------------------------- ### Install JDK 1.8.0 Source: https://osc.github.io/ood-documentation/latest/authentication/tutorial-oidc-keycloak-rhel7/install-keycloak.html Installs the OpenJDK 1.8.0 development kit, which is a prerequisite for running Keycloak. ```bash sudo yum install java-1.8.0-openjdk-devel ``` -------------------------------- ### Basic submit.yml.erb Example Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml-erb.html A simple example of a submit.yml.erb file demonstrating the 'script' and 'batch_connect' attributes with a 'basic' template. ```erb # a simple script.yml.erb file script: native: - "-n" - "1" batch_connect: template: "basic" header: "#!/bin/bash" ``` -------------------------------- ### Create Keycloak User and Set Ownership Source: https://osc.github.io/ood-documentation/latest/authentication/tutorial-oidc-keycloak-rhel7/install-keycloak.html Creates a dedicated 'keycloak' user and group, and sets the ownership of the Keycloak installation directory to this user. This ensures proper permissions for running the Keycloak server. ```bash sudo groupadd -r keycloak sudo useradd -m -d /var/lib/keycloak -s /sbin/nologin -r -g keycloak keycloak sudo install -d -o keycloak -g keycloak /var/lib/keycloak sudo chown keycloak: -R keycloak-9.0.0 ``` -------------------------------- ### Pass Native Scheduler Arguments (SLURM Example) Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/script.html Allows passing native arguments directly to the scheduler's submit command. This example demonstrates SLURM-specific arguments for nodes, cores, and memory, using form variables. ```yaml native: - "-N" - "1" - "-n" - "<%= num_cores %>" - "--mem" - "<%= memory %>" ``` -------------------------------- ### Install and Build Keycloak Duo SPI Source: https://osc.github.io/ood-documentation/latest/authentication/duo-2fa-with-keycloak.html Commands to clone the repository, build the SPI using either Docker or local Maven, and deploy the resulting JAR and template files to the Keycloak installation directory. ```bash git clone https://github.com/OSC/keycloak-duo-spi.git cd keycloak-duo-spi git submodule update --init ``` ```bash docker run --rm -it -v $(pwd):/keycloak-duo-spi -w /keycloak-duo-spi \ ohiosupercomputer/keycloak_duo_spi_buildbox:latest mvn clean test package ``` ```bash yum -y install maven cd build/duo_java/DuoWeb mvn clean test install cd ../../.. mvn clean test package ``` ```bash sudo install -o keycloak -g keycloak -m 0644 target/keycloak-duo-spi-jar-with-dependencies.jar \ /opt/keycloak-9.0.0/standalone/deployments/keycloak-duo-spi-jar-with-dependencies.jar sudo install -o keycloak -g keycloak -m 0644 src/main/resources/duo-mfa.ftl \ /opt/keycloak-9.0.0/themes/base/login/duo-mfa.ftl sudo install -o keycloak -g keycloak -m 0644 /dev/null \ /opt/keycloak-9.0.0/standalone/deployments/keycloak-duo-spi-jar-with-dependencies.jar.dodeploy ``` -------------------------------- ### Job Template Manifest Example Source: https://osc.github.io/ood-documentation/latest/customizations.html Defines the structure and example content for a job template's manifest.yml file, which includes metadata like name, host, script, and notes. ```yaml name: A Template Name host: ruby script: ruby.sh notes: Notes about the template, such as content and function. ``` -------------------------------- ### Slurm bin_overrides Example (YAML) Source: https://osc.github.io/ood-documentation/latest/installation/cluster-config-schema.html This example demonstrates how to use 'bin_overrides' for the Slurm adapter to specify alternative paths for resource manager client executables. It shows overriding commands like squeue and sbatch, while noting that unsupported commands (like bsub for Slurm) are ignored. ```yaml # An example in Slurm job: adapter: "slurm" bin: "/opt/slurm/bin" conf: "/opt/slurm/etc/slurm.conf" bin_overrides: squeue: "/usr/local/slurm/bin/squeue_wrapper" # Override just want you want/need to # scontrol: "/usr/local/slurm/bin/scontrol_wrapper" sbatch: "/usr/local/slurm/bin/sbatch_wrapper" # Will be ignored because bsub is not a command used in the Slurm adapter bsub: "/opt/lsf/bin/bsub" ``` -------------------------------- ### Cloudy Cluster YAML Configuration Example Source: https://osc.github.io/ood-documentation/latest/installation/resource-manager/ccq.html A sample YAML configuration file for setting up a Cloudy Cluster resource manager. This configuration specifies cluster metadata, login host, job adapter details, cloud provider, scheduler name, binary paths, and a regular expression for job ID extraction. It also includes commented-out examples for overriding CCQ client binaries. ```yaml --- v2: metadata: title: "My Cluster" login: host: "my_cluster.my_center.edu" job: adapter: "ccq" image: "my-default-image" cloud: "gcp" scheduler: "my_scheduler" bin: "/path/to/other/CCQ" jobid_regex: "different job_id regex: (?\\d+) " # bin_overrides: # ccqstat: "/usr/local/bin/ccqstat" # ccqdel: "" # ccqsub: "" ``` -------------------------------- ### Update OnDemand Release RPM Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.8-release-notes.html Installs the OnDemand release RPM for version 1.8, which is a prerequisite for updating OnDemand itself. This command uses `yum` to install the specified RPM package from a URL. ```shell sudo yum install -y https://yum.osc.edu/ondemand/1.8/ondemand-release-web-1.8-1.noarch.rpm ``` -------------------------------- ### Configure config.ru for Ruby Applications Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/ruby-starter-app.html Defines the entry point for Rack-based Ruby applications. Includes specific configurations for Sinatra and Ruby on Rails frameworks. ```ruby # frozen_string_literal: true require_relative 'app' run App ``` ```ruby # frozen_string_literal: true require_relative 'config/environment' run Rails.application Rails.application.load_server ``` -------------------------------- ### Create Basic Python WSGI App Entrypoint Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/python-starter-app.html This snippet demonstrates creating the `passenger_wsgi.py` file, which serves as the entrypoint for a Python WSGI application. It outlines the necessary commands to create the file and provides the basic Python code to return a 'Hello World' message and the Python version. ```bash cd ~/ondemand/dev mkdir python-hello-world cd python-hello-world touch passenger_wsgi.py ``` ```python # passenger_wsgi.py import sys def application(environ, start_response): start_response('200 OK', [('Content-type', 'text/plain')]) return ["Hello World from Open OnDemand (Python WSGI)!\n\n" + sys.version] ``` -------------------------------- ### Update OnDemand Release RPM (Bash) Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.7-release-notes.html Installs the OnDemand release RPM for version 1.7. This is the first step in the upgrade process. ```bash sudo yum install -y https://yum.osc.edu/ondemand/1.7/ondemand-release-web-1.7-1.noarch.rpm ``` -------------------------------- ### Configure and Deploy Application Manifest Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/ruby-starter-app.html Configures the manifest.yml for dashboard integration and provides shell commands for version control and production deployment. ```yaml name: Quota description: Display quotas icon: fa://hdd-o category: Files subcategory: Utilities ``` ```bash git add . git commit -m "update manifest for production" git push origin master # as sudo on OnDemand host: cd /var/www/ood/apps/sys git clone /users/PZS0562/efranz/ondemand/dev/quota ``` -------------------------------- ### Define Application Configuration and Paths Source: https://osc.github.io/ood-documentation/latest/reference/files/nginx-stage-yml.html Configures how Open OnDemand discovers and serves applications. Includes definitions for app configuration files, root directories, and request URI patterns. ```yaml pun_app_configs: - env: dev name: "*" owner: "%{user}" app_config_path: dev: "/var/lib/ondemand-nginx/config/apps/dev/%{owner}/%{name}.conf" usr: "/var/lib/ondemand-nginx/config/apps/usr/%{owner}/%{name}.conf" sys: "/var/lib/ondemand-nginx/config/apps/sys/%{name}.conf" app_root: dev: "/var/www/ood/apps/dev/%{owner}/gateway/%{name}" usr: "/var/www/ood/apps/usr/%{owner}/gateway/%{name}" sys: "/var/www/ood/apps/sys/%{name}" app_request_uri: dev: "/dev/%{name}" usr: "/usr/%{owner}/%{name}" sys: "/sys/%{name}" ``` -------------------------------- ### Include Sinatra Gems in Gemfile Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.8-release-notes.html Adds essential Sinatra gems to the application Gemfile, allowing lightweight Ruby applications to run without local dependency installation. ```ruby gem "sinatra", require: false gem "sinatra-contrib", require: false gem "erubi", require: false ``` -------------------------------- ### Update OnDemand Package Source: https://osc.github.io/ood-documentation/latest/release-notes/v1.8-release-notes.html Cleans the yum cache and then updates the OnDemand package to the latest available version. This ensures that all OnDemand components are brought up to date after the release RPM has been installed. ```shell sudo yum clean all sudo yum update ondemand ``` -------------------------------- ### Implement Sinatra Application Logic Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/ruby-starter-app.html A basic implementation of a Sinatra application class that defines a root route returning 'Hello World'. ```ruby require 'sinatra/base' class App < Sinatra::Base get '/' do 'Hello World' end end ``` -------------------------------- ### Container Command Configuration Example Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html Specifies the command used to initiate the container. This allows flexibility in choosing the container runtime, such as 'singularity' or 'apptainer'. ```yaml container_module: "singularity" ``` ```yaml container_module: "apptainer" ``` -------------------------------- ### Add Help Text to Form Field Source: https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/form.html This snippet shows how to add descriptive help text below a form field. The 'help' option supports Markdown formatting, allowing for rich text explanations, bullet points, and code examples to guide the user. ```yaml help: | Please fill in this field with **one** of the following options: - `red` - `blue` - `green` ``` -------------------------------- ### Copy Application to Production Directory Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/nodejs-starter-app.html This command, executed as root (sudo) on the OnDemand host, clones a user's development application repository into the system's production applications directory (`/var/www/ood/apps/sys`). This is the final step in making the application available in the production environment. ```bash # as sudo on OnDemand host: cd /var/www/ood/apps/sys git clone /users/PZS0562/efranz/ondemand/dev/quota ``` -------------------------------- ### Custom Error Page for Missing Home Directory Source: https://osc.github.io/ood-documentation/latest/customizations.html Provides an example of a custom HTML error page to display when a user's home directory is missing upon launching an OnDemand application. This page guides the user to create their home directory using the shell app. ```html Home Directory Missing

Your home directory is missing.

Please click the link below to open a shell and create your home directory.

Open Shell ``` -------------------------------- ### Create Custom Ruby Wrapper Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/ruby-starter-app.html A shell script wrapper to execute the application using a specific version of Ruby, overriding the default environment. ```bash #!/bin/bash # OnDemand uses ruby 3.3, but this application uses 3.0. module load ruby/3.0 exec /bin/env ruby "$@" ``` -------------------------------- ### Set OOD Cluster Attribute Values (num_cores) Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-interactive-apps/add-matlab/edit-form-yml.html Specifies attribute values for form elements within an Open OnDemand cluster configuration. This example shows how to set minimum, maximum, and step values for the 'num_cores' attribute, tailored for the OSC Owens cluster. It also includes a help text to guide the user. ```yaml --- attributes: num_cores: widget: "number_field" label: "Number of cores" value: 1 help: | Number of cores on node type (4 GB per core unless requesting whole node). Leave blank if requesting full node. min: 0 max: 48 step: 1 id: 'num_cores' ``` -------------------------------- ### Install OnDemand Release RPM (Bash) Source: https://osc.github.io/ood-documentation/latest/release-notes/v2.0-release-notes.html Command to install the OnDemand release RPM package, which is the first step in upgrading OnDemand. This command uses `yum` to install from a provided URL. ```bash sudo yum install -y https://yum.osc.edu/ondemand/2.0/ondemand-release-web-2.0-1.noarch.rpm ``` -------------------------------- ### Configure Interactive App for Singularity Container Source: https://osc.github.io/ood-documentation/latest/installation/resource-manager/linuxhost.html Example configuration for a submit.yml file to define Singularity bind paths and container images for an interactive application. ```yaml --- batch_connect: template: vnc script: native: singularity_bindpath: /fs,/home singularity_container: /usr/local/modules/netbeans/netbeans_2019.sif ``` -------------------------------- ### Install ondemand-dex package Source: https://osc.github.io/ood-documentation/latest/authentication/dex.html Installs the Dex authentication package using system package managers for RHEL/CentOS or Debian/Ubuntu distributions. ```bash sudo yum install ondemand-dex ``` ```bash sudo apt-get install ondemand-dex ``` -------------------------------- ### Initialize Node.js Application Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/nodejs-starter-app.html Initializes a new Node.js application directory and its package.json file using npm. It's important to note that for OnDemand to recognize the application, the 'main' attribute in package.json should be 'app.js', not the default 'index.js'. ```bash cd ~/ondemand/dev mkdir nodejs-hello-world cd nodejs-hello-world npm init ``` -------------------------------- ### Restrict Access to Keycloak Standalone Directory Source: https://osc.github.io/ood-documentation/latest/authentication/tutorial-oidc-keycloak-rhel7/install-keycloak.html Restricts access to the 'standalone' directory within the Keycloak installation to the 'keycloak' user. This is a security measure to protect sensitive server data. ```bash cd keycloak-9.0.0 sudo -u keycloak chmod 700 standalone ``` -------------------------------- ### Add Express Web Framework to Node.js App Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/nodejs-starter-app.html Adds the Express web framework to a Node.js project and installs the necessary packages. Express is used to route requests to appropriate pages within the application. ```bash npm add express npm install ``` -------------------------------- ### Define Job Start Time Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/script.html Specifies the desired start time for the job. If not set (nil), schedulers typically interpret it as 'now' or 'as soon as possible'. ```yaml start_time: nil ``` ```yaml start_time: "00:00:00" ``` -------------------------------- ### Display nginx_stage Help Reference Source: https://osc.github.io/ood-documentation/latest/reference/commands/nginx-stage/usage.html This command displays a quick reference of the capabilities offered by the nginx_stage utility. It is useful for understanding the available commands and their general options. ```bash nginx_stage [COMMAND] --help ``` -------------------------------- ### Container Bind Path Configuration Example Source: https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html Shows how to configure paths to be mounted inside the container. This allows access to host file systems or specific directories from within the containerized VNC session. ```yaml container_bindpath: "" ``` ```yaml container_bindpath: "/etc,/dev,/usr" ``` -------------------------------- ### Scan MapFile using ood_auth_map utility Source: https://osc.github.io/ood-documentation/latest/authentication/overview/map-user.html Demonstrates how to use the ood_auth_map binary to resolve remote usernames to local users. It covers both default and custom mapfile locations, as well as the behavior when no mapping is found. ```bash # Scan default mapfile with URL-encoded username /opt/ood/ood_auth_map/bin/ood_auth_map.mapfile 'http%3A%2F%2Fcilogon.org%2FserverA%2Fusers%2F58606%40cilogon.org' # Scan custom mapfile with standard username /opt/ood/ood_auth_map/bin/ood_auth_map.mapfile --file '/path/to/mapfile' 'opaque_remote_username' # Example of no match found /opt/ood/ood_auth_map/bin/ood_auth_map.mapfile 'this_remote_username_does_not_exist' ``` -------------------------------- ### Install mod_auth_mellon for Apache Source: https://osc.github.io/ood-documentation/latest/authentication/adfs-with-auth-mellon.html Installs the mod_auth_mellon and mod_ssl modules for Apache HTTP Server on EL7, EL8, and Ubuntu systems. Ensure Software Collections are enabled for EL7/EL8. ```bash yum install httpd24-mod_auth_mellon httpd24-mod_ssl ``` ```bash yum install mod_auth_mellon mod_ssl ``` ```bash apt install libapache2-mod-auth-mellon ``` -------------------------------- ### Install EPEL Release (Bash - CentOS/RHEL 7) Source: https://osc.github.io/ood-documentation/latest/release-notes/v2.0-release-notes.html Command to install the Extra Packages for Enterprise Linux (EPEL) repository on CentOS/RHEL 7 systems, which provides additional packages not found in the base repositories. ```bash sudo yum install epel-release ``` -------------------------------- ### Create Python Virtual Environment Wrapper Script Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/python-starter-app.html This bash script acts as a wrapper to activate a Python virtual environment before executing a Python script. It determines the script's directory, sources the virtual environment's activation script, and then uses `exec` to run the Python interpreter with the provided arguments, ensuring dependencies are available. ```bash #!/usr/bin/env bash SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SCRIPT_DIR/../python-hello-world/bin/activate exec /bin/env python3 "$@" ``` -------------------------------- ### Python Flask App with WSGI Entrypoint Source: https://osc.github.io/ood-documentation/latest/tutorials/tutorials-passenger-apps/python-starter-app.html This code demonstrates a more advanced Python application structure using Flask. It separates the application logic into `app.py` and uses `passenger_wsgi.py` to import and expose the Flask application as the WSGI entrypoint. This allows for better organization and dependency management. ```python # passenger_wsgi.py from app import MyApp as application ``` ```python # app.py from flask import Flask import sys MyApp = Flask('python_hello_world') @MyApp.route("/") def index(): return 'Hello World!
' + sys.version if __name__ == "__main__": MyApp.run() ``` -------------------------------- ### File User Mapping Script Usage Source: https://osc.github.io/ood-documentation/latest/authentication/overview/map-user.html Illustrates the command-line usage for the file-based user mapping script. It shows how to specify a mapfile and pass the REMOTE_USER for lookup. ```bash /opt/ood/ood_auth_map/bin/ood_auth_map.mapfile -f /path/to/your/mapfile "authenticated_username" ```