upcloud-php-api icon indicating copy to clipboard operation
upcloud-php-api copied to clipboard

Small PHP script to reboot your server on a different node

Open finalwebsites opened this issue 6 years ago • 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 :))

finalwebsites avatar Aug 20 '19 11:08 finalwebsites

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 avatar Aug 20 '19 11:08 Darep

@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.

finalwebsites avatar Aug 20 '19 11:08 finalwebsites

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 avatar Aug 20 '19 11:08 Darep

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!

Darep avatar Aug 20 '19 12:08 Darep