DC/OS E2E¶
DC/OS E2E is a tool for spinning up and managing DC/OS clusters in test environments.
Installation¶
DC/OS E2E consists of a Python Library and various CLI Tools.
The CLI can be installed with Homebrew on macOS, and the library and CLI can be installed together with pip
on any Linux and macOS.
Windows is not currently supported, but we provide instructions on using DC/OS E2E on Windows with Vagrant on particular Backends’ documentation.
CLI on macOS With Homebrew¶
To install the CLI on macOS, install Homebrew.
Then install the latest stable version:
brew install https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
To upgrade from an older version, run the following command:
brew upgrade https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
Or the latest master
:
Homebrew installs the dependencies for the latest released version and so installing master
may not work.
brew install --HEAD https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
CLI on Linux With Linuxbrew¶
One way to install the CLI on Linux is with Linuxbrew. Install Linuxbrew, then install the latest stable version:
brew install https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
To upgrade from an older version, run the following command:
brew upgrade https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
Or the latest master
:
Homebrew installs the dependencies for the latest released version and so installing master
may not work.
brew install --HEAD https://raw.githubusercontent.com/dcos/dcos-e2e/master/dcose2e.rb
Library and CLI with Python¶
If the CLI has been installed with Homebrew, you do not need to install the library to use the CLI.
Requires Python 3.5.2+. To avoid interfering with your system’s Python, we recommend using a virtualenv.
Check the Python version:
python3 --version
On Fedora, install Python development requirements:
sudo dnf install -y git python3-devel
On Ubuntu, install Python development requirements:
apt install -y gcc python3-dev
Optionally replace master
with a particular version of DC/OS E2E.
The latest release is 2018.09.06.0.
See available versions.
If you are not in a virtualenv, you may have to use sudo
before the following command, or --user
after install
.
pip3 install --upgrade git+https://github.com/dcos/dcos-e2e.git@master
Uninstall¶
To uninstall DC/OS E2E, use one of the following methods, depending on how you installed DC/OS E2E.
pip3 uninstall -y dcos-e2e
# --force uninstalls all versions of DC/OS E2E which have been installed.
brew uninstall dcose2e --force
Getting Started with the Library¶
To create a DC/OS Cluster
, you need a backend.
Backends are customizable, but for now let’s use a standard Docker backend.
Each backend has different system requirements.
See the Docker backend documentation for details of what is needed for the Docker backend.
from dcos_e2e.backends import Docker
from dcos_e2e.cluster import Cluster
cluster = Cluster(cluster_backend=Docker())
It is also possible to use Cluster
as a context manager.
Doing this means that the cluster is destroyed on exit.
To install DC/OS on a cluster, you need a DC/OS build artifact.
You can download one from the DC/OS releases page.
In this example we will use a open source DC/OS artifact downloaded to /tmp/dcos_generate_config.sh
.
from pathlib import Path
oss_artifact = Path('/tmp/dcos_generate_config.sh')
cluster.install_dcos_from_path(
build_artifact=oss_artifact,
dcos_config={
**cluster.base_config,
**{
'resolvers': ['8.8.8.8'],
},
}
ip_detect_path=Docker().ip_detect_path,
)
cluster.wait_for_dcos_oss()
With a Cluster
you can then run commands on arbitrary Node
s.
for master in cluster.masters:
result = master.run(args=['echo', '1'])
print(result.stdout)
There is much more that you can do with Cluster
s and Node
s, and there are other ways to create a cluster.
CLI¶
DC/OS E2E also provides multiple command line interface tools. These allow you to create, manage and destroy DC/OS clusters on various backends. See CLI Tools for details.
Reference¶
- Installation
- Python Library
- CLI Tools
dcos-docker
CLIdcos-vagrant
CLIdcos-aws
CLI- Versioning, Support and API Stability
- Contributing