OSC / ood-fileexplorer

[MOVED] The Open OnDemand File Explorer
https://osc.github.io/Open-OnDemand/
MIT License
4 stars 1 forks source link

Moved to https://github.com/OSC/ondemand/tree/master/apps/files

OOD File Explorer

GitHub version

A Node.js web based file explorer that is a modification of CloudCommander with a focus on a user friendly interface for file uploads, downloads, editing, renaming and copying. It is an Open OnDemand app that is meant to be run as the user.

Features

File Explorer Interface

New Install

  1. Start in the build directory for all sys apps, clone and check out the latest version of the files app (make sure the app directory's name is files):

    scl enable rh-git29 -- git clone https://github.com/OSC/ood-fileexplorer.git files
    cd files
    scl enable rh-git29 -- git checkout tags/v1.4.1
  2. Install the app:

     scl enable rh-git29 rh-ruby24 rh-nodejs6 -- bin/setup
  3. Copy the built app directory to the deployment directory, and start the server. i.e.:

    sudo mkdir -p /var/www/ood/apps/sys
    sudo cp -r . /var/www/ood/apps/sys/files

Updating to a New Stable Version

  1. Navigate to the app's build directory and check out the latest version:

    cd files # cd to build directory
    scl enable rh-git29 -- git fetch
    scl enable rh-git29 -- git checkout tags/v1.4.1
  2. Update the app:

    scl enable rh-git29 rh-ruby24 rh-nodejs6 -- bin/setup
  3. Copy the built app directory to the deployment directory:

    sudo rsync -rlptv --delete . /var/www/ood/apps/sys/files

Configuration

(OPTIONAL) Update the application settings via environment variables as appropriate.

Usage

For general usage instructions see: https://www.osc.edu/supercomputing/ondemand/file-transfer-and-management

API

The File Explorer contains a node-js REST API based on the node-restafary package, which can be used by other applications in the OnDemand Environment.

URL HTTP Verb Body Description
/api/v1/fs/<path> GET get file or dir content
/api/v1/fs/<path>?size GET get file or dir size
/api/v1/fs/<path>?time GET get time of file or dir change
/api/v1/fs/<path>?hash GET get file hash (SHA-1)
/api/v1/fs/<path>?beautify GET beautify js, html, css
/api/v1/fs/<path>?minify GET minify js, html, css
/api/v1/fs/<path> PUT file content create/write file
/api/v1/fs/<path>?unzip PUT file content unzip and create/write file
/api/v1/fs/<path>?dir PUT create dir
/api/v1/fs/<path> PATCH diff patch file
/api/v1/fs/<path> DELETE delete file
/api/v1/fs/<path>?files DELETE array of names delete files

Example:

GET requests will follow the pattern App Root + api/v1/fs/ + File Path, where File Path will be the absolute path of a file on the system.

Since the application is running as the logged in user, the application will only have access to the files that the user actually has access to within the file system.

Development

For development purposes the environment variables must be specified in the local environment file:

.env.local

underneath the root directory of this app in your sandbox.

To mimic the production environment you may have to copy the production environment variables down or set up a symbolic link:

# Copy production env vars
cp /etc/ood/config/apps/files/env .env.local

# or setup a symlink
ln -s /etc/ood/config/apps/files/env .env.local

Any changes made to the environment files require an app restart in order for the changes to take effect:

$ touch tmp/restart.txt

Updating the cloudcmd dependency

ood-fileexplorer currently uses a modified fork of CloudCmd, the latest OOD version of which is at OSC/cloudcmd. This version has been heavily modified from the original and is maintained as a separate fork.

"cloudcmd": {
      "version": "5.3.1",
      "from": "git://github.com/OSC/cloudcmd.git#v5.3.1-osc.29",
      "resolved": "git://github.com/OSC/cloudcmd.git#b19f86a972e4c127bdec3a4a50c939eb7d7b645b",

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/OSC/ood-fileexplorer.

License

The gem is available as open source under the terms of the MIT License.