Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Updated README with Marathon URL defaults. Fixed overwriting of deplo…
Browse files Browse the repository at this point in the history
…y_parser variable
  • Loading branch information
Mikael Johansson committed Dec 11, 2015
1 parent 68e1afd commit 399a87a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ usage: lighter COMMAND [OPTIONS]...
Marathon deployment tool
positional arguments:
{deploy,verify} Available commands
deploy Deploy services to Marathon
verify Verify and generate Marathon configuration files
{deploy,verify} Available commands
deploy Deploy services to Marathon
verify Verify and generate Marathon configuration files
optional arguments:
-h, --help show this help message and exit
-n, --noop Execute dry-run without modifying Marathon [default: False]
-v, --verbose Increase logging verbosity [default: False]
-h, --help show this help message and exit
-n, --noop Execute dry-run without modifying Marathon [default:
False]
-v, --verbose Increase logging verbosity [default: False]
-t TARGETDIR, --targetdir TARGETDIR
Directory to output rendered config files
```

### Deploy Command
Expand All @@ -42,7 +45,9 @@ positional arguments:
optional arguments:
-h, --help show this help message and exit
-m MARATHON, --marathon MARATHON
Marathon url, e.g. "http://marathon-host:8080/"
Marathon URL like "http://marathon-host:8080/".
Overrides default Marathon URL's provided in config
files
-f, --force Force deployment even if the service is already
affected by a running deployment [default: False]
```
Expand All @@ -64,13 +69,23 @@ my-config-repo/
myservice.yml
```

Running `lighter deploy -m http://marathon-host:8080 staging/services/myservice.yml` will
Running `lighter deploy staging/services/myservice.yml` will

* Merge *myservice.yml* with environment defaults from *my-config-repo/staging/globals.yml* and *my-config-repo/globals.yml*
* Fetch the *json* template for this service and version from the Maven repository
* Expand the *json* template with variables and overrides from the *yml* files
* Post the resulting *json* configuration into Marathon

## Marathon
Yaml files may contain a `marathon:` section with a default URL to reach Marathon at. The `-m/--marathon`
parameter will override this setting when given on the command-line.

*globals.yml*
```
marathon:
url: 'http://marathon-host:8080/'
```

## Maven
The `maven:` section specifies where to fetch *json* templates from which are
merged into the configuration. For example
Expand Down Expand Up @@ -223,15 +238,6 @@ facts:
environment: 'staging'
```

## Marathon Defaults
Yaml files may contain a `marathon:` section with a default URL to reach Marathon at

*globals.yml*
```
marathon:
url: 'http://marathon-host:8080/'
```

## Installation
Place a `lighter` script in the root of your configuration repo. Replace the LIGHTER_VERSION with
a version from the [releases page](https://github.com/meltwater/lighter/releases).
Expand All @@ -258,10 +264,10 @@ Use the script like
cd my-config-repo
# Deploy/sync all services (from Jenkins or other CI/CD server)
./lighter deploy -f -m http://marathon-host:8080 $(find staging -name \*.yml -not -name globals.yml)
./lighter deploy $(find staging -name \*.yml -not -name globals.yml)
# Deploy single services
./lighter deploy -m http://marathon-host:8080 staging/myservice.yml staging/myservice2.yml
./lighter deploy staging/myservice.yml staging/myservice2.yml
```

## Integrations
Expand Down
8 changes: 4 additions & 4 deletions src/lighter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,24 @@ def verify(filenames, targetdir=None, verifySecrets=False):
help='Deploy services to Marathon',
description='Deploy services to Marathon')

deploy_parser.add_argument('-m', '--marathon', required=True, dest='marathon', help='Marathon url, e.g. "http://marathon-host:8080/"',
deploy_parser.add_argument('-m', '--marathon', required=True, dest='marathon', help='Marathon URL like "http://marathon-host:8080/". Overrides default Marathon URL\'s provided in config files',
default=os.environ.get('MARATHON_URL', ''))
deploy_parser.add_argument('-f', '--force', dest='force', help='Force deployment even if the service is already affected by a running deployment [default: %(default)s]',
action='store_true', default=False)
deploy_parser.add_argument('filenames', metavar='YMLFILE', nargs='+',
help='Service files to expand and deploy')

# Create the parser for the "verify" command
deploy_parser = subparsers.add_parser('verify',
verify_parser = subparsers.add_parser('verify',
prog='lighter',
usage='%(prog)s verify YMLFILE...',
help='Verify and generate Marathon configuration files',
description='Verify and generate Marathon configuration files')

deploy_parser.add_argument('filenames', metavar='YMLFILE', nargs='+',
verify_parser.add_argument('filenames', metavar='YMLFILE', nargs='+',
help='Service files to expand and deploy')

deploy_parser.add_argument('--verify-secrets', dest='verifySecrets', help='Fail verification if unencrypted secrets are found [default: %(default)s]',
verify_parser.add_argument('--verify-secrets', dest='verifySecrets', help='Fail verification if unencrypted secrets are found [default: %(default)s]',
action='store_true', default=False)

args = parser.parse_args()
Expand Down

0 comments on commit 399a87a

Please sign in to comment.