Rainieren
1 year ago

Laravel - Make SSH connection to server

Posted 1 year ago by Rainieren

I've been struggling with this problem for a while now and I'm running out of ideas to try. I have a system where a user can follow some basic steps, After he/she finishes these steps, A remote server (Droplet) will be created by using the DigitalOcean API. Via a script, I receive the data of the newly created server in my database. Data such as IP, Droplet ID etc, which I can use in the future.

I'm able to access the newly created server by doing, for instance, [email protected] in a console (Opening the CMD and typing that command) without the need of a password or username, So there's that. Now I need to be able to connect to this newly created server using my code and be able to perform commands on it once I've connected to it. How can I accomplish this?

Code: OrderController (This creates the server of which I receive the IP from, about 1 minute after it's creation.)

$droplet = DigitalOcean::droplet()->create($storeName, 'ams3', 's-1vcpu-1gb', $images[0]->id, false, false, false, $keyArray, strval($webshop->id), true, [], [strval($webshop->id)]);

Please sign in or create an account to participate in this conversation.