- Clone the repo in your environment
- Navigate to
server-appfolder and run scriptsyncLib.sh(Linux) orsyncLib.bat(Windows) to fetch the latest main flexbench lib in context of server-app project. The folderlibis copied from root path, but has been added in .gitignore. - Docker and docker-compose must be installed if
Run with dockeris selected - Node 16 or later to be installed on host if
Run with npmis selected
- Clone repo
- change directory to server-app
- Install required npm modules
npm iornpm installoryarn install - In root create
.env, copy paste the content of.env.npminto.env - Generate a private key (From any website or use any algorithm, eg. https://jwt.io/)
- Replace
YOUR_PRIVATE_KEY_HEREwith the generated Private key in.env - To run in development environment, set
NODE_ENV=developmentin your.envfile and run:npm run dev - To run in production, set
NODE_ENV=productionin your.envfile and run:npm start
- Run command
docker-compose -f docker-compose.dev.yml up --buildfor development - Run command
docker-compose -f docker-compose.prod.yml up --buildfor production
NODE_ENV: This variable is set by the target on a multi stage Dockerfile, and can have the following values:
- development
- production
Flexbench by default is not using authorization. If you want to change this, locate the relative .env or .env.docker file and set REQUIRE_AUTH to true
Inside the
postmanfolder you can find and import the fileFlexbench.postman_collection.json, having a collection of requests for the above endpoints
-
GET
/healthcheck- to check the server status -
POST
/api/users- to register userpayload { "name":, "password":, "confirmPassword":, "email": }
-
POST
/api/sessions- to create access / refresh tokenpayload
{ "email":, "password": }
-
GET
/api/sessions- to check the user sessionIn the headers send
REFRESH_TOKENwith keyx-refresh
and setbearer tokenwithACCESS_TOKEN -
DELETE
/api/sessions- to logout userIn the headers send
REFRESH_TOKENwith keyx-refresh
and setbearer tokenwithACCESS_TOKEN -
POST
/api/scenarios- to run the scenarioThere are 2 methods to run scenario
- using the JSON object
payload
{ "scenarioConfig": { "scenario": { "delay": "0.5-1.5", "throttling": "50000", "workers": "4", "totalclients": "10", "duration": "5" }, "requests": [ { "method": "GET", "path": "/", "port": "443", "host": "www.example.com" }, { "method": "POST", "path": "/", "port": "8082", "host": "localhost", "body": { "name": "kanha", "lastname": "agrawal" } } ] } }
- using
.flexfile
payload { "flexfile": <FILE_DATA> }