dstack-tasks
dstack-tasks is a collection of invoke tasks that wrap common tools and services to make it easier to deploy code.
Tools wrapped:
- docker - docker-compose - postgresql (backup and restore) - mysql (backup and restore) - awscli (s3 only for now) - git - python - django manage.py
The tasks are designed to run as a standalone console script (dstack) or as a collection of tasks to build on in your invoke and fabric2* tasks.
Installation
To install, use pip:
pip install --pre dstack-tasks
Once installed, you can use it from within your project directory. The console script uses a .env file to configure itself. At the moment, some tasks still require environmental variables before it can be used.
Example usage
To see list of tasks, use dstack –list. To see the help text of each task, use dstack <task name> –help. See below for example usage:
# Backs-up database dstack postgres backup --tag local-dev # Release new version of app and publish to S3 (requires ~/.aws/credentials to be set up dstack release_code --upload --not-static
dstack-tasks can also be used as a base library for your invoke and fabric2 tasks:
pip install https://github.com/fabric/fabric/archive/v2.zip
All tasks can be run in “dry” mode or in a specific environment. To see what a tasks will execute, run it in dry mode:
dstack dry postgres backup
To give your task additional context, you can use the special e task to load environmental variables from a .env file:
dstack e release_code
This can be used to for example specify a different Github repo etc.
Notes
It is important to note that dstack-tasks is console script build on top of invoke and is thus primarily meant for executing tasks locally. However, dstack-tasks fully supports being used as a library in your fabric (version 2) fabfile.py. Simply import all tasks from dstack_tasks in your fabfile and you can execute them on a remote server using something like fab -H example.com e deploy –version 1.0.0.
At it’s core however, invoke just wraps bash commands and executes them on the server. This means that for advanced uses it might be worthwhile to install dstack-tasks on the server to allow complex tasks to be written in python instead of bash. So, instead of running ls -al via fabric 2 on the remote server and trying to capture and parse the output, you can use an appropriate python package to get a list of files in a directory.
Known Issues
dstack-tasks does not yet include a generic task that can be used to call itself on the server. There is also currently an issue with setting runtime environmental variables using Fabric2 to run tasks remotely.
Metadata
Release files for dstack-tasks 2.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dstack_tasks-2.3.5-py3-none-any.whl | Python 3 | none | any | Details for dstack_tasks-2.3.5-py3-none-any.whl |
Release files / dstack_tasks-2.3.5-py3-none-any.whl
| Download URL | dstack_tasks-2.3.5-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b29f0670d1592bc91271ca7d6ce5fe91faae70d551391ad43d4d9135213cd91b
|
|
BLAKE2b-256 checksum How to use checksums |
77a7138cdddde48c2593c840543feae958fd67da09de9fc9112a917748dba32b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for dstack-tasks 2.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.