UpCloudLtd/upcloud-php-api

Small PHP script to reboot your server on a different node

finalwebsites opened this issue ยท 4 comments

Hi,
I had some issues with CPU steal recently and wrote this script to restart a server on a different host node.
https://gist.github.com/finalwebsites/162e168b3539b12005141113277b5edd

Any suggestions what I can do better?
Maybe you like to share it somewhere?
If you like I can create a complete tutorial (if the information qualifies to get a credit :))

Darep commented

Thanks @finalwebsites! Looks good to me! I've been actually thinking that you could dumb down upcloud-php-api to something like only curl, like in your script, would make things simpler :) But just an idea...

"avoid_host" is they way to go when you want to solve issues like that! ๐Ÿ‘

@Darep actually I didn't checked the current PHP API wrapper :)
Curl is great to do stuff quickly, but without a class you need to write the same stuff over and over again.
Must say the docs for the PHP API is much better than the regular API docs.
If I find the time I will write an example for the PHP API as well. It's only the startup parameter which is not included in the wrapper class.

Darep commented

Thanks! Sounds good! ๐Ÿ˜Š Yeah, I was thinking about a light wrapper around curl() or guzzle. The wrapper would add the headers for you and you give it the path like /server and then the body as array()-structure. But just an idea for now ๐Ÿ˜„

Darep commented

And let me know how it goes with the example! Would be nice to have an example like that in this repo, so happy to help!