digitalocean / doctl Goto Github PK
View Code? Open in Web Editor NEWThe official command line interface for the DigitalOcean API.
Home Page: https://docs.digitalocean.com/reference/doctl/
License: Apache License 2.0
The official command line interface for the DigitalOcean API.
Home Page: https://docs.digitalocean.com/reference/doctl/
License: Apache License 2.0
$ doctl version
doctl version 1.0.0-dev
Git commit hash: d8e2e0b
$ sha256sum /usr/bin/doctl
9f8ebe3c1d69ac5cb4ce313d82ceeac83485a57904ea9ef11accc62db8944e7b) /usr/bin/doctl
Hi, I get the error "-bash: /usr/local/bin/doctl: cannot execute binary file" when following the instructions in the readme file.
Feature request: We need a confirmation before delete (or any other critical action) a droplet. ๐ฐ
It happens on current master (a57555c), when trying to connect to a droplet from Windows 10 in VirtualBox.
There are 2 different problems:
1/ When trying to connect with a SSH key that isn't password protected, the error is:
doctl.exe compute ssh playground --ssh-key-path D:\ssh-tmp-keys\id_rsa_without_password
Error: read /dev/stdout: The handle is invalid.
The problem is that this line is using os.Stdout
while it should be using os.Stdin
.
There's also a logical error here, we check for the function scoped err
before starting the shell, but it can be non-nil because of this line.
2/ When trying to connect with a SSH key that is password protected, the error is:
doctl.exe compute ssh playground --ssh-key-path D:\ssh-tmp-keys\id_rsa_with_password
Error: asn1: structure error: tags don't match (16 vs {class:1 tag:6 length:50 isCompound:false}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey @2
The problem is that ssh.ParsePrivateKey(key)
on this line expects a PEM encoded private key so we have to decrypt it first.
The SSH keys used to reproduce this issue have been generated using:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
One key has a passphrase, the other doesn't. They are attached here:
ssh-test-keys.tar.gz
No sure why, but ran the following command after installing doctl
using Homebrew (Mac OS, El Capitan, v10.11.5).
doctl auth login -t (my token)
Output: updated access token
But no .doctlcfg
file was created in $HOME.
I would like to make a FreeBSD port for the doctl tool.
It would be much easier to pull the release build from github rather than building it from source.
Would it be possible to add a FreeBSD release?
Alternatively, if you have a Go environment configured, you can install the development
version of doctl from the command line like so:
go get github.com/digitalocean/doctl
I type doctl after this and have no success. I will doing additional shell steps?
Please clarify you REAMDE.md with this steps.
Thanx.
My droplets use a non-standard port for ssh. So I tried this:
doctl compute ssh <my_droplet> --ssh-user <my_user> --ssh-port 1234
But I get ssh: connect to host <droplet_ip> port 22: Connection refused
Error: 255
Software | Version |
---|---|
doctl |
v1.0.0 |
OS | OSX El Capitan 10.11.4 (15E65) |
Shell | iTerm 2 (2.1.4) |
Btw, thank you all for this awesome tool!!
This is probably not specific for doctl
itself, but also the API.
I think it could be useful if you start creating a droplet, and don't want to wait until it's finished, if you could have it notify you by e-mail once it's done creating, or maybe a callback URL?
I'm part of a new startup company located in Denmark, where we're already using Digital Ocean for some of our servers, we do plan to use this for our customers also, although (would be sweet with a Digital Ocean presence in Denmark :)) and as part of a more or less automated deployment is where I think a callback URL option could be useful, it would probably be required to implement this into the API also.
Running the command:
doctl compute droplet tag <droplet-name or droplet-id> --tag-name mytag
returns the error message:
Error: POST https://api.digitalocean.com/v2/tags/testing/resources: 404 The resource you were accessing could not be found.
Edit: Win11 added Linux subsystem support
after following the basic install (download tar, extract)
Running
./doctl auth login
Produces
zsh: exec format error: ./doctl
Would it be possible to have something equivalent to a shell for this tool? I find myself typing doctl compute droplet <action>
a lot, and it'd be nice if I could do something like cd compute/droplet
or cd compute
and then just droplet <action>
or droplet-action <action>
directly.
Currently the doctl command line tool supports retrieving auth from env vars, but I would prefer to store these in a dot file in my home directory.
After authenticating using: doctl auth login --access-token {string}
The doctl auth login
doesn't' work.
you still get:
Error: access token is required
when trying to run doctl compute droplet list
or most of the commands.
To list, you have to use:
doctl compute droplet list --region nyc3 --output json --access-token
That's not ideal if you have to use the token each time.
Installed via Homebrew
(either #19 ;)
I traced this one down to bryanl/webbrowser#2 however.
Line 52 of commands/images.go has a bug:
cmdImagesListUser := CmdBuilder(cmd, RunImagesListDistribution,
The doctl auth login
process has a few issues that doesn't allow it to work the same way on every platform. I'm proposing we replace this with a doctl auth init
that will take a DO token on the command line and do the initial configuration which will include creating a doctl config file.
You should release it to several different package managers such as Homebrew and APT repositories (preferably make your own).
This version of the homebrew is well out of date
[~]# doctl compute image list
ID Name Type Distribution Slug Public Min Disk
79909 Rails-3.2.12-Nginx-MySQL snapshot Ubuntu false 20
13271590 FreeBSD 10.2 Raw snapshot FreeBSD false 20
15836396 packer-1455685225 snapshot Ubuntu false 40
15836558 packer-1455685874 snapshot Ubuntu false 40
15836632 packer-1455686129 snapshot Ubuntu false 40
308121 WordPress on Ubuntu 12.10 snapshot Ubuntu false 20
385625 WordPress on Ubuntu 12.10 snapshot Ubuntu false 20
415651 WordPress on Ubuntu 12.10 snapshot Ubuntu false 20
Using Go templates, expose the raw response to the end user, so outputs can be customized. As an example, if you retrieve a droplet with doctl compute droplet get 1234
, you could retrieve the droplet creation time with `doctl compute droplet get 1234 --template ".CreatedAt".
$ go get github.com/digitalocean/doctl/cmd/doctl
doesn't work out of the box:
$ go get github.com/digitalocean/doctl/cmd/doctl
# cd /home/user/mygo/src/github.com/digitalocean/doctl; git submodule update --init --recursive
fatal: no submodule mapping found in .gitmodules for path 'vendor/github.com/inconshreveable/mousetrap'
package github.com/digitalocean/doctl/cmd/doctl: exit status 128
DS
Doctl uses a custom ssh client because it can't assume there is a ssh executable in the path. In order to be more friendly, there should exist support for SSH agents.
Feature request: We need bash completion...
doctl should show compute, account, auth ...
Hello,
Please clarify file format of .doctlconfig in documentation.
Now it look like JSON but not quote a string on another source like issue it look like:
key1: value1
key2: value2
Please describe format or/and provide information about reading parameters in debug or verbose mode.
please add command: doctl compute droplet find ABCD
To find matching droplet with partial name or ip or tags
It seems that currently there is no command for creating a floating IP and assigning it in one go.
This would be very handy in our provisioning scripts.
Would you consider adding this?
when JSON output is selected, don't fmt.Print...
stuff to stdout.
e.g: https://github.com/digitalocean/doctl/blob/master/commands/droplets.go#L408
Add a jsonpath option to allow easy retrieval of specific data from a doctl response. Example:
doctl compute get 1234 --jsonpath "Networks.V4"
would return the IPv4 networks block from the JSON response. JSON output is assumed with the jsonpath
option.
If you have multiple droplets with the same name, e.g. "ubuntu-2gb-nyc3-01", and issue a droplet delete command, doctl deletes the oldest one.
doctl compute droplet delete ubuntu-2gb-nyc3-01
This should be documented, or there should be a disambiguation or confirmation prompt.
I would like to use a different user to ssh into my droplet, but I also use a different ssh key, my line is:
doctl compute ssh <my_droplet> --ssh-key-path <mykey> --ssh-user <my_user>
but the connection made to the droplet uses root
instead of my username. Also any kind of arguments after --ssh-key-path
are being ignored, like -v
or --trace
.
Software | Version |
---|---|
doctl | v1.1.0 |
OS | OSX Yosemite 10.10.5 (14F1713) |
Terminal | iTerm 2 (2.1.4) |
Shell | zsh |
I followed the installation steps of option 2.
Running doctl
results in this error message: zsh: exec format error: doctl
I'm on the latest version of OSX.
How can this be fixed?
This would be a nice to have feature for those of us with OCD. :)
The --format
option is missing for the change-kernel
action using the following command:
doctl compute droplet-action change-kernel <droplet-id>
This option exists for other similar droplet-action
such as power-off
.
I was updating my mass kernel updater script to use doctl
instead of curl
and came across this issue.
EDIT:
It also appears the --no-header
option is missing too.
EDIT 2:
It appears that it does not list all kernels too. My assumption would be the paging in the DigitalOcean API.
Just tried installing the client after the twitter post was announce and wanted to login, however the client isn't being so nice about it. 1.0
Releases eh?
Anyway when attempting to login, it seems that the client is ignoring all the argument flags and not actually running the auth flow (or at least clearly stating what it does)
Also it seems to spin up my browser to an attempted auth page but all that prints is unknown client
.
Goob job on a 1.0 attempt though guys, looking forward it working nicer :P
First and foremost, this tool is great and it makes my work a lot easier! Thank you!
One of the things I use quite often is SSH agent forwarding (ssh -A user@server
) for example for deployment tasks. I wonder if it would be possible to add this functionality to the doctl compute ssh <droplet-name>
command?
In document https://www.digitalocean.com/community/tutorials/how-to-use-doctl-the-official-digitalocean-command-line-client you describe ".doctlconfig" but in current repository you say about ".doctlcfg".
Other problem is configuration file format is undefined it see like JSON but no where describe about this format.
I ran doctl compute droplet list
to get a droplet_id for our droplets.
One of our droplets has droplet_id 12018347.
I then ran doctl compute image list
to get the image_id for the Ubuntu 14.04.4 x64 image. According to this command, the image with slug "ubuntu-14-04-x64" has the image_id 15943679.
However, when I run doctl compute droplet-action rebuild 12018347 --image-id 15943679
, doctl returns the following error:
"POST https://api.digitalocean.com/v2/droplets/12018347/actions: 422 Image can't be blank"
Is this image really blank, or this is this a problem with the API? If there is another image_id that refers to a "non-blank" Ubuntu 14.04.4 x64 image, how would I find it? Is doctl compute image list
not the right way?
Allow git-style aliases for commands.
Some commands are more frequently used than others by users, so allowing people to alias them to their convenience will provide a more ergonomic experience.
Possible impl:
cobra
stuff, expand the os.Args
according to the aliases.The Homebrew formula is still pointing at v1.0.0
I have a scenario, when I need to generate SSL certificates for a bunch of machines in the cluster. It would be nice if the output of doctl compute droplet [create|list]
included the private ip (provided --enable-private-networking
was issued).
Right now I have to manually ssh (since doctl compute ssh
doesn't seem to take commands) into the box and run scripts to get that information, which is really inconvenient.
Receive follow problem
$ doctl auth login
login to DigitalOcean account
Usage:
doctl auth login [flags]
Flags:
-h, --help help for login
Global Flags:
-t, --access-token string DigitalOcean API V2 Access Token
-o, --output string output formt [text|json] (default "text")
--trace verbose output
-v, --verbose verbose output
Error: it's broke, Jim
What wrong? And I am is not Jim ;) How to determine my name in confg ;)
Contrary to the tutorial here, doctl auth login
only returns Error: access token is required
, if there's no config file, and doesn't pop open a browser tab.
There is no instruction given in that tutorial as to what key name to use in the config; I randomly guessed access-token
, which worked.
currently every action (shutdown, snapshot etc) needs the ID as parameter. this is not very practical for scripting things like this. Will it be possible to give these actions the Name of the droplet as parameter?
shutdown_and_update.sh
#!/bin/sh
doctl compute droplet-action shutdown my.droplet.com
doctl compute droplet-action snapshot my.droplet.com
--snapshot-name my.droplet.com
restore_and_wakeup.sh
#!/bin/sh
doctl compute droplet create my.droplet.com --size 8gb --image my.droplet.com --region nyc1
doctl compute droplet-action power-on my.droplet.com
Created a droplet with the --user-data-file argument with a local file containing a few lines of shell code, which normally works when used from the control panel. The data doesn't seem to be used.
Is anyone else finding that typing doctl auth login
does not open a new browser window but outputs the usage and the error:
Error: access token is required
โฆ well I thought that was what this command was suppose to figure out for me!?
I'm running OS X 10.11.4 โ zsh shell and Safari is my primary browser if it helps.
doctl
uses multiple mocks in testing. In order to generate them the same way every time, create a script to generate the mocks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.