Laravel Forge JavaScript SDK

Services

Services

Start a service

Method

forge.services.start(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.services.start(server_id, payload);

Payload

1{
2 service: 'service-name';
3}

Payload Parameters

KeyDescription
serviceThe name of the service to start.

Stop a service

Method

forge.services.stop(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.services.stop(server_id, payload);

Payload

1{
2 service: 'service-name';
3}

Payload Parameters

KeyDescription
serviceThe name of the service to stop.

Restart a service

Method

forge.services.restart(server_id, payload)

Usage

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

Payload

1{
2 service: 'service-name';
3}

Payload Parameters

KeyDescription
serviceThe name of the service to stop.

Reboot MySQL

Method

forge.services.rebootMysql(server_id)

Usage

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

Stop MySQL

Method

forge.services.stopMysql(server_id)

Usage

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

Reboot Nginx

Method

forge.services.rebootNginx(server_id)

Usage

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

Stop Nginx

Method

forge.services.stopNginx(server_id)

Usage

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

Test Nginx

Method

forge.services.testNginx(server_id)

Usage

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

Example Response

1{
2 "result": "nginx: [emerg] a duplicate listen 0.0.0.0:80 in /etc/nginx/sites-enabled/default:6\nnginx: configuration file /etc/nginx/nginx.conf test failed\n"
3}

Reboot Postgres

Method

forge.services.rebootPostgres(server_id)

Usage

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

Stop Postgres

Method

forge.services.stopPostgres(server_id)

Usage

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

Reboot PHP

Method

forge.services.rebootPhp(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.services.rebootPhp(server_id, payload);

Payload

1{
2 version: 'php74';
3}

Payload Parameters

KeyDescription
versionThe version of PHP to reboot

Install Blackfire

Method

forge.services.installBlackfire(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.services.installBlackfire(server_id, payload);

Payload

1{
2 server_id: '...',
3 server_token: '...'
4}

Payload Parameters

KeyDescription
server_idYour Blackfire Server ID
server_tokenYour [Blackfire Server Token] (https://blackfire.io/account/credentials)

Remove Blackfire

Method

forge.services.removeBlackfire(server_id)

Usage

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

Install Papertrail

Method

forge.services.installPapertrail(server_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.services.installPapertrail(server_id, payload);

Payload

1{
2 host: '192.241.143.108';
3}

Payload Parameters

KeyDescription
hostYour Papertrail log destination

Remove Papertrail

Method

forge.services.removePapertrail(server_id)

Usage

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

Edit this page on GitHub