Skip to content

DigitalOcean provisioning

Diego Zanga edited this page May 5, 2017 · 11 revisions

Create a token inside DigitalOcean

  1. Create an account or simply login. P.S. This link set a referral.

  2. Select API menu

  3. Select GENERATE NEW TOKEN

  4. Insert a name then save and copy the token to the clipboard

Save the token inside the var yaml file

the token should be save in private/digitalocean.yaml

syntax:

digitaloceanName: _insert name here_
digitaloceanToken: _insert token here_

Run Selene V digitalocean example

build Selene V

use gradle, to build the project run:

gradle --task jarWithLib

it will create in the build/libs/ directory the main jar runnable with all the needed jars in the directory lib

change/check provisionig options

the example file is 'examples/digitalocean/provisionServer.yaml'

- name: provision server
  provisionDigitalOcean: --nr 2 --region fra1 --distro fra1/centos-7-x64 --hardware 2gb"

nr is the number of server requested

region is the region (frankfurt 1 is the default)

distro should be changed from time to time checking images available from digitalocean

hardware refers to droplet dimension from digitalocean available options

execute

java -jar selenev --wk workspace/staging examples/digitalocean/provisionServer.yaml

results

  • a private directory will be create where you'll find:

    • a usermodel.yaml file with root username, root password and root ssh key (base64 format)

this one will be created/used only during provisioning tasks

    • a digitalocean.yaml file with your user and token (you created it before running all)
    • a user directory with user ssh key private and public :
      • key_username // private key, the first will be key_root
      • key_username.pub // public key, the first will be key_root.pub

this files will be created for each new user

  • a non data-sensitive workspace directory workspace/staging will be auto populated with:

    • an hostdata directory with one file for each server created like this one:

      id: '4823xx'

      location: Frankfurt 1

      hostname: SELV-23434sdfd-0

      ip.public: 207.154.216.xxx

      ip.private: 10.11.20.xxx

      os: CentOS

      osfamily: CENTOS

      imageId: fra1/centos-7-x64

      type: NODE

      tags: '[]'

      hardware: '{id=2gb, providerId=2gb, name=2gb, processors=[{cores=2.0, speed=2.0}], ram=2048, volumes=[{type=LOCAL, size=40.0, bootDevice=false, durable=false}], supportsImage=Predicates.alwaysTrue(), userMetadata={costPerHour=0.02976, costPerMonth=20.0}}'

Clone this wiki locally