Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
bundles can specify services
Browse files Browse the repository at this point in the history
  • Loading branch information
jsingle committed Aug 19, 2015
1 parent 956627d commit 963409e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The `restart` command no longer takes a `--no-sync` flag, due to the move to NFS.
* **New**
* Dusty now attempts to fix a known problem with boot2docker networking, resulting in up to a 10x improvement in network performance. See [this boot2docker issue](https://github.com/boot2docker/boot2docker/issues/1022) for more information.
* Dusty bundles can now specify services, just as they specify apps
* **Misc**
* `test.once` commands that fail now cause the entire test run to fail immediately.
* When running all test suites, a tabular summary of test results is now printed at the end of the run
Expand Down
11 changes: 11 additions & 0 deletions docs/specs/bundle-specs.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ apps:
The list of apps to be run by `dusty up` if this bundle is activated.
These apps are used as entrypoints into the dependency graph defined by
your app and service specs.

## services

```
services:
- postgres
```

An optional list of services which will be run by `dusty up` if this bundle
is activated. Services specified here will be launched in addition to services
that specified apps depend on.
6 changes: 5 additions & 1 deletion dusty/compiler/spec_assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@ def _get_referenced_libs(specs):

def _get_referenced_services(specs):
"""
Returns all services that are referenced in specs.apps.depends.services
Returns all services that are referenced in specs.apps.depends.services,
or in specs.bundles.services
"""
active_services = set()
for app_spec in specs['apps'].values():
for service in app_spec['depends']['services']:
active_services.add(service)
for bundle_spec in specs['bundles'].values():
for service in bundle_spec['services']:
active_services.add(service)
return active_services

def _filter_active(spec_type, specs):
Expand Down
3 changes: 2 additions & 1 deletion dusty/schemas/bundle_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

bundle_schema = Schema({
'description': {'type': basestring, 'default': ''},
'apps': {'type': Array(basestring), 'required': True}
'apps': {'type': Array(basestring), 'required': True},
'services': {'type': Array(basestring), 'default': list}
})
4 changes: 3 additions & 1 deletion tests/unit/compiler/test_configs/simple/assembled_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ apps:
libs: []
services: []
libs: {}
services: {}
services:
bundle-specified-service:
image: someimage
2 changes: 2 additions & 0 deletions tests/unit/compiler/test_configs/simple/bundles/simple.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
apps:
- simpleapp
services:
- bundle-specified-service
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image: someimage

0 comments on commit 963409e

Please sign in to comment.