List workers on a site.
GET /api/site/{id}/workers
Example request :
curl "https://cloud.boxydev.com/api/site/1/workers" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Example response :
{
"data": [
{
"id": 1,
"command": "php8.1 artisan queue:work redis --queue=default --once",
"connection": "redis",
"queue": "default",
"max_jobs": 0,
"max_time": 0,
"force": false,
"memory": 128,
"sleep": 3,
"timeout": 60,
"tries": 1,
"processes": 1,
"directory": "/home/cloud/website.com",
"startsecs": 1,
"stopwaitsecs": 10,
"startretries": 3,
"stopsignal": "TERM",
"status": "installed",
"created_at": "2022-10-16T20:59:39.000000Z"
}
],
"links": {
"first": "https://cloud.boxydev.com/api/site/1/workers?page=1",
"last": "https://cloud.boxydev.com/api/site/1/workers?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://cloud.boxydev.com/api/site/1/workers",
"per_page": 20,
"to": 1,
"total": 1
}
}
Show a worker.
GET /api/worker/{id}
Example request :
curl "https://cloud.boxydev.com/api/worker/1" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Example response :
{
"id": 1,
"command": "php8.1 artisan queue:work redis --queue=default --once",
"connection": "redis",
"queue": "default",
"max_jobs": 0,
"max_time": 0,
"force": false,
"memory": 128,
"sleep": 3,
"timeout": 60,
"tries": 1,
"processes": 1,
"directory": "/home/cloud/website.com",
"startsecs": 1,
"stopwaitsecs": 10,
"startretries": 3,
"stopsignal": "TERM",
"status": "installed",
"created_at": "2022-10-16T20:59:39.000000Z"
}
Create a worker.
POST /api/site/{id}/worker
Parameters :
Parameter | Description |
---|---|
connection | The connection name. |
queue | The queue names. |
max_jobs | The number of jobs to run before to restart worker. |
max_time | The number of seconds to run jobs before to restart worker. |
force | Run worker when site is in maintenance. |
memory | Memory limit to worker. |
sleep | The number of seconds to sleep when no job available. |
timeout | The number of seconds a job can run. |
tries | Number of times a job can be attempted before fail. |
processes | The processes number for the worker (Optional). |
directory | The directory where run worker (Optional). |
startsecs | The seconds needed before processus start successful (Optional). |
stopwaitsecs | The seconds to wait before to stop processus (Optional). |
startretries | The number of retries to start processus (Optional). |
stopsignal | The stop signal to send when stop: TERM (Optional). |
Example request :
curl "https://cloud.boxydev.com/api/site/1/worker" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"connection": "redis",
"queue": "default",
"max_jobs": 0,
"max_time": 0,
"force": false,
"memory": 128,
"sleep": 3,
"timeout": 60,
"tries": 1,
"processes": 1,
"directory": "/home/cloud/website.com",
"startsecs": 1,
"stopwaitsecs": 10,
"startretries": 3,
"stopsignal": "TERM"
}'
Example response :
{
"id": 1,
"command": "php8.1 artisan queue:work redis --queue=default --once",
"connection": "redis",
"queue": "default",
"max_jobs": 0,
"max_time": 0,
"force": false,
"memory": 128,
"sleep": 3,
"timeout": 60,
"tries": 1,
"processes": 1,
"directory": "/home/cloud/cloud.boxydev.com",
"startsecs": 1,
"stopwaitsecs": 10,
"startretries": 3,
"stopsignal": "TERM",
"status": "installing",
"created_at": "2022-10-18T22:22:19.000000Z"
}
Stop a worker.
DELETE /api/worker/{id}/stop
Example request :
curl -X DELETE "https://cloud.boxydev.com/api/worker/1/stop" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Start a worker.
POST /api/worker/{id}/start
Example request :
curl -X POST "https://cloud.boxydev.com/api/worker/1/start" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Restart a worker.
PUT /api/worker/{id}/restart
Example request :
curl -X PUT "https://cloud.boxydev.com/api/worker/1/restart" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Delete a worker.
DELETE /api/worker/{id}
Example request :
curl -X DELETE "https://cloud.boxydev.com/api/worker/1" \
-H "Authorization: Bearer {token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"