Coder Social home page Coder Social logo

digitaloceanapi's Introduction

DigitalOceanAPI

A project for handling Digital Ocean droplets on the unix commandline. It can be used to quickly manage droplets from the CLI, as well as be used in combination with provisioning scripts (Ex. Ansible) for one click deployments.

SETUP

Dependencies: php7.0 php-curl

You must generate a Digital Ocean API Token for your account, as well as add an SSH Key. Add both of these to your CONFIG.php file. Make sure you have the id_rsa private key file of the RSA SSH key you created in the root directory of this project or to change it's location in the config.

A typical creation command would look like: php -q vmManage.php --create TestHostname s-1vcpu-1gb sfo1 ubuntu-16-04-x64

The overall process will take between 30 and 50 seconds to spin up the server depending on the image specified.

To access the server, you can ssh with the key linked in the CONFIG.php file

COMMANDS

php -q vmManage.php --help

php -q vmManage.php --list

php -q vmManage.php --destroy <dropletID/dropletName>

php -q vmManage.php --create <hostname> <size> <location> <image>

https://www.digitalocean.com/help/api/

List all Locations

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582" "https://api.digitalocean.com/v2/regions"

"regions": [
        "nyc1",
        "ams1",
        "sfo1",
        "nyc2",
        "ams2",
        "sgp1",
        "lon1",
        "nyc3",
        "ams3",
        "fra1",
        "tor1"
      ]

List all Sizes

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582" "https://api.digitalocean.com/v2/sizes"

"sizes": [
        "s-1vcpu-1gb",
        "s-1vcpu-2gb",
        "s-1vcpu-3gb",
        "s-2vcpu-2gb",
        "s-3vcpu-1gb",
        "s-2vcpu-4gb",
        "s-4vcpu-8gb",
        "s-6vcpu-16gb",
        "s-8vcpu-32gb",
        "s-12vcpu-48gb",
        "s-16vcpu-64gb",
        "s-20vcpu-96gb",
        "s-24vcpu-128gb",
        "s-32vcpu-192gb"
      ]

digitaloceanapi's People

Contributors

danetuso avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

frogmarketmedia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.