Interactive cloud provider tool. Currently allows you to create a droplet on DigitalOcean, delete a droplet and list your droplets.
I built this as a way to learn Go and have a quick way to make a server without having to go to digitalocean.com
- DigitalOcean
brew install Joel-Valentine/tap/cogoFind the latest release in releases for your machines architecture, download and run either from within the directory ./cogo or by moving it into the /usr/local/bin to be accessed from anywhere.
Cogo uses a modern, secure credential management system with multiple storage options.
Store your DigitalOcean API token securely in your OS keychain:
cogo config set-tokenYour token will be stored in:
- macOS: Keychain
- Windows: Credential Manager
- Linux: Secret Service (GNOME Keyring, KWallet, etc.)
For CI/CD or automation, use environment variables:
export DIGITALOCEAN_TOKEN=dop_v1_xxx
cogo createSupported environment variables (in priority order):
DIGITALOCEAN_TOKEN(standard DigitalOcean env var)COGO_DIGITALOCEAN_TOKEN(cogo-specific)
Cogo still supports the legacy .cogo JSON file for backward compatibility:
Locations checked (in order):
$HOME/.cogo$HOME/.config/.cogo./.cogo
cogo config migrateCogo checks for credentials in this order:
- Command-line flag:
--token - Environment variable:
DIGITALOCEAN_TOKEN - Environment variable:
COGO_DIGITALOCEAN_TOKEN - OS Keychain (secure)
- Config file (legacy)
- Interactive prompt
# Set token (stores in keychain)
cogo config set-token
# View current token (masked)
cogo config get-token
# Check configuration status
cogo config status
# Migrate from file to keychain
cogo config migrate
# Delete stored token
cogo config delete-tokenCreate will run you through creating a droplet on your given cloud provider. Currently the process is:
- Chose your provider
- Enter a name
- Chose an image
- Chose a region
- Chose a size
- Chose an ssh key
- Are you sure (y/n)
Finally you will be told the droplet has been created. You can then list your servers from that provider once you think its been created / assigned an IP.
cogo createlist will list servers created on that provider printing the name and IP
cogo list
Your droplets:
0 Name: blog
IP: xxx.xxx.xxx.xxx
1 Name: backend
IP: xxx.xxx.xxx.xxx
2 Name: frontend
IP: xxx.xxx.xxx.xxxDestroy will allow you to delete one of your servers Safely there will be a total of three checks to make sure you understand what you are deleting.
- Chose the provider you wish to delete from
- There will be an 'are you sure (y/n)' question
- You will need to enter the name of the server you are deleting
- You will then have to answer another 'are you really really sure (y\n)' question with details of the server you are about to delete
cogo destroyThis project requires Go to be installed.
Running it then should be as simple as cloning the repository then:
$ make build
$ ./bin/cogomake test
If you've read this far you're probably the right person to add to this project
Please read the contributing guide on how to get started
I am still learning Go at the moment so don't feel like you need to be a wizard to contribute
