OSC / nginx_stage

[MOVED] Stages & controls the per-user NGINX environment
https://github.com/OSC/ondemand/tree/master/nginx_stage
MIT License
0 stars 1 forks source link

[WIP] Add `activate` subcommand #40

Open nickjer opened 6 years ago

nickjer commented 6 years ago

Adds the command nginx_stage activate that outputs a script with a similar environment the PUN is started in that can be be sourced.

Help message:

$ sbin/nginx_stage --help
Usage: nginx_stage COMMAND [OPTIONS]

Commands:
 pun                 # Generate a new per-user nginx config and process
 app                 # Generate a new nginx app config and reload process
 app_reset           # Reset all staged app configs with the current template
 app_list            # List all staged app configs
 app_clean           # Clean up any staged app configs that point to deleted apps
 nginx               # Generate/control a per-user nginx process
 nginx_show          # Show the details for a given per-user nginx process
 nginx_list          # List all user running PUNs
 nginx_clean         # Clean all user running PUNs with no active connections
 activate            # Output a shell script with same enviroment as per-user nginx process

General options:
    -h, --help                       # Show this help message
    -v, --version                    # Show version

All commands can be run with -h (or --help) for more information.

$ sbin/nginx_stage activate --help
Usage: nginx_stage activate [OPTIONS]

Required options:

General options:

Common options:
    -h, --help                       # Show this help message
    -v, --version                    # Show version

Examples:
    To get the environment of **your** per-user nginx process:

        nginx_stage activate

    this outputs a script that can be sourced by the shell.

And actual output:

$ sbin/nginx_stage activate
export USER=jnicklas
export ONDEMAND_VERSION=1.3.5
export ONDEMAND_PORTAL=ondemand
export ONDEMAND_TITLE=Open\ OnDemand

Possible usage would look like:

$ cd ~/ondemand/dev/my_app
$ source <(/opt/ood/nginx_stage/sbin/nginx_stage activate)
$ bin/rails console
...
nickjer commented 6 years ago

Next step, figure out how to inject the environment that is loaded before nginx_stage is called by Apache.