Exploit DigitalOcean API through the console.
Project description
beauty-ocean
Create DigitalOcean droplets like a breeze through the command line.
Documentation
You may read the full documentation on ReadTheDocs.
Preparation
Before installing this package make sure you have an account to Digital Ocean and have obtained a Digital Ocean API token The recommended way of storing the token is via environment variable. Once you copy it, do the following:
$ vim ~/.profile or nano ~/.profile
# make sure the following line is added
$ export DO_TOKEN="API TOKEN HERE" # or other name than DO_TOKEN
$ source ~/.profile
Installation
Installation is just a pip install away:
(virtualenv_name) $ pip install beauty-ocean
You are using virtualenv, don’t you? If not, install it inside your ~/.local directory.
$ pip install --user beauty-ocean
Usage
For the moment, this package implements the creation of Digital Ocean droplets but very soon it will support the creation of Domains and Networks. Once installed, the droplet command will be available at your disposal. It accepts a single option --token or -t for short. Defaults to "DO_TOKEN" which is the name of the environment variable that you created earlier. If you used a different name then pass that name to the -t option.
$ droplet
# or
$ droplet -t MY_ENV_NAME_FOR_TOKEN
You may, also, pass a file path to the -t option where this file holds the token only.
$ droplet --t path/to/file/that/holds/the/token
Lastly, but not recommended, you may pass directly, to the -t option, the token itself.
$ droplet --t THE_ACTUAL_API_TOKEN_HERE
Once the token is resolved, a series of questions will be initiated in order to get the available data from you, submit this data to the Digital Ocean API and create the droplet. All the above come in a good-looking format of questions.
Finally, a json string will be returned with all the droplet data at your disposal to use it in any way you want.
Features
Beautiful command-line-interface questions flow with sensible defaults
Supports remote or local SSH keys addition and/or remote/local Tags
Demo
An mp4 video demo can be found here.
Credits
This package was created using:
audreyr/cookiecutter-pypackage project template
python-digitalocean python library for DigitalOcean API
inquirer to ask questions (based on the inquirejs command line UI)
colored to color the prompt
yaspin to display a “loading” animation while fetching data
click to create the command line
sshpubkeys to parse/validate public key(s)
Disclaimer
I do not work at DigitalOcean, neither have any benefits (financial or professional) from creating this package. This package was created because it facilitates my workflow during droplet creation and website deployment and I wanted to share it with other developers. Sharing is a good thing!
History
0.2.1 (2020-1-17)
Fix a bug (NotFoundError) produced while creating the droplet.
0.1.4 (2019-04-05)
Fix exception occurred when token was imported by a file.
0.1.3 (2018-09-18)
Fix create_droplet function which did not return JSON data. Now it does.
0.1.2 (2018-09-17)
Fix Pipenv file and include Pipfile* files into the source distribution.
0.1.1 (2018-09-16)
Added check-manifest package and fix bump2version version error.
0.1.0 (2018-09-15)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file beauty_ocean-0.2.1.tar.gz
.
File metadata
- Download URL: beauty_ocean-0.2.1.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.3.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0b384f153ba025575c0abcce9306df9a82e43ae017253e0081234ed5853918e |
|
MD5 | 8cf935ef0facaa40b42d3b86aef6e2f4 |
|
BLAKE2b-256 | fd11c1db1401b02866df0007b1fff35024459b77c58223575015c05d329f9b5e |
File details
Details for the file beauty_ocean-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: beauty_ocean-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.3.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26a8b12b231cee0ebd9e24a49eafd97d6ddb4685e5d40c584b02b086a0b79272 |
|
MD5 | df1abed7740a79ad203e8923ee55db4a |
|
BLAKE2b-256 | 7b365f46fdaa4799cb304188956624fa5078603917a2dec43fb5d2d258207d37 |