PHPackages                             chapi/chapi-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. chapi/chapi-client

ActiveProject[API Development](/categories/api)

chapi/chapi-client
==================

chronos console client - Manage your jobs like a git repository

v0.9.0(9y ago)142310[3 issues](https://github.com/trivago/chapi/issues)[3 PRs](https://github.com/trivago/chapi/pulls)MITPHPPHP &gt;=5.6.0CI failing

Since Aug 3Pushed 3y ago5 watchersCompare

[ Source](https://github.com/trivago/chapi)[ Packagist](https://packagist.org/packages/chapi/chapi-client)[ RSS](/packages/chapi-chapi-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (19)Used By (0)

chapi [![Build Status](https://camo.githubusercontent.com/1a733000cb6a0c36f6159fe53c706812377e7ff970bd6acc85b00a2a3799d5a7/68747470733a2f2f7472617669732d63692e6f72672f7472697661676f2f63686170692e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/trivago/chapi) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/4f23380b1ca43bc5bd9d8bb7892985808d980b83a8497fa94ce88c1cf496f306/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7472697661676f2f63686170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/trivago/chapi/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/1837dff1c0dde064b2835144bce2a8f14776d5f181af085de848be44d4a3347f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7472697661676f2f63686170692f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/trivago/chapi/?branch=master)
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#chapi---)

Chronos and marathon api client for your console.

Description
-----------

[](#description)

Manage your [Chronos](https://github.com/mesos/chronos) and [Marathon](https://github.com/mesosphere/marathon) tasks like a git repository in your console:

- Prepare your tasks before you send them to Remote
- Manage a separate git repository for task backups and history
- Quickly check your tasks' status

It is possible to use either of the systems independently or both at once.

Requirements
------------

[](#requirements)

- php &gt;= 5.6

Installation / Configuration
----------------------------

[](#installation--configuration)

To install chapi you can download the latest [release](https://github.com/trivago/chapi/releases) or clone this repository. If you clone the repository you need to run a `composer install` to install all necessary dependencies:

```
composer install
```

Before you use chapi the first time you have to setup your chronos api url and the path to your local task repository. You can use the `configure` command to setup your global settings:

```
bin/chapi configure
```

### Configuration file locations

[](#configuration-file-locations)

Chapi attempts to read a global and a local configuration file, at least one of which must exist. Should both files exist, values found in the local configuration override those defined in the global one.

The global configuration file's location is

- `~/.chapi/.chapiconfig`if $CHAPI\_HOME is not set
- `${CHAPI_HOME}/.chapiconfig`, if $CHAPI\_HOME is set

The local configuration searched for in your current working directory.

- `${PWD}/.chapiconfig`,

### Profiles

[](#profiles)

You can switch between different profiles by using the global `--profile[=PROFILE]` option.

If no profile is set chapi will use `default` as active profile.

### Configuration file contents

[](#configuration-file-contents)

Both configuration files are in the [yaml](http://yaml.org/) format.

The configuration is located in the `profiles` property. There you will find the `parameters` for each set profile.

`default` will be used if you don't use a explicit profile.

```
profiles:
    default:
        parameters:
            chronos_url: http://your.chronos.url:chronos_api_port/
            chronos_http_username: username
            chronos_http_password: password
            repository_dir: /path/to/your/local/task/repository

            marathon_url: http://your.marathon.url:marathon_api_port/
            marathon_http_username: username
            marathon_http_password: password
            repository_dir_marathon: /path/to/your/local/marathon/apps/repository

            cache_dir: /path/to/chapi/cache/dir

        ignore:
          - *-dev
          - !my-active-job-dev
    develop:
       parameters:
           chronos_url: http://your.chronos.url:chronos_api_port/
           chronos_http_username: ''
           chronos_http_password: ''
           repository_dir: /path/to/your/local/task/repository

           marathon_url: ''
           marathon_http_username: ''
           marathon_http_password: ''
           repository_dir_marathon: ''

           cache_dir: /path/to/chapi/cache/dir_dev
```

#### `chronos_url`

[](#chronos_url)

The chronos api url (inclusive port). See also [configure command](#configure) option `-u`.

#### `chronos_http_username`

[](#chronos_http_username)

The chronos http username. See also [configure command](#configure) option `-un`.

Necessary if the setting `--http_credentials` is activated in your Chronos instance.

#### `chronos_http_password`

[](#chronos_http_password)

The chronos http password. See also [configure command](#configure) option `-un`.

Necessary if the setting `--http_credentials` is activated in your Chronos instance.

#### `repository_dir`

[](#repository_dir)

Root path to your job files. See also [configure command](#configure) option `-r`.

#### `marathon_url`

[](#marathon_url)

The marathon api url (inclusive port). See also [configure command](#configure) option `-mu`.

#### `marathon_http_username`

[](#marathon_http_username)

The marathon http username. See also [configure command](#configure) option `-mun`.

#### `marathon_http_password`

[](#marathon_http_password)

The marathon http password. See also [configure command](#configure) option `-mp`.

#### `repository_dir_marathon`

[](#repository_dir_marathon)

Root path to your tasks folder. See also [configure command](#configure) option `-mr`.

#### `cache_dir`

[](#cache_dir)

Path to cache directory. See also [configure command](#configure) option `-d`.

### Update notes

[](#update-notes)

#### v0.9.0

[](#v090)

Because of the new marathon support with v0.9.0 you need to update your configurations. The `parameters.yml` structure changed and renamed to `.chapiconfig`.

You need to recreate your config settings:

```
bin/chapi configure
```

### Disabling services

[](#disabling-services)

To disable Chronos support and only use Marathon, set all the Chronos parameters to `''`:

```
profiles:
    default:
        parameters:
            # [....]
            chronos_url: ''
            chronos_http_username: ''
            chronos_http_password: ''
            repository_dir: ''
```

Ignoring jobs
-------------

[](#ignoring-jobs)

You can specify pattern for each profile in your `.chapiconfig` file(s) and add a file to your job repositories to untrack jobs you want chapi to ignore.

- The matching pattern according to the rules used by the libc [glob()](https://en.wikipedia.org/wiki/Glob_(programming)) function, which is similar to the rules used by common shells.
- An optional prefix "`!`" which negates the pattern; any matching job excluded by a previous pattern will become included again.

Example content:

```
profiles:
    default:
        ignore:
          - *-dev
          - !my-active-job-dev
    dev:
        ignore:
          - "*"
          - "!*-dev"
```

Usage
-----

[](#usage)

### list

[](#list)

Display your tasks and filter them by failed

```
bin/chapi list [options]
```

```
Options:
  -f, --onlyFailed      Display only failed jobs
  -d, --onlyDisabled    Display only disabled jobs
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### info

[](#info)

Display your task information from remote system

```
bin/chapi info
```

```
Arguments:
  jobName               selected job

Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

The task name in case of marathon would be the full id for the task.

### status

[](#status)

Show the working tree status

```
bin/chapi status
```

```
Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### diff

[](#diff)

Show changes between tasks and working tree, etc

```
bin/chapi diff []
```

```
Arguments:
  jobName               Show changes for specific job

Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### add

[](#add)

Add task contents to the index

```
bin/chapi add []...
```

```
Arguments:
  jobnames              Jobs to add to the index

Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### reset

[](#reset)

Remove tasks from the index

```
bin/chapi reset []...
```

```
Arguments:
  jobnames              Jobs to add to the index

Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### pull

[](#pull)

Pull tasks from remote system and add them to local repository

```
bin/chapi pull [options] [--] []...
```

```
Arguments:
  jobnames              Jobnames to pull

Options:
  -f, --force           Force to overwrite local jobs
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### commit

[](#commit)

Submit changes to chronos or marathon

```
bin/chapi commit
```

```
Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### scheduling

[](#scheduling)

Display upcoming jobs in a specified timeframe

```
bin/chapi scheduling [options]
```

```
Options:
  -s, --starttime[=STARTTIME]  Start time to display the jobs
  -e, --endtime[=ENDTIME]      End time to display the jobs
  --profile[=PROFILE]  Use a specific profile from your config file.

```

**Note: Not applicable to marathon**

### configure

[](#configure)

Configure application and add necessary configs

```
bin/chapi configure
```

```
Options:
  -u, --chronos_url[=CHRONOS_URL]        The chronos url (inclusive port)
  -un, --chronos_http_username[=CHRONOS_HTTP_USERNAME]  The chronos username (HTTP credentials) [default: ""]
  -p, --chronos_http_password[=CHRONOS_HTTP_PASSWORD]   The chronos password (HTTP credentials) [default: ""]
  -d, --cache_dir[=CACHE_DIR]            Path to cache directory
  -r, --repository_dir[=REPOSITORY_DIR]  Root path to your job files
  --profile[=PROFILE]  Use a specific profile from your config file.

```

### validate

[](#validate)

Validate local jobs

```
bin/chapi validate []...
```

```
Arguments:
  jobmames              Jobs to validate

Options:
  --profile[=PROFILE]  Use a specific profile from your config file.

```

Example workflows
-----------------

[](#example-workflows)

### Add a new job to chronos

[](#add-a-new-job-to-chronos)

A typical workflow to add a new cronjob to your Chronos server via chapi can be:

1. A pull request for a new cronjob (json definition) comes in a git repository (created by a colleague of you)
2. Accept the pull request and switch to your local clone via `cd ~/my/clone`
3. Update your local repository via `git pull`
4. Check the current status via `chapi status`
5. Validate everything via `chapi validate .`
6. Add the new job via `chapi add jobXy`
7. Apply the changes and update the Chronos server via `chapi commit`

### Move jobs from chronos cluster A to cluster B successively

[](#move-jobs-from-chronos-cluster-a-to-cluster-b-successively)

Chapi is able to support you if you need to move your tasks from a chronos cluster to another one.

1. Setup your normal chapi config and local job repository
2. Create a new empty folder which stands for your second chronos cluster repository:

```
mkdir clusterBjobs
```

3. Add a local `.chapiconfig` file (see [configuration](#installation_configuration)) to the new folder:

```
touch clusterBjobs/.chapiconfig
```

4. Edit the file and add the `chronos_url` and `repository_dir` parameters for your second chronos cluster:

```
parameters:
    chronos_url: http://your.second.chronos.url:chronos_api_port/
    repository_dir: /path/to/clusterBjobs
```

5. Open a second console and switch to the new folder where the `.chapiconfig` file is located:

```
cd clusterBjobs
```

6. Now you are able to move job for job from your normal repository to the new repository:

```
mv clusterAjobs/jobXy.json clusterBjobs/jobXy.json
```

7. Chapi in console 1 will delete the jobs from the "old" cluster and chapi in the second console 2 will add the moved jobs to the new one.

Supported commands for either system
------------------------------------

[](#supported-commands-for-either-system)

chronosmarathonlist✅✅info✅✅status✅✅diff✅✅add✅✅reset✅✅pull✅✅commit✅✅scheduling✅n.a.configure✅✅validate✅Special cases in marathon:
--------------------------

[](#special-cases-in-marathon)

- Pulling a task from marathon will dump the json object with default values. This is the choice for now because calling marathon for app info sends the default values set as well. Logic to check this could be implemented in future.
- Group apps cannot be pulled from marathon in the configuration with which it was posted. This is because once an app is in marathon, the group specific config is lost.
- The marathon App id should be be prefixed by `/`. This is a good practice. The reason this needs to be forced is because the local configuration with `myapp` will be seen in marathon as `/myapp`and by chapi as two different apps.

If you find any further issues or edge case, please create an issue.

Supported Chronos versions
--------------------------

[](#supported-chronos-versions)

- v2.5

Supported Marathon versions
---------------------------

[](#supported-marathon-versions)

- v1.6.322

Docker
------

[](#docker)

You can run chapi also in a docker container. You will find the laster releases under [dockerhub](https://hub.docker.com/r/msiebeneicher/chapi-client/).

### Prepare a config file for docker

[](#prepare-a-config-file-for-docker)

Create a `.chapiconfig_docker` file with the following content:

```
profiles:
    default:
        parameters:
            cache_dir: /root/.chapi/cache
            chronos_url: 'http://your.chronos.url:4400/'
            chronos_http_username: YOUR_CHRONOS_USER
            chronos_http_password: YOUR_CHRONOS_PASS
            repository_dir: /chronos-jobs
            marathon_url: 'http://your.marathon.url:8080/'
            marathon_http_username: YOUR_MARATHON_USER
            marathon_http_password: YOUR_MARATHON_PASS
            repository_dir_marathon: /marathon-jobs
```

### Run docker

[](#run-docker)

```
docker pull msiebeneicher/chapi-client:latest

docker run -it \
    -v ~/.chapiconfig_docker:/root/.chapi/.chapiconfig \
    -v /your/local/checkout/chronos-jobs:/chronos-jobs \
    -v /your/local/checkout/marathon-jobs:/marathon-jobs \
    msiebeneicher/chapi-client:latest
```

### Run docker for development

[](#run-docker-for-development)

```
docker pull msiebeneicher/chapi-client:latest

docker run -it \
    -v ~/.chapiconfig_docker:/root/.chapi/.chapiconfig_docker \
    -v /your/local/checkout/chronos-jobs:/chronos-jobs \
    -v /your/local/checkout/marathon-jobs:/marathon-jobs \
    -v /your/local/checkout/chapi:/chapi \
    --entrypoint /bin/bash \
    msiebeneicher/chapi-client:latest
```

Todos:
------

[](#todos)

### Marathon

[](#marathon)

- The validate command for marathon is not yet implemented.
- The list command has status set as `ok` for marathon entities. This could show the last status of the app.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~91 days

Total

13

Last Release

3338d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.8.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f685ebacd3466b7941e300abfc3efb62365e3b28b760a4bc312ed9b5e682a82?d=identicon)[msiebeneicher](/maintainers/msiebeneicher)

---

Top Contributors

[![msiebeneicher](https://avatars.githubusercontent.com/u/5821183?v=4)](https://github.com/msiebeneicher "msiebeneicher (54 commits)")[![andygrunwald](https://avatars.githubusercontent.com/u/320064?v=4)](https://github.com/andygrunwald "andygrunwald (37 commits)")[![SHyx0rmZ](https://avatars.githubusercontent.com/u/654223?v=4)](https://github.com/SHyx0rmZ "SHyx0rmZ (31 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (5 commits)")[![busrakoken](https://avatars.githubusercontent.com/u/5606682?v=4)](https://github.com/busrakoken "busrakoken (2 commits)")[![bidesh](https://avatars.githubusercontent.com/u/4234595?v=4)](https://github.com/bidesh "bidesh (2 commits)")[![aurimasniekis](https://avatars.githubusercontent.com/u/15481?v=4)](https://github.com/aurimasniekis "aurimasniekis (2 commits)")[![dkleuser](https://avatars.githubusercontent.com/u/4712484?v=4)](https://github.com/dkleuser "dkleuser (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

api-clientchronosgitmarathonmesosmesosphereapichronosmesos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chapi-chapi-client/health.svg)

```
[![Health](https://phpackages.com/badges/chapi-chapi-client/health.svg)](https://phpackages.com/packages/chapi-chapi-client)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
