Provides an API for the orderly, harmonious, and complete management of DC/OS service packages.
This project enforces certain scalastyle rules. To run those check against the code run:
sbt scalastyle test:scalastyle it:scalastyleThere is a suite of unit tests that can be ran by running sbt clean test
To generate an scoverage report for unit tests run the following command:
sbt clean coverage test coverageReport coverageAggregateThe generated report can then be found at target/scala-2.11/scoverage-report/index.html
NOTE: You should never run coverage at the same time as one-jar because the produced one-jar will contains scoverage instrumented class files and will fail to run.
There is a suite of integration tests that can be ran by running sbt clean it:test
At this time it is not possible to easily generate an scoverage report for the integration suite
in cosmos-server. This is due to some classpath scoping issues related to the cosmos server
being forked before the integration suite is ran.
- A running DC/OS cluster
The test runner will automatically start an in process zk cluster and start the Cosmos server.
The test suite will then be configured to interact with this cluster by setting the following system properties:
-Dcom.mesosphere.cosmos.dcosUri
-Dcom.mesosphere.cosmos.packageStorageUri
-Dcom.mesosphere.cosmos.stagedPackageStorageUri
or running the following command:
export COSMOS_AUTHORIZATION_HEADER="token=$(http --ignore-stdin <dcos-host-url>/acs/api/v1/auth/login uid=<dcos-user> password=<user-password> | jq -r ".token")"
sbt -Dcom.mesosphere.cosmos.dcosUri=<dcos-host-url> \
-Dcom.mesosphere.cosmos.packageStorageUri=file:///tmp/cosmos/packages \
-Dcom.mesosphere.cosmos.stagedPackageStorageUri=file:///tmp/cosmos/staged-packages \
clean it:testCosmos requires a ZooKeeper instance to be available. It looks for one at
zk://localhost:2181/cosmos by default; to override with an alternate <zk-uri>, specify the flag
-com.mesosphere.cosmos.zookeeperUri <zk-uri> on the command line when starting Cosmos (see
below).
We also need a One-JAR to run Cosmos:
sbt oneJarThe jar will be created in the cosmos-server/target/scala-2.11/ directory. This can be executed
with:
java -jar cosmos-server/target/scala-2.11/cosmos-server_2.11-<version>-SNAPSHOT-one-jar.jar \
-com.mesosphere.cosmos.dcosUri <dcos-host-url> \
-com.mesosphere.cosmos.packageStorageUri file://<absolute-path-to-package-dir> \
-com.mesosphere.cosmos.stagedPackageStorageUri file://<absolute-path-to-staged-dir>It can also be executed with ZooKeeper authentication with:
export ZOOKEEPER_USER <user>
export ZOOKEEPER_SECRET <secret>
java -jar cosmos-server/target/scala-2.11/cosmos-server_2.11-<version>-SNAPSHOT-one-jar.jar \
-com.mesosphere.cosmos.dcosUri <dcos-host-url> \
-com.mesosphere.cosmos.packageStorageUri file://<absolute-path-to-package-dir> \
-com.mesosphere.cosmos.stagedPackageStorageUri file://<absolute-path-to-staged-dir>Cosmos exposes an admin portal at http://<cosmos-host>:9990/admin. If Cosmos is running locally
and you are just interested in the metrics run the following command.
curl http://localhost:9990/admin/metrics.jsonThe code is organized into several subprojects, each of which has a JAR published to the Sonatype OSS repository. Here's an overview:
cosmos-test-commonsrc/maindirectory: defines the code and resources used by both the unit and integration tests.src/testdirectory: defines the unit tests and any resources they require.
cosmos-integration-testssrc/maindirectory: defines the integration tests and any resources they require.
- The remaining subprojects define the main code for Cosmos, always within their
src/maindirectories.
The following table outlines which version of Cosmos is bundled with each version of DC/OS
| DC/OS Release Version | Cosmos Version |
|---|---|
| ≥ 1.6.1 | 0.1.2 |
| ≥ 1.7.0 | 0.1.5 |
| ≥ 1.8.0 | 0.2.0 |
| ≥ 1.8.9 | 0.2.1 |
| ≥ 1.9.0 | 0.3.0 |
| ≥ 1.10.0 | 0.4.2 |
The below table is a compatibility matrix between Cosmos and Universe repository consumption format.
Rows represent Cosmos versions, columns represent repository formats.
| Version 2 | Version 3 | Version 4 | |
|---|---|---|---|
| 0.1.x | Supported | Not Supported | Not Supported |
| 0.2.x | Supported | Supported | Not Supported |
| 0.3.x | Supported | Supported | Not Supported |
| 0.4.x | Supported | Supported | Supported |
The below table is a compatibility matrix between Cosmos and Universe packaging versions.
Rows represent Cosmos versions, columns represent packaging versions.
| 2.0 | 3.0 | 4.0 | |
|---|---|---|---|
| 0.1.x | Supported | Not Supported | Not Supported |
| 0.2.x | Supported | Supported | Not Supported |
| 0.3.x | Supported | Supported | Not Supported |
| 0.4.x | Supported | Supported | Supported |
Cosmos implements three different services. The documentation for each service is outlined below.
- Service Manager
- Package Manager
- Capability Manager
If you encounter a problem that seems to be related to a Cosmos bug, please create an issue at
DC/OS Jira. To create an issue click on the
Create button at the top and add cosmos to the component field.