FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

Create a Digital Ocean stack

Introduction

This guide will help you build Digital Ocean droplets stack. You can configure the number of droplets and applications installed on each instance. Along with configuring droplet size and region. Your new team members will be able to use your stack to build their VMs environment and start working from day one.

If you do not have a Digital Ocean account yet, you can signup here www.digitalocean.com

Step by step guide

  1. Click ‘+’ sign to Create a New Stack

    Create new stack

  2. Choose Digital Ocean and click Create Stack

    Choose Digital Ocean

  3. Your default Digital Ocean stack is now created (If you wish you can give your stack a name by clicking on Edit Name below your stack name). In this modal you will find four tabs:

    1. Stack template: This is your stack template
    2. Custom variables: to define custom variables which you can use within your stack template, values there are hidden from the non-admin team members
    3. Readme: This will be the text displayed in a message box when your team builds the stack
    4. Credentials: add your Digital Ocean access token here

    Stack template

  4. Edit your Readme file to greet your team and provide them with information regarding your project or stack

    Readme tab

  5. You need to add your Digital Ocean account access token to the credentials tab. To do that, login to your Digital Ocean account and go to API –> Tokens and click Generate New Token

    DO access token

    Give your token a title and click Generate Token

    DO access token title

    Make sure to copy your generated token, Digital Ocean will not show your personal token again!

    DO access token generated

  6. Go to your Credentials tab on Koding for Teams, give your token a title and paste your Digital Ocean Token in the Access Token field and click SAVE THIS & CONTINUE

    Paste your access token

  7. Click Save on the top-right to save your credentials

    Save access token

  8. Click Initialize to initialize your stack

    initialize stack

  9. You can choose to share your own Digital Ocean Access Token with your team, this is useful in case you want to have all instances created by your team to be under your Digital Ocean account. If you agree, keep the “share the credentials” check box ticked, if not, make sure to uncheck this option. Then click Share With The Team to share your stack with your team.

    Share credentials?

  10. Now it’s time to build our VMs. You will see a message displayed in the Build Stack window, this is what we earlier added to our Readme tab when creating the stack. Click Next

    Build VM Read me

  11. Make sure the correct token is chosen (you can save multiple access tokens) and click Build Stack

    Build Stack

  12. Your VM will start building..

    Stack is building

  13. Click Start Coding to begin using your VM

    Stack building complete

  14. Congratulations, your Stack was successfully built and you can now use your new VM!

    VM started

  15. If you check your Digital Ocean account, you will see the new VM under your droplets.

    Stack building complete

This is the default stack template for Digital Ocean stacks

# Here is your stack preview
# You can make advanced changes like modifying your VM,
# installing packages, and running shell commands.

provider:
  digitalocean:
    access_token: '${var.digitalocean_access_token}'

resource:
  digitalocean_droplet:
    # this is the name of your VM
    do-instance:
      # and this is its identifier (required)
      name: 'koding-${var.koding_group_slug}-${var.koding_stack_id}-${count.index+1}'
      # select your instance_type here: eg. 512mb
      size: 512mb
      # select your instance zone which must be in provided region: eg. nyc2
      region: nyc2
      # base image for your droplet
      image: ubuntu-14-04-x64
      # on user_data section we will write bash and configure our VM
      user_data: |-
        # let's create a file on your root folder:
        echo "hello world!" >> /helloworld.txt
        # please note: all commands under user_data will be run as root.
        # now add your credentials and save this stack.
        # once vm finishes building, you can see this file by typing
        # ls /
        #
        # for more information please click the link below "Stack Script Docs"