Create your Droplet from Digital Ocean API
- Vagrant v2.2.7
- Virtualbox v6.1.4
- Ansible v2.9.6
- Vagrant DigitalOcean v0.9.4
- Direnv v2.21.2
ensure you have the specified version or above for all the above mentioned tools
- Vagrant
$ brew cask install vagrant
- Virtualbox
$ brew cask install virtualbox
- Ansible
$ brew install ansible
- Vagrant DigitalOcean
$ vagrant plugin install vagrant-digitalocean
- Direnv
$ brew install direnv
Make sure to hook direnv into your shell.
If you are using bash
shell, then add the following line at the end of the ~/.bashrc file:
eval "$(direnv hook bash)"
If you are using zsh
shell, then add the following line at the end of the ~/.zshrc file:
eval "$(direnv hook zsh)"
for other shell, refer here
Note, if you are have spwaned multiple tabs / windows / split of your terminal, whenever you make changes to .envrc ensure to press just enter in all the instances to loaded the updated environment variables into the instance of the terminal window
failing to do will result in undesired output
As a first step, setup necessary env variables.
In DigitalOcean,
- Follow the instruction here to setup personal token
- Follow the instruction here to upload your ssh key to your digital ocean account
$ cp .envrc.sample .envrc
- Modify the following configurations as per your credentials
DIGITAL_OCEAN_TOKEN: the token your have created in step 1
DIGITAL_OCEAN_SSH_KEY_NAME: the ssh key you have created in step 2
DIGITAL_OCEAN_PRIVATE_KEY: private_key_file_name (assumption is the file will be located under $HOME/.ssh/private_key_file_name) for which you have uploaded the public key in step 2
- Load the env variables
## This command has to be run for every change in .envrc
$ direnv allow .
Additionally, if you are using ZSH shell instead of bash
## Only for ZSH
$ eval "$(direnv hook zsh)"
- To create the droplet on Digital Ocean,
$ make provision.basic
- To teardown the cluster, execute
$ make destroy
- By default, VMs are created with 4vCPUs and 8GB of RAM. To change this use the configuration parameter
INSTANCE_TYPE
.
## default instance type
INSTANCE_TYPE: s-1vcpu-1gb
## For more info, visit https://developers.digitalocean.com/documentation/changelog/api-v2/new-size-slugs-for-droplet-plan-changes/
Issue with Digital ocean authentication
If you face the following issue when issuing make
, vagrant
commands ,
There was an issue with the JSON response from the DigitalOcean
API at:
Path: /v2/droplets
URI Params: {}
The response JSON from the API was:
Response: Unable to authenticate you
simple source the .envrc file once. ($ source .envrc
), also ensure your .envrc configurations are correct or use direnv as mentioned in the Prerequisite
Issue with bcrypt_pbkdf
If you face this issue, probably you are using ssh with passphrase ensure you have configured ssh-agent, for more info refer here