Skip to content

Development guide#

Pre-requisites#

  • NodeJS >= v12.20
  • MariaDB >= v15

Configure#

See the deployment page for example configurations.

Configuration to use the test cluster (vagrantcluster)#

resop comes with a test cluster, outlined in the previous section, called vagrantcluster. The cluster can be used to test newly implemented functionalities in a virtual HPC environment, maximizing portability to a real environment.

Once vagrantcluster is up and running, your .env file should look similar to:

### API settings ###

# disable https for local testing
ENABLE_HTTPS= 'false'

# needed 
JWT_SECRET = 'random_secretString!'

# diasable logging
ENABLE_DB = 'false'

# change this with your own cluster settings
CLUSTER_NAME="devcluster"
CLUSTER_ADDRESS="127.0.0.1"
CLUSTER_SSH_PORT="2200" # check this is the right port to access **fe1** VM
# location where users private keys are saved, in the server where the API is hosted
# see authentication in docs to know more  
CLUSTER_USERS_SSH_KEY_LOCATION="/tmp"

### Operator settings ###

# custom variables can be defined and used in user-implemented operators.
ANYTHING="thatneedstobesecret"

Start the server#

Resop can run in production or development mode.

Local#

Run the local server for development purposes with:

npm run dev:watch

This way, resop can be run "clusterless", meaning that the API will not attempt to connect to a cluster. Some features are disabled when running locally:

  • Authentication
  • Remote shell commands (both bare command endpoints and commands within an Operation) are not effectively submitted. A success reply will always be returned with the command string generated.

dev:watch mode uses nodemon will monitor any changes and rebuild the project anytime a new modification is saved.

Production#

npm run prod

Commands and operations are effetively submitted on the remote cluster after a connection attempt has made with the information provided in the JWT token in the HTTP request. The token is granted after sucessful authentication of a cluster user.

Development environment#

ESLint and Prettier are used for code formatting and help during development. See the configuration files in the repository base for more info.

.vscode settings in the repository folder allow for automatic formatting when saving with the VS Code IDE.