Laravel Forge JavaScript SDK

Daemons

Daemons

Create a daemon

Method

forge.daemons.create(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const daemon = await forge.daemons.create(server_id, payload);

Payload

1{
2 command: 'COMMAND',
3 user: 'root',
4 directory: '/home/forge/foo.com'
5}

Payload Parameters

KeyDescription
commandThe command to run when starting the daemon.
userThe server user to run the command as.
directoryThe directory to run the command in.

Example Response

1{
2 "daemon": {
3 "id": 1,
4 "command": "COMMAND",
5 "user": "root",
6 "directory": "/home/forge/foo.com",
7 "status": "installing",
8 "created_at": "2016-12-16 15:46:22"
9 }
10}

List daemons

Method

forge.daemons.list(server_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const daemons = await forge.daemons.list(server_id);

Example Response

1{
2 "daemons": [
3 {
4 "id": 1,
5 "command": "COMMAND",
6 "user": "root",
7 "directory": "/home/forge/foo.com",
8 "status": "installing",
9 "created_at": "2016-12-16 15:46:22"
10 }
11 ]
12}

Get a daemon

Method

forge.daemons.get(server_id, daemon_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const daemon = await forge.daemons.get(server_id, daemon_id);

Example Response

1{
2 "daemon": {
3 "id": 1,
4 "command": "COMMAND",
5 "user": "root",
6 "directory": "/home/forge/foo.com",
7 "status": "installing",
8 "created_at": "2016-12-16 15:46:22"
9 }
10}

Delete a daemon

Method

forge.daemons.delete(server_id, daemon_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.daemons.delete(server_id, daemon_id);

Restart a daemon

Method

forge.daemons.restart(server_id, daemon_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.daemons.restart(server_id, daemon_id);

Edit this page on GitHub