5. Install the PUN Utility¶
The PUNs are manipulated and maintained by the nginx_stage utility. This
tool is meant to by run by root or a user with sudoers privileges.
Clone and check out the latest tag:
cd ~/ood/src scl enable git19 -- git clone https://github.com/OSC/nginx_stage.git cd nginx_stage/ scl enable git19 -- git checkout v0.3.0
Install it to its global location:
sudo scl enable rh-ruby22 -- rake install # => mkdir -p /opt/ood/nginx_stage # => cp ...
Although the defaults for this tool are great, we also know there is no such thing as a “one size fits all”. For this we allow you to configure how the nginx_stage tool behaves by creating and modifying a YAML configuration file under:
/etc/ood/config/nginx_stage.yml
You can read Configuration for details on the available configuration options.
Note
If you run an older Linux OS that creates user accounts starting at id 500, then you will need to modify
nginx_stage.yml- the configuration optionmin_uid: 1000accordingly.Give the
apacheusersudoprivileges to run thenginx_stagecommand. To do this, generate asudoers_oodfile in~/ood/srcdirectory:Defaults:apache !requiretty, !authenticate apache ALL=(ALL) NOPASSWD: /opt/ood/nginx_stage/sbin/nginx_stage
and then copy this to
/etc/sudoers.d/ood:sudo cp ~/ood/src/sudoers_ood /etc/sudoers.d/ood sudo chmod 440 /etc/sudoers.d/oodOur
/etc/sudoersfile includes files in/etc/sudoers.d:sudo tail -n 2 /etc/sudoers ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment) #includedir /etc/sudoers.d
Schedule a cron job that automatically cleans up inactive user PUNs. To do this, generate the file
/etc/cron.d/oodwith the following contents:#!/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin 0 */2 * * * root [ -f /opt/ood/nginx_stage/sbin/nginx_stage ] && /opt/ood/nginx_stage/sbin/nginx_stage nginx_clean 1>/dev/null
This will clean up inactive PUNs every two hours.
Stage the NGINX configuration files for the system web applications:
sudo mkdir -p /var/lib/nginx/config/apps/sys sudo touch /var/lib/nginx/config/apps/sys/dashboard.conf sudo touch /var/lib/nginx/config/apps/sys/shell.conf sudo touch /var/lib/nginx/config/apps/sys/files.conf sudo touch /var/lib/nginx/config/apps/sys/file-editor.conf sudo touch /var/lib/nginx/config/apps/sys/activejobs.conf sudo touch /var/lib/nginx/config/apps/sys/myjobs.conf sudo /opt/ood/nginx_stage/sbin/nginx_stage app_reset --sub-uri=/pun