Commit Graph

1197 Commits

Author SHA1 Message Date
Mazz Mosley df74b131ff Use split_port for ports format check
Rather than implement the logic a second time, use docker-py
split_port function to test if the ports is valid.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 15:27:30 +01:00
Mazz Mosley 2e428f94ca Refactor validation out
Move validation out into its own file without causing circular
import errors.

Fix some of the tests to import from the right place.

Also fix tests that were not using valid test data, as the validation
schema is now firing telling you that you couldn't "just" have this
dict without a build/image config key.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley ea3608e1f4 Improve test coverage for validation
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley d8aee782c8 Error handling
jsonschema provides a rich error tree of info, by parsing each error
we can pull out relevant info and re-write the error messages.

This covers current error handling behaviour.

This includes new error handling behaviour for types and formatting of
the ports field.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley 6c7c598546 Format validation of ports
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley 76e6029f21 Replace service tests with config tests
We validate the config against our schema before a service is created
so checking whether a service name is valid at time of instantiation of
the Service class is not needed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Mazz Mosley da36ee7cbc Perform schema validation
Define a schema that we can pass to jsonschema to validate against the
config a user has supplied. This will help catch a wide variety of common
errors that occur.

If the config does not pass schema validation then it raises an exception
and prints out human readable reasons.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-08-07 12:06:34 +01:00
Aanand Prasad fdaa5f2cde Update volume tests for clarity
- Better method names.

- Environment variable syntax in volume paths, even when a driver is
  specified, now *will* be processed (the test wasn't testing it
  properly). However, `~` will still *not* expand to the user's home
  directory.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 16:14:37 +01:00
Aanand Prasad 8b5bd945d0 Interpolate environment variables
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-06 11:18:57 +01:00
Aanand Prasad 92ef1f5702 Make compose.config a proper module
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-05 15:50:22 +01:00
Luke Marsden a68ee0d9c2 Support volume_driver in compose
* Add support for volume_driver parameter in compose yml
* Don't expand volume host paths if a volume_driver is specified
  (i.e., disable compose feature "relative to absolute path
  transformation" when volume drivers are in use, since volume drivers
  can use name where host path is normally specified; this is a
  heuristic)

Signed-off-by: Luke Marsden <luke@clusterhq.com>
2015-07-31 15:23:15 +01:00
Aanand Prasad 27bd987f28 Add test for trailing slash volume copying bug
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-30 10:31:54 +01:00
Aanand Prasad dc7bdd10d4 Merge pull request #1787 from aanand/fix-duplicate-volume-bind
Fix "Duplicate volume mount" error when config has trailing slashes
2015-07-30 09:59:08 +01:00
Aanand Prasad 80d90a745a Make sure an exception in any iterator gets raised in the main thread
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>

Conflicts:
	compose/cli/multiplexer.py
2015-07-29 19:42:33 +01:00
Aanand Prasad a9942b512a Wait for all containers to exit when running 'up' interactively
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 19:42:33 +01:00
Aanand Prasad 9768872507 Fix "Duplicate volume mount" error when config has trailing slashes
When an image declares a volume such as `/var/lib/mysql`, and a Compose
file has a line like `./data:/var/lib/mysql/` (note the trailing slash),
Compose creates duplicate volume binds when *recreating* the container.
(The first container is created without a hitch, but contains multiple
entries in its "Volumes" config.)

Fixed by normalizing all paths in volumes config.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 18:42:08 +01:00
Aanand Prasad 118a389646 Update API version to 1.19
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-29 15:44:21 +01:00
Mazz Mosley 65cc84140a Merge pull request #1736 from aanand/deprecate-allow-insecure-ssl
Deprecate --allow-insecure-ssl
2015-07-23 14:09:17 +01:00
Aanand Prasad 70c7d27c4e Merge pull request #1758 from mnowster/improve-scale-test-coverage
Improve scale test coverage
2015-07-23 11:07:48 +01:00
Aanand Prasad 04a773f1c8 Deprecate --allow-insecure-ssl
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-23 10:56:21 +01:00
Mazz Mosley 119901c19b Improve test coverage for scale
Also includes tiny amount of code cleanup, being explicit with imports.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-23 10:55:57 +01:00
Aanand Prasad 1739448402 Don't use custom name for one-off containers
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-22 15:39:56 +01:00
Aanand Prasad 233c509f71 Remove logging test
It doesn't do much other than cause the remainder of the test suite to
generate lots of junk output.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-21 15:56:37 +01:00
Mazz Mosley cc0bfea8a1 Merge pull request #1711 from aanand/custom-names
Add container_name option for specifying a custom container name
2015-07-21 14:28:16 +01:00
Aanand Prasad 89f6caf871 Allow any volume mode to be specified
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 16:14:09 +01:00
Aanand Prasad a3191ab90f Add container_name option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 15:50:09 +01:00
Aanand Prasad ced94a3504 Make smart recreate the default
Add --force-recreate flag to enable the old default behaviour of
recreating everything.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-17 11:28:02 +01:00
Mazz Mosley c7dccccd1f Merge pull request #1704 from aanand/fix-timeout-type
Make sure up/restart/stop timeout is an int
2015-07-16 10:50:06 +01:00
Aanand Prasad 0c5c8d1f00 Handle case where /containers/json returns "Labels": null
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 17:13:33 +01:00
Aanand Prasad ec8bf066ba Make sure up/restart/stop timeout is an int
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-15 16:56:39 +01:00
Mazz Mosley 2db0a377e2 Minor test refactor
Rather than creating a docker client within each test, create one
at setup and make it accessible to the whole class.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-13 14:11:12 +01:00
Aanand Prasad 81707ef1ad Merge pull request #1643 from aanand/warn-about-legacy-one-off-containers
Show an error on 'run' when there are legacy one-off containers
2015-07-08 14:48:03 +01:00
Aanand Prasad 8b033d3946 Merge pull request #1665 from mnowster/1648-support-log-opt
1648 support log opt
2015-07-07 17:08:04 +01:00
Mazz Mosley 6f31e8ebe9 Add support for log_opt
When specifying a log_driver you want to specify some options for
the logger as per the docker run --log-opt option. The logger
options are key value pairs.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-07 16:26:43 +01:00
Aanand Prasad 531265bc84 Fix smart recreate when 'image' is changed to something nonexistent
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-07 16:01:44 +01:00
Mazz Mosley fc26982132 Add in memswap_limit run option
By allowing the memswap_limit option to be defined we also need to
check that mem_limit is set, you can't have swap without a limit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-06 17:08:57 +01:00
Aanand Prasad e98caf5cf9 Show an error on 'run' when there are legacy one-off containers
Also warn the user about the one-off containers in the standard error
message about legacy containers.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-06 14:45:17 +01:00
Aanand Prasad fc8f564558 Merge pull request #1632 from mnowster/extends_file_default_behaviour
Extends file default behaviour and fixes circular reference bug
2015-07-06 13:28:54 +01:00
Aanand Prasad f42fd6a3ad Merge pull request #1642 from aanand/fix-1573
Fix bug where duplicate container is leftover after 'up' fails
2015-07-03 16:25:53 +01:00
Mazz Mosley 317bbec98c Move make_service_dict out of config
This top level function is a test helper, so I've moved it into the
config_test file and updated accordingly.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 15:06:53 +01:00
Mazz Mosley 6e6dbdad95 working_dir is no longer optional
When building test data using make_service_dict, we need to include
working_dir as it is core to some of the functionality of
ServiceLoader.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:56:18 +01:00
Aanand Prasad 0b887b841f Stop 'rm' and 'ps' listing services not defined in the current file
If you have an alternate YAML file with different services defined,
containers for those services will be shown in `docker-compose ps` even
if you don't pass that file in.

Furthermore, `docker-compose rm` will claim that it's going to remove
them, but actually won't.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-03 14:34:27 +01:00
Mazz Mosley c6e03d739d Test self referencing 'file'
When specifying the 'file' key to a value of it's own name, test
that this works and does not cause a false positive circular reference
error.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:14:47 +01:00
Mazz Mosley ba71e2a549 Use new load_from_filename
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 14:05:14 +01:00
Mazz Mosley 254bc4908c Move extends validation into ServiceLoader class
This refactoring allows us to raise an error when there is no
'file' key specified in the .yml and no self.filename set. This
error was specific to the tests, as the tests are
the only place that constructs service dicts without sometimes
setting a filename.

Moving the function within the class as well as it is code that
is exclusively for the use of validating properties for the
ServiceLoader class.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:31 +01:00
Mazz Mosley 24c1d95869 Refactor extends validation tests
Split them out into individual validation tests so it is clearer
to see what is going on and to enable adding further validation
tests.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:31 +01:00
Mazz Mosley 6e4a954dbd 'file' key can be omitted from extends
If the 'file' key is not set in the extends_options dict then we
look for the 'service' from within the same file.

Fixes this issue: https://github.com/docker/compose/issues/1237

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-03 11:26:30 +01:00
Aanand Prasad 62b47224f0 Fix bug where duplicate container is leftover after 'up' fails
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-07-03 10:46:07 +01:00
Aanand Prasad db7e5124f3 Merge pull request #1488 from dnephin/config_from_stdin
Support reading config from stdin
2015-07-03 09:03:40 +01:00
Aanand Prasad a6b9982a1e Merge pull request #1633 from jeffk/parse_env_vars_in_all_volumes
Added env var parsing to volume container paths
2015-07-03 08:55:48 +01:00
Daniel Nephin ae96fc0071 Support reading config from stdin.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-07-02 22:16:22 -04:00
Jeff Kramer 8709dc3c24 Added env var parsing to volume container paths
This commit adds environment variable parsing to the container side
of the volume mapping in configs. The common use case for this is
mounting SSH agent sockets in a container, using code like:

volumes:
    - $SSH_AUTH_SOCK:$SSH_AUTH_SOCK
environment:
    - SSH_AUTH_SOCK

Signed-off-by: Jeff Kramer <jeff.kramer@voxmedia.com>
2015-07-02 13:13:38 -05:00
Mazz Mosley f33f673b49 Allow _.- chars in service names
As VALID_CHARS is shared with project names, these chars are also
now allowed within project names.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Mazz Mosley 8cf84ea552 Fix missing image names
These tests were indeed raising a config error, but not for the reason
intended/tested for. I've added in the image name so the config error
raise is correctly testing the Service name.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-07-01 17:57:50 +01:00
Aanand Prasad c8751980f9 Merge pull request #1578 from aanand/fix-migrate-help
Fix 'docker-compose help migrate-to-labels'
2015-06-21 17:25:52 -07:00
Aanand Prasad 4f83a18912 Merge pull request #1570 from aanand/fix-build-pull
Explicitly set pull=False when building
2015-06-21 17:25:46 -07:00
Aanand Prasad 93372dd665 Fix 'docker-compose help migrate-to-labels'
- Fix "No such command" error

- Add text from migration section of install docs

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-19 15:43:53 -07:00
Aanand Prasad c22cc02df5 Don't set network mode when none is specified
Setting a value overrides the new default network option.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-19 15:22:13 -07:00
Aanand Prasad bef0926c58 Explicitly set pull=False when building
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-18 17:43:16 -07:00
Aanand Prasad 77c939b256 Merge pull request #1142 from calou/master
Added support of option mac-address
2015-06-17 14:39:00 -07:00
Sébastien Gruchet b76ac6e633 Added support to option mac-address
Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Updated doc

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Fixed LINT errors

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Changed mac-address entry order in config keys

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>

Changed attributes order in docs/yml.md

Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>
2015-06-17 21:28:17 +02:00
Aanand Prasad bc14c473c9 Merge pull request #1521 from dano/validate-service-names
Validate that service names passed to Project.containers aren't bogus.
2015-06-16 10:45:49 -07:00
Aanand Prasad 5b2a0cc73d Merge pull request #1406 from vdemeester/667-compose-port-scale
Fixing docker-compose port with scale (#667)
2015-06-15 10:58:44 -07:00
Daniel Nephin 06db577105 Move converge() to a test module, and use a short timeout for tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 17:18:27 -04:00
Travis Thieman c24d5380e6 Extend up -t to pass timeout to stop running containers
Signed-off-by: Travis Thieman <travis.thieman@gmail.com>
2015-06-14 16:45:28 -04:00
Daniel Nephin 60351a8e07 Speed up integration test and make cleanup easier by using labels
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 16:45:28 -04:00
Daniel Nephin d827809ffb Use labels to filter containers.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-06-14 16:45:28 -04:00
Aanand Prasad 08bc4b830b Fix volume binds de-duplication
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-12 16:57:22 -04:00
Vincent Demeester a5fd91c705 Fixing docker-compose port with scale (#667)
Fixes #667 and Closes #735 (taking over it)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-06-10 23:26:33 +02:00
Aanand Prasad 4fd5d58076 Test against Docker 1.7.0 RC2
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-10 14:19:36 -04:00
Aanand Prasad ff151c8ea0 Test that data volumes now survive a crash when recreating
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-09 13:06:09 -04:00
Dan O'Reilly c59c9dd951 Add integration test for service name verification
Add a test to make sure NoSuchService is raised if
a bogus service name is given to 'docker-compose logs'.

Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-06-08 17:04:42 -04:00
Aanand Prasad db2d02dc0b Remove Service.start_or_create_containers()
It's only used in a single test method.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-06-08 10:59:03 -04:00
Aanand Prasad 7d2a89427c Merge pull request #1466 from noironetworks/changing-scale-to-warning
Modified scale awareness from exception to warning
2015-06-04 16:21:01 +01:00
Ben Firshman ec437313a7 Change kill SIGINT test to use SIGSTOP
I think the original intention of the original test was the check that
different signals work, I think. This does this -- it sends a signal
that doesn't cause the container to stop.

Closes #759. Replaces #1467.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-05-29 11:13:37 +01:00
André Martins ae63d35660 Modified scale awareness from exception to warning
Signed-off-by: André Martins <martins@noironetworks.com>
2015-05-26 23:59:45 +01:00
Todd Whiteman b9c502531d Possible division by zero error when pulling an image - fixes #1463
Signed-off-by: Todd Whiteman <todd.whiteman@joyent.com>
2015-05-26 15:34:34 -07:00
Aanand Prasad 1344099e29 Merge pull request #1444 from aanand/migrate-in-dependency-order
Migrate containers in dependency order
2015-05-26 17:30:14 +01:00
Aanand Prasad 7da8e6be3b Migrate containers in dependency order
This fixes a bug where migration would fail with an error if a
downstream container was migrated before its upstream dependencies, due
to `check_for_legacy_containers()` being implicitly called when we fetch
`links`, `volumes_from` or `net` dependencies.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 16:03:06 +01:00
Aanand Prasad 4795fd874f Fix regression in `docker-compose up`
When an upstream dependency (e.g. a db) has a container but a downstream
service (e.g. a web app) doesn't, a web container is not created on
`docker-compose up`.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 16:01:05 +01:00
Aanand Prasad 0b4d9401ee Bail out immediately if there are legacy containers
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-26 11:53:51 +01:00
Aanand Prasad 051f56a1e6 Fix bugs with one-off legacy containers
- One-off containers were included in the warning log messages, which can
  make for unreadable output when there are lots (as there often are).

- Compose was attempting to recreate one-off containers as normal
  containers when migrating.

Fixed by implementing the exact naming logic from before we used labels.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:49 +01:00
Aanand Prasad b5ce23885b Split out fetching of legacy names so we can test it
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:49 +01:00
Aanand Prasad 0fdb8bf814 Refactor migration logic
- Rename `migration` module to `legacy` to make its legacy-ness explicit

- Move `check_for_legacy_containers` into `legacy` module

- Fix migration test so it can be run in isolation

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 18:21:09 +01:00
Aanand Prasad b0cb31c186 Use 'top' instead of 'sleep' as a dummy command
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-21 16:24:29 +01:00
Daniel Nephin 022f81711e Fixes #1434, Project.containers with service_names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-20 20:47:34 -04:00
lsowen ea7ee301c0 Add security_opt as a docker-compose.yml option
Signed-off-by: Logan Owen <lsowen@s1network.com>
2015-05-19 13:47:41 -04:00
Aanand Prasad ef4eb66723 Implement smart recreate behind an experimental CLI flag
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-05-18 18:39:18 +01:00
Daniel Nephin 62059d55e6 Add migration warning and option to migrate to labels.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:55:12 -04:00
Daniel Nephin ed50a0a3a0 Resolves #1066, use labels to identify containers
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:47:26 -04:00
Daniel Nephin 28d2aff8b8 Fix teardown for integration tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-18 10:44:44 -04:00
Daniel Nephin 417d9c2d51 Use individual volumes for recreate instead of volumes_from
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-11 13:01:43 -04:00
delbert@umn.edu df87bd91c8 Added devices configuration option
Signed-off-by: Dan Elbert <dan.elbert@gmail.com>
2015-05-11 10:50:58 -05:00
Daniel Nephin 6829efd4d3 Resolves #874, Rename instead of use an intermediate.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-05-07 21:53:41 -04:00
Daniel Nephin 0f2f9db6d8 Merge pull request #1388 from vdemeester/1303-log-driver-support
Add support for log-driver as a docker-compose.yml option
2015-05-07 12:00:42 -04:00
Vincent Demeester f626fc5ce8 Add support for log-driver in docker-compose.yml
Closes #1303

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-05-06 13:18:58 +02:00
CJ b06294399a See #1335: Added --read-only
Signed-off-by: CJ <lim@chernjie.com>
2015-05-02 23:39:39 +08:00
Daniel Nephin 4bce388b51 Merge pull request #1376 from aanand/fix-build-non-ascii-filename
Make sure the build path we pass to docker-py is a binary string
2015-04-30 20:54:21 -04:00
Daniel Nephin 6c95eed781 Merge pull request #1269 from aanand/labels
Implement 'labels' option
2015-04-30 20:49:11 -04:00
Aanand Prasad 4f366d8355 Make sure the build path we pass to docker-py is a binary string
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-30 11:57:46 +01:00
Aanand Prasad 7e0ab0714f Merge pull request #1344 from dnephin/fix_pull_with_sha
Support image with ids instead of names
2015-04-29 16:46:34 +01:00
Aanand Prasad 2e6bc078fb Implement 'labels' option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-29 16:45:18 +01:00
Daniel Nephin 3dd860f0ba Fix #923, support image with ids instead of names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-04-29 10:13:18 -04:00
Aanand Prasad 16f8106149 Merge pull request #1158 from chernjie/addhosts
Add extra_hosts to yml configuration --add-hosts
2015-04-27 12:26:29 +01:00
xuxinkun 688f82c1cf Add cpuset config.
Signed-off-by: xuxinkun <xuxinkun@gmail.com>
2015-04-26 00:14:52 +08:00
Daniel Nephin a631c1eddb Merge pull request #1357 from turtlemonvh/1350-extends_parent_build_directory_dne_error
Fix for #1350, nonexisting build path in parent section causes extending section to fail
2015-04-27 13:49:01 -04:00
Timothy Van Heest 855855a0e6 Fix for #1350, nonexisting build path in parent section causes extending section to fail
Signed-off-by: Timothy Van Heest <timothy.vanheest@gmail.com>
2015-04-27 10:55:30 -04:00
Daniel Nephin 89789c54ad Merge pull request #1232 from aleksandr-vin/add-parent-directories-search-for-default-compose-files
Add parent directories search for default compose-files
2015-04-24 13:12:24 -04:00
CJ 25ee3f0033 Remove extra s from --add-host
linting...
six.string_types
list-of-strings in examples
disallow extra_hosts support for list-of-dicts
A more thorough sets of tests for extra_hosts
Provide better examples
As per @aanand's [comment](https://github.com/docker/compose/pull/1158/files#r28326312)

  I think it'd be better to check `if not isinstance(extra_hosts_line,
  six.string_types)` and raise an error saying `extra_hosts_config must be
  either a list of strings or a string->string mapping`. We shouldn't need
  to do anything special with the list-of-dicts case.
order result to work with assert
use set() instead of sort()

Signed-off-by: CJ <lim@chernjie.com>
2015-04-24 09:21:29 +08:00
Thomas Desvenain 8098b65576 Fix when pyyaml has interpreted line as a dictionary
Added unit tests in build_extra_hosts + fix

Signed-off-by: CJ <lim@chernjie.com>
2015-04-24 09:21:21 +08:00
Sam Wing fb81c37ca6 added the extra_hosts option to the yml configuration which exposes the --add-host flag from the docker client
Signed-off-by: Sam Wing <sampwing@gmail.com>
2015-04-23 21:54:59 +08:00
Daniel Nephin e6ec76161d Merge pull request #1293 from mchasal/1224
1224: Check that image or build is specified.
2015-04-21 15:19:11 -04:00
Aanand Prasad b317071cf3 Merge pull request #1205 from josephpage/run-rm-restart
[cli] run --rm overrides restart: always
2015-04-21 15:48:43 +01:00
Aanand Prasad 2291fa2d45 Fix --timeout flag on restart, add tests for stop and restart
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-21 11:59:33 +01:00
Michael Chase-Salerno 24a6c240fc Testcase for #1224, check that image or build is specified
Signed-off-by: Michael Chase-Salerno <bratac@linux.vnet.ibm.com>
2015-04-15 21:38:24 +00:00
Michael Chase-Salerno 15b763acdb Fix for #1224, check that image or build is specified
Signed-off-by: Michael Chase-Salerno <bratac@linux.vnet.ibm.com>
2015-04-15 02:03:02 +00:00
Aleksandr Vinokurov ceff5cb9ca Add parent directories search for default compose-files
Does not change directory to the parent with the compose-file found.
Works like passing '--file' or setting 'COMPOSE_FILE' with absolute path.
Resolves issue #946.

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
2015-04-09 22:36:47 +00:00
Ben Firshman 4926f8aef6 Merge pull request #1261 from aanand/fix-vars-in-volume-paths
Fix vars in volume paths
2015-04-09 14:44:07 +01:00
Steven Dake 1d7247b67e Remove stray print
A previous commit introduced a stray print operation.  Remove it.

Signed-off-by: Steven Dake <stdake@cisco.com>
2015-04-08 12:49:37 -07:00
Aanand Prasad fd568b389d Fix home directory and env expansion in volume paths
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-04-07 16:23:45 +01:00
Joseph Page 0b48e137e8 add unit tests for run --rm with restart
Signed-off-by: Joseph Page <joseph.page@rednet.io>
2015-04-07 10:18:25 +02:00
Steven Dake 94277a3eb0 Add --pid=host support
Allow docker-compsoe to use the docker --pid=host API available in 1.17

Signed-off-by: Steven Dake <stdake@cisco.com>
2015-04-06 12:44:35 -07:00
Moysés Borges 8584525e8d Interpret 'build:' as relative to the yml file
* This fix introduces one side-effect: the build parameter is now
validated early, when the service dicionary is first constructed.
That leads to less scary stack traces when the path is not valid.

* The tests for the changes introduced here alter the fixtures
of those (otherwise unrelated) tests that make use of the 'build:'
parameter)

Signed-off-by: Moysés Borges Furtado <moyses.furtado@wplex.com.br>
2015-03-31 18:47:26 -03:00
Aanand Prasad 907918b492 Merge multi-value options when extending
Closes #1143.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-31 15:30:59 -04:00
Aanand Prasad 2a415ede08 When extending, `build` replaces `image` and vice versa
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-30 17:14:19 -04:00
akoskaaa fa2fb6bd38 [pep8] flake8 run for everything, fix items from this change
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
2015-03-25 23:15:34 -07:00
akoskaaa f9ea5ecf40 [pep8] make test files and config files pep8 valid
Signed-off-by: akoskaaa <akos.hochrein@prezi.com>
2015-03-25 20:20:38 -07:00
Aanand Prasad 83dcceacaf Fix regression in Dns and DnsSearch settings
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-24 16:17:05 -07:00
Aanand Prasad 35c6e0314c Fix volume merging when there's no explicit host path
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-24 13:26:36 -07:00
Aanand Prasad 276e43ca6b Fix service dict merging when only one dict has a volumes key
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-24 13:26:36 -07:00
Aanand Prasad 965426e39b Revert "Add 'labels:' config option"
This reverts commit 721327110d.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-23 15:04:04 -07:00
Aanand Prasad 721327110d Add 'labels:' config option
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-20 18:12:04 -07:00
Aanand Prasad 37efdb1f8b Make volume host paths relative to file, merge volumes when extending
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-20 15:45:16 -07:00
Aanand Prasad 4c582e4352 Implement `extends`
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-20 15:45:16 -07:00
Aanand Prasad eef4bc3917 Specify all HostConfig at create time
This is required for Swarm integration: the cluster needs to know
about config like `links` and `volumes_from` at create time so that it
can co-schedule containers.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-20 15:14:07 -07:00
funkyfuture 4c5a80f253 Change port in ports-composefile to 49152
This shall lower the propability to interfere with another service (e.g. the
WebUI of an application) that is running on the machine where tests are run.

Signed-off-by: funkyfuture <funkyfuture@riseup.net>
2015-03-17 00:21:29 +01:00
Ben Firshman dae451019b Merge pull request #1099 from aanand/fix-env-file-resolution
Fix env file resolution
2015-03-13 16:49:10 +00:00
Aanand Prasad 3c8ef6a94c Fix Project.up() tests
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-13 14:51:26 +00:00
Aanand Prasad 528bed9ef6 Fix environment resolution
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-13 14:22:28 +00:00
Aanand Prasad 4ecf5e01ff Extract YAML loading and parsing into config module
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-03-13 14:21:58 +00:00
Aanand Prasad 25c70c2af4 Merge pull request #1076 from gilclark/master
Make volumes_from and net containers first class dependencies
2015-03-13 11:46:13 +00:00
Ian VanSchooten 86b723e227 Provide user override option on command line
Allows overriding a user on the command line from the one specified in
the docker-compose.yml

The added tests verify that a specified user overrides a default
user in the docker-compose.yml file.

Based on commit f2f01e207b by @chmouel

Signed-off-by: Ian VanSchooten <ian@badgelabsllc.com>
2015-03-11 00:11:31 -04:00
Gil Clark 95f4e2c7c3 Make volumes_from and net containers first class dependencies and
assure that starting order is correct.  Added supporting unit and
integration tests as well.

Signed-off-by: Gil Clark <gilclark1@gmail.com>
2015-03-06 13:30:56 -08:00
Daniel Nephin f47431d591 Resolves #927 - fix merging command line environment with a list in the config
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-03-02 10:23:43 -05:00
Aanand Prasad 8610adcaf3 Merge pull request #997 from abesto/use-latest-docker-py
Use docker-py 1.0.0
2015-03-02 14:15:18 +00:00
Zoltan Nagy 8f38b28816 Use docker-py 1.0.0
Signed-off-by: Zoltan Nagy <abesto@abesto.net>
2015-03-02 13:11:02 +01:00
Aanand Prasad db3b4731cd Merge pull request #1044 from usrenmae/py3-compat
Move several steps closer to python3 compatibility
2015-03-02 12:08:39 +00:00
Igor Ch f1fc1d7a16 Move several steps closer to python3 compatibility
Signed-off-by: Igor Ch <usrenmae@gmail.com>
2015-02-28 23:26:20 +02:00
KingsleyKelly fa195bc829 Add -f flag as option on rm.
Signed-off-by: Kingsley Kelly <kingsley.kelly@gmail.com>
2015-02-27 07:24:43 +00:00
Aanand Prasad bc1f6c97d8 Merge pull request #898 from aanand/support-fig-yml
Support fig.yml
2015-01-29 13:47:49 -05:00
Aanand Prasad 7c087f1c07 Support fig.y(a)ml and show a deprecation warning
Closes #864

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-29 13:14:44 -05:00
Aanand Prasad 9bc7604e0e Make sure we're testing uppercase directories properly
(OS X is case-sensitive so we can't have fixture dirs which are
identically named if you ignore case)

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-28 17:19:27 -05:00
Aanand Prasad de07e0471e Show a nicer error when the env file doesn't exist
Closes #865

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-28 16:20:01 -05:00
Aanand Prasad 6c45b6ccdb Make sure we're testing blank lines and comments in env files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-28 16:18:02 -05:00
Aanand Prasad 1476027410 Fix test for image-declared volumes
A stray 'fig' got lost in the merge post-rename, meaning the containers
weren't being cleaned up properly.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-27 14:46:58 -05:00
Aanand Prasad 620e29b63f Rename binary to docker-compose and config file to docker-compose.yml
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 21:00:23 +00:00
Aanand Prasad 2af7693e64 WIP: rename Fig to Compose
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 21:00:23 +00:00
Aanand Prasad cbd3ca07c4 Handle Swarm-style prefixed names in Container.from_ps()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 20:38:06 +00:00
Aanand Prasad edb6b24b8f Handle Swarm-style prefixed names in Service.containers()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 20:38:06 +00:00
Aanand Prasad 608f29c7cb Unit tests for Service.containers() and get_container_name()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 20:38:06 +00:00
Aanand Prasad 17a8a7be4b (Failing) test for preservation of volumes declared in images
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-01-20 20:16:18 +00:00
Daniel Nephin 2dd1cc80ca Revert "Merge pull request #711 from dnephin/fix_volumes_on_recreate"
This reverts commit 55095ef488, reversing
changes made to 72095f54b2.

Signed-off-by: Daniel Nephin <dnephin@yelp.com>
2015-01-20 12:03:03 -08:00
Daniel Nephin 7eb476e61d Resolves #447, fix volume logic for recreate container
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-01-14 16:20:59 -05:00
Daniel Nephin 26f45efea2 Remove unused intermediate_container from return value.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-01-12 22:16:54 -08:00
Aanand Prasad 4827e60641 Merge pull request #568 from Aigeruth/fix/project_name
Convert project_name to lowercase
2015-01-12 16:23:09 +00:00
Christophe Labouisse aa0c43df96 Add cpu_shares option in fig.yml
This options maps exactly the docker run option with the same name.

Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
2015-01-11 20:10:48 +01:00
Daniel Nephin 3ee8437eaa Fix the failing test.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-01-08 10:55:40 -05:00
Daniel Nephin b903217a4a Merge pull request #544 from LuminosoInsight/external-links
Allow links to containers outside of the project
2015-01-08 10:39:00 -05:00
Daniel Nephin 3056ae4be3 Add a no-build option to fig up, to save time when services were already freshly built.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-12-31 13:47:24 -05:00
Daniel Nephin 5b777ee5f1 Cleanup service unit tests and restructure some service create logic.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-12-31 13:39:41 -05:00
Jason Bernardino Alonso 4257707244 Accept an external_links list in the service configuration dictionary to create links to containers outside of the project
Signed-off-by: Jason Bernardino Alonso <jalonso@luminoso.com>
Signed-off-by: Mauricio de Abreu Antunes <mauricio.abreua@gmail.com>
2014-12-30 15:31:33 -05:00
Aanand Prasad 70c3676084 Merge pull request #763 from bfirsh/pass-through-detach-to-create-container
Don't attach stdin and stdout when in detach mode
2014-12-30 16:05:53 +00:00
Ben Firshman e89826fe43 Don't attach stdin and stdout when in detach mode
This is primarily to make it work with Swarm, which checks that
AttachStd{in,out,err} is false when creating containers.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-12-30 14:13:36 +00:00
Aanand Prasad 0e172228d1 Merge pull request #485 from squebe/run-service-ports
Added map service ports option for run command.
2014-12-19 14:17:57 -08:00
Mohammad Salehe 5182bd0968 Add dns_search support in yml config
Signed-off-by: Mohammad Salehe <salehe@gmail.com>
2014-12-15 16:37:31 +03:30
Aanand Prasad 05544ce241 Stronger integration tests for volume binds
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-12-12 17:53:57 -08:00
Stephen Quebe cc834aa564 Added map service ports option for run command.
When using the fig run command, ports defined in fig.yml can be mapped
to the host computer using the -service-ports option.

Signed-off-by: Stephen Quebe <squebe@gmail.com>
2014-12-11 20:30:38 -05:00
Daniel Nephin 8f8e322de2 Include image name for env_file tests.
Signed-off-by: Daniel Nephin <dnephin@yelp.com>
2014-12-11 14:25:26 -08:00
Daniel Nephin 64762c9dea Merge pull request #716 from bfirsh/pull-latest-tag-by-default
Pull latest tag by default
2014-12-11 15:58:40 -05:00
Ben Firshman 8ebec9a67f Pull latest tag by default
This was changed in Docker recently:

https://github.com/docker/docker/pull/7759

This means we aren't pulling loads of tags when we only use the
latest.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-12-11 12:37:04 -08:00
Daniel Nephin 3c0f297ba6 Some minor cleanup from yelp/fig
Signed-off-by: Daniel Nephin <dnephin@yelp.com>
2014-12-11 10:08:39 -08:00
Ben Langfeld 98b6d7be78 Add support for 'env_file' key
Signed-off-by: Ben Langfeld <ben@langfeld.me>
2014-12-08 23:42:09 +00:00
Tyler Fenby 5c58180538 Add capability add/drop introduced in Docker 1.2
Signed-off-by: Tyler Fenby <tylerfenby@gmail.com>
2014-12-08 12:32:52 -05:00
Ben Firshman e9d946b038 Merge pull request #594 from popox/restart-option
Add restart option to Fig.
2014-12-08 08:43:27 -08:00
Daniel Nephin 65ae22e79a Merge pull request #611 from raulcd/604_support_reloading_containers
Add signal in the kill CLI commando to send a specific signal to the service
2014-11-13 10:28:14 -05:00
Paul B 04da6b035e Add restart option to Fig. Related to #478
Signed-off-by: Paul Bonaud <paul@bonaud.fr>
2014-11-08 12:10:11 +01:00
Andrew Burkett 4f6d02867b Move to build_port_bindings(). Added Tests
Signed-off-by: Andrew Burkett <burkett.andrew@gmail.com>
2014-11-06 18:11:09 -08:00
Raúl Cumplido 9abdd337b5 Add signal in the kill CLI commando to send a specific signal to the service
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2014-11-04 12:22:39 +00:00
Ben Firshman 38a3ee8d63 Use upstream dockerpty 0.3.2
This reverts commit 60411e9f05.

Closes #556

Signed-off-by: Ben Firshman <ben@firshman.co.uk>

Conflicts:
	requirements.txt
	setup.py
2014-11-04 10:23:42 +00:00
Michael A. Smith 782a46fd60 Fixes #602 Allowing `help $cmd` with no figfile
Signed-off-by: Michael A. Smith <michael@smith-li.com>
2014-11-02 06:22:16 -05:00
Ben Firshman 9813a8d5be Merge pull request #562 from tjrivera/insecure-registry
Allow dependent image pull from insecure registry
2014-10-22 18:45:03 +01:00
Tyler Rivera 491181ec31 Allow dependent image pull from insecure registry
PR #490 Provides the ability to pull from an insecure registry by passing --allow-insecure-ssl. This commit extends the work done in #490 and adds the ability to pass --allow-insecure-ssl to the up and run commands which will attempt to pull dependent images if they do not exist.

Signed-off-by: Tyler Rivera <riverat2@email.chop.edu>
2014-10-22 10:57:43 -04:00
Gabor Nagy c838f7da18 Convert project_name to lowercase
Signed-off-by: Gabor Nagy <mail@aigeruth.hu>
2014-10-21 13:40:19 +02:00
Daniel Nephin 7544580b4b Resolves #553, Resolves #546 - bug fixes with unit tests
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-10-18 13:54:10 -04:00
Aanand Prasad 60411e9f05 Vendor dockerpty at c8b493553477c9a57d163c71c97b2102f44a6ce7
Include TLS fixes and relative imports:

c8b4935534

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-10-16 16:24:39 +01:00
Aanand Prasad b318585f3c TLS support, with same env vars as docker client
Thanks to @jkingyens for the bulk of the work.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-10-16 10:41:26 +01:00
Ben Firshman 1820306d0a Merge pull request #529 from chmouel/override-environement
Allow overriding environements on command line
2014-10-14 11:27:20 +01:00
Ben Firshman 352062c2dc Use /bin/echo for intermediate container
In cases where the service is using a minimal container,
/bin/echo can be created but echo cannot.

See #517

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-10-10 12:24:00 +01:00
Chmouel Boudjnah 92249364b6 Allow overriding environements on command line
Add a new command line option -e to override environement variables when
running a service.

Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
2014-10-09 16:33:41 +02:00
Aanand Prasad 431fdaa0f1 Merge pull request #490 from LuminosoInsight/insecure-pull
Allow pulls from an insecure registry
2014-10-01 10:52:54 -07:00
satoru 62b9c64311 Add support for the --entrypoint option of docker run
Signed-off-by: Satoru Logic <satorulogic@gmail.com>
2014-10-01 09:28:28 -07:00
Moss Collum 3408e0d463 Add unit test for Service.pull
Signed-off-by: Moss Collum <mcollum@luminoso.com>
2014-10-01 11:09:19 -04:00
Aanand Prasad 267be12bb2 Merge pull request #456 from dnephin/volumes_from_service
Fix volumes_from a service with no containers
2014-09-30 18:33:39 -07:00
Aanand Prasad ec5c864cc7 Merge pull request #460 from dnephin/fix_tests_for_docker_1.1
Fix test failures on docker 1.1.2
2014-09-30 17:52:38 -07:00
Daniel Nephin fac49b62b6 Support setting project name from the environment.
Signed-off-by: Daniel Nephin <dnephin@yelp.com>
2014-09-29 18:01:08 -04:00
Aanand Prasad 537d435a28 Fix race condition in cli_test.py
We weren't waiting for the build to finish, causing the rest of the test
to occasionally fail when looking for the image.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-09-26 11:42:16 -07:00
Aanand Prasad d978787fcc Merge pull request #439 from dnephin/faster_integration_tests
Faster integration testing
2014-09-24 17:34:52 -07:00
Ben Firshman fc4c35e977 Merge pull request #411 from Banno/fig-pull
adding "fig pull [SERVICE]" to pull service images
2014-09-10 23:57:20 +01:00
Daniel Nephin e0b0801e87 Do less work during integration testing.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-09 22:00:21 -04:00
Daniel Nephin 71e7103662 Fix some tests failing with docker 1.1.2 and add a comment to recreate_container() explaining what it does.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-09 20:59:28 -04:00
Daniel Nephin dbd723659b Add container.get() which removes the duplication of container.inspect() in every property, and provides a nicer interface for querying container data.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-09 20:59:28 -04:00
Ben Firshman ce8ef23c09 Merge pull request #393 from marksteve/restart
Implement restart command (Closes #98)
2014-09-08 17:47:08 +01:00
Daniel Nephin 7fd37c89b9 Remove fig.packages replace with real deps.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-05 11:44:49 -07:00
Daniel Nephin f5d43b6452 Resolves #455 - volumes_from a service with no containers.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-04 22:21:49 -04:00
Daniel Nephin c48ee5caef Add a new fig command for retrieving the locally bound port of a service.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-09-04 22:09:12 -04:00
Ben Firshman 2827786886 Merge pull request #364 from docker/non-numeric-link-alias
Non-numeric link alias
2014-09-04 20:39:18 +01:00
Daniel Nephin 24044fa704 Some additional validation for container ports, and a couple extra test cases.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-08-31 02:00:58 -04:00
Daniel Nephin 07fa169fd2 Resolves #260, #301 and #449
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-08-31 02:00:52 -04:00
Luke Amdor e51851c884 adding "fig pull [SERVICE]" to pull service images
Fixes #158

Signed-off-by: Luke Amdor <luke.amdor@gmail.com>
2014-08-15 09:24:15 -05:00
Mark Steve Samson e224c4caa4 Add integration test for restart command
Signed-off-by: Mark Steve Samson <hello@marksteve.com>
2014-08-13 10:01:27 +08:00
Daniel Nephin 294453433d Remove extra calls to docker server.
Fix broken integration tests

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-08-10 11:24:20 -04:00
Daniel Nephin df7c2cc43f Resolves #369, add verbose output on --verbose flag
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-08-09 21:05:54 -04:00
Tim Freund 69c241ba12 Enable monochrome output in the 'up' and 'logs' commands
Some systems, like Jenkins or other build servers, cannot correctly
render ANSI color codes.  The '--no-color' option enables monochrome
output in the 'up' and 'logs' commands to improve readability in those
systems.

Signed-off-by: Tim Freund <tim@freunds.net>
2014-08-08 16:15:27 -04:00
Aanand Prasad 62a4d214e8 Default link alias which is just the service name
Closes #37.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-08-08 13:05:42 -07:00
Chris Corbyn 0dc55fda45 Merge pull request #322 from dnephin/fix_cli_for_py26
Fix cli for python 2.6
2014-07-27 18:35:40 +10:00
Aanand Prasad 94887a28c7 Make sure we support explicit protocols in port bindings
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-24 11:48:29 -07:00
Aanand Prasad 262efce43e Fix test regression introduced in ed80576236
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-24 11:47:39 -07:00
Mark Steve Samson 7f06d46827 Add test for building with --no-cache
Signed-off-by: Mark Steve Samson <hello@marksteve.com>
2014-07-22 11:40:44 +08:00
Aanand Prasad 140ced6a3b Fix and document `dns:` option
Closes #240.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-17 18:11:50 -07:00
Daniel Nephin 779f4bda01 Fix cli for python 2.6
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2014-07-15 13:07:46 -07:00
Aanand Prasad 91fe414522 Fix regression of default behaviour in Command.project_name
Needed an `os.abspath` in there. Added more tests, too.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-14 11:32:10 -07:00
Ben Firshman 7fb43cc85f Merge pull request #283 from d11wtq/feature/optional-command
Make fig run COMMAND parameter optional.
2014-07-14 18:33:18 +01:00
Ryan Brainard e9c2f2c5fb Default project_name to dirname of fig.yml
Signed-off-by: Ryan Brainard <brainard@heroku.com>
2014-07-12 23:38:20 -07:00
Chris Corbyn ef2fb77c1d Make fig run COMMAND parameter optional.
This behaves more like the native docker client, where the absence of a
command means docker runs the CMD in the Dockerfile. If a command is
defined in fig.yml this is used instead.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-07-12 02:30:34 +00:00
Aanand Prasad 89341013a0 Fix volumes_from container
Closes #311.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-11 16:39:23 -07:00
Ben Firshman b573b87a92 Fix race condition in recreate containers
Container might have stopped between checking `is_running` and
calling `stop()`, which then threw an exception.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-07-11 14:53:46 -07:00
Ryan Brainard 44a91e6ba8 Resolve environment without values to values on host
For parity with the Docker CLI, allow environment variables without
values to be automatically resolved to their values on the host.

Signed-off-by: Ryan Brainard <brainard@heroku.com>

Conflicts:
	tests/integration/service_test.py
2014-07-11 10:18:05 -07:00
Sam Hanes 699bbe9ca2 Split the domainname out of qualified hostnames.
Docker doesn't like it when a fully qualified hostname is passed in
the `hostname` parameter. When an FQDN is provided with `-h` the
official CLI puts the first component in `hostname` and the rest in
`domainname`. This change replicates that behavior when the user
specifies an FQDN in `hostname` in their `fig.yml`.

Signed-off-by: Sam Hanes <sam@maltera.com>
2014-07-10 20:18:09 -07:00
Alexey Lebedeff d83bdd5164 Change working dir through fig.yml
Closes #144

Signed-off-by: Alexey Lebedeff <binarin@gmail.com>
2014-07-10 21:22:45 +04:00
Aanand Prasad 944e15fa65 Stop `fig run` starting everything when a service has no links
This was thanks to the semantics of project.up(), which starts everything
if you pass it an empty list of service names. (That logic should
probably be moved out to main.py.)

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2014-07-02 11:51:12 +01:00
Aanand Prasad d04b1724ec Merge pull request #236 from rail44/feature-support-volumes-from
Support volumes_from option
2014-07-02 10:48:11 +01:00
Satoshi Amemiya e5916b2fae Support volumes_from option
Signed-off-by: Satoshi Amemiya <rail.sky@gmail.com>
2014-07-02 13:27:54 +09:00
Mark Steve Samson 4f7cbc3812 Support for host address in port bindings (Closes #267) 2014-06-27 15:07:22 +01:00
Aanand Prasad 3c48884dbb Update dockerpty; stub it out in tests
Its current behaviour occasionally causes tests to hang; until this is
resolved, we'll stub it out. We weren't testing the output of 'run'
anyhow (though we should be).
2014-06-27 14:41:36 +01:00
Aanand Prasad 256dccc554 Merge pull request #268 from orchardup/update-docker-py-0.3.2
Update to docker-py 0.3.2
2014-06-25 14:16:48 +01:00
Ben Firshman d0f65906ed Update to docker-py 0.3.2
From 59ced5700c

Now only supports Docker 1.0.0 / remote API v1.12.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2014-06-25 11:56:20 +01:00
Ben Firshman 95aa61cfe5 Merge pull request #246 from d11wtq/feature/auto_start
Feature: `fig up` and `fig run` now start linked containers (closes #31).
2014-06-24 14:46:47 +01:00
Chris Corbyn 247691ca44 Remove auto_start option from fig.yml.
This option is redundant now that services can be started along with links.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-21 10:39:36 +00:00
Chris Corbyn 0fc9cc65d1 Rename '--only' => '--no-deps'
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-21 10:30:36 +00:00
j0hnsmith 6b8044e92c add net param support
Signed-off-by: Peter Flood <info@whywouldwe.com>
2014-06-19 11:57:55 +01:00
Aanand Prasad d0b5bcf26a Pass byte strings straight through LogPrinter 2014-06-18 14:51:13 +01:00
Aanand Prasad 262248d8a6 Firm up tests for split_buffer 2014-06-18 14:51:13 +01:00
Chris Corbyn 1b5bf6e12a Merge remote-tracking branch 'upstream/master' into feature/auto_start
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>

Conflicts:
	tests/fixtures/simple-figfile/fig.yml
	tests/unit/project_test.py
2014-06-12 22:05:51 +00:00
d11wtq 6e485df084 Rename --no-links to --only
Signed-off-by: d11wtq <chris@w3style.co.uk>
2014-06-11 10:50:45 +00:00
d11wtq 3a342fb25d Use busybox in fixtures, instead of ubuntu
Signed-off-by: d11wtq <chris@w3style.co.uk>
2014-06-11 10:25:50 +00:00
Chris Corbyn e71e82f8ac Add missing fixture file
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-11 10:09:54 +00:00
d11wtq 1d1e23611b Rename --keep-old to --no-recreate
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:51 +00:00
d11wtq ab1fbc96c3 Move keep_old check up into Project
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:50 +00:00
d11wtq a04143e2a7 Remove unused: from __future__ import unicode_literals.
This is not being used and it confuses the Command class. Rather
than try to fix the Command class, I've taken the pragmatic
approach and removed the trigger that confuses it.

Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:50 +00:00
d11wtq 6c4299039a Write integration tests for `--keep-old` in the CLI
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 655d347ea2 Write integration tests on new `fig run` linking behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 94a3164248 Re-add missing import for patch
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:49 +00:00
d11wtq 18728a64b9 Write tests for --no-links changes to `fig up`
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq d8b0fa294e Add integration tests for Project.up() w/ start_links and keep_old
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq a6c8319b5d Add integration tests for Service.recreate_containers() with keep_old
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq 5d92f12f8e Add unit tests for include_links in get_services()
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:48 +00:00
d11wtq 13a296049b Update cli integration test for 'auto_start' behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:45 +00:00
d11wtq 22c531dea7 Add unit tests for Project.get_services()
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
d11wtq dfc74e2a77 Write integration test for 'auto_start' behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
d11wtq 0c12db06ec Move 'auto_start' option default to Service and add unit tests
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
2014-06-09 01:31:44 +00:00
Ben Firshman 10725136d8 Add tests for names on containers 2014-04-29 09:20:29 +01:00
Ben Firshman ca7151aeb1 Split tests into unit and integration 2014-04-25 22:58:21 +01:00
Aanand Prasad 6e932794f7 Fix regression when mounting volumes
Caused by
77fec67c60
2014-04-25 12:28:00 +01:00
Aanand Prasad 9e1dfcfb37 Update docker-py APIError imports 2014-04-23 18:20:33 +01:00
Aanand Prasad 80991f1521 Set "VolumesFrom" when starting containers
This is necessary when working with Docker 0.10.0 and up. Fortunately,
we can set it both when creating and starting, and retain compatibility
with 0.8.x and 0.9.x.

recreate_containers() is now responsible for starting containers, as
well as creating them. This greatly simplifies usage of the Service
class.
2014-04-23 15:46:26 +01:00
Ben Firshman 2b245bdf9e Update to docker-py 0.3.1
From 7f55a101f8

This now requires Docker 0.9 or greater.
2014-04-15 10:41:06 +01:00
sebastianneubauer 352ad7a38c Scaling down removes containers
Squashed version of #162.
Closes #121.
2014-03-26 18:28:10 +00:00
Kevin van Zonneveld 0f5a56b3c2 Add support for privileged containers #123
This is required for mounting external volumes and
addresses errors such as `mount.nfs: Operation not permitted`

Be gentle, I don't normally use Python :)
2014-03-13 14:31:05 +01:00
Aanand Prasad 13c7380113 Only `fig run` containers link back to the service they're part of
Fixes #107.
2014-03-06 18:59:24 +00:00
Aanand Prasad 2d98071e55 Support 'expose' config option, like docker's --expose
Exposes ports to linked services without publishing them to the world.
2014-03-04 18:06:52 +00:00
Aanand Prasad 6a3d1d06b5 Check NetworkSettings.Ports instead of HostConfig.PortBindings in tests
The latter appears to be unreliable.
2014-03-04 17:58:42 +00:00
Ben Firshman 044c348faf Add test for fig rm 2014-03-04 11:00:09 +00:00
Ben Firshman 465c7d569c Improve CLI test names 2014-03-04 11:00:09 +00:00
Aanand Prasad a00ec9d1f8 Fix: image-defined entrypoint not overridden by intermediate container
This was causing recreation to hang.
2014-03-03 18:06:06 +00:00
Ben Firshman 3e7360c2c6 Improve error when service is not a dict
Fixes #127
2014-03-03 16:21:42 +00:00
Ben Firshman bf47aa97b4 Fix tests importing six 2014-03-03 12:25:38 +00:00
Aanand Prasad c07e96cf2b Merge pull request #120 from marksteve/link-name
Add custom link names (Closes #72)
2014-03-03 11:22:57 +00:00
Mark Steve Samson 193558a4bc Add link names test 2014-03-03 08:54:47 +08:00
Mark Steve Samson e38e866626 Fix links related test 2014-03-02 00:30:33 +08:00
Aanand Prasad 9d1383ba26 Alternate fig file can be specified with -f 2014-03-01 11:29:23 +00:00
Ben Firshman b9c8e3e057 Fix scale not binding ports 2014-02-17 21:33:05 +00:00
Ben Firshman 5d4210ceb3 Fix tests when there is an image with int tag 2014-02-17 21:32:48 +00:00
Barnaby Gray 6431d52a2e Implement topological sort using Cormen/Tarjan algorithm to handle a->b->c dependencies and detect a->b->c->a cycles. 2014-02-12 09:09:55 +00:00
Aanand Prasad edf8f14ac0 Throw an error if you specify an unrecognised option in `fig.yml`
Closes #27.
2014-02-04 17:46:04 -08:00
Ben Firshman 62607f4f04 Merge pull request #67 from orchardup/link-services-to-themselves
Link services to themselves
2014-01-31 02:46:52 -08:00
Ben Firshman e4e9f0bc19 Link services to themselves
E.g. `fig run db ...` will be able to access the db service.
2014-01-30 13:11:23 +00:00
Cameron Maske ae7573b9b8 Fix for #48.
Rework of how services are sorted based on dependencies using a topological sort.
Includes error handling to detect circular/self imports (should raise a DependecyError).
Added in logging to the CLI to log out any DependencyErrors.
Removed the compact module as it is no longer used.
2014-01-29 18:38:25 +00:00
Aanand Prasad ee880ca7be Fix recreate_containers test 2014-01-29 13:57:28 +00:00
Ben Firshman cbdeff99ee Fix broken test on Python 3 2014-01-28 13:45:47 +00:00
Ben Firshman 8b75f7c7d3 Merge pull request #58 from mrchrisadams/load_yaml_as_well_as_yml
Support loading in Figfiles with .yaml extension
2014-01-28 03:35:25 -08:00
Chris Adams 1d18d747a5 Support loading in Figfiles with .yaml extension
Add basic boilerplate text - feel free to change
2014-01-28 00:43:23 +00:00
Ben Firshman 3e7e6e7656 Add link alias without project name
REDIS_1_PORT_6379_TCP_ADDR instead of
FIGTEST_REDIS_1_PORT_6379_TCP_ADDR.

Ref #37
2014-01-27 15:32:16 +00:00
Ben Firshman ddf6819a75 Only pull ubuntu:latest in tests
Might stop Travis running out of disk space.
2014-01-26 20:37:40 +00:00
Ben Firshman ee49e7055b Pull ubuntu image for CLI tests 2014-01-26 20:29:05 +00:00
Ben Firshman ea93c01dfb Remove intermediate containers in recreate test 2014-01-26 19:48:10 +00:00
Ben Firshman cf18a3141f Remove images created by tests 2014-01-26 19:37:35 +00:00
Aanand Prasad e8472be6d5 Fig bug in split_buffer where input was being discarded
Also, write some tests for it.
2014-01-22 17:44:04 +00:00
Aanand Prasad df9f66d437 Allow ports to be specified in '1234/tcp' format 2014-01-22 17:01:10 +00:00
Aanand Prasad ae67d55bf2 Fix bug where too many '/tcp' suffixes were added to port config 2014-01-22 16:52:42 +00:00
Ben Firshman 7abc4fbf3a Improve ps CLI test 2014-01-20 16:50:41 +00:00
Ben Firshman 855a9c623c Remove containers after running CLI tests 2014-01-20 16:47:58 +00:00
Cameron Maske 62bba1684b Updated recreate_containers to attempt to base intermediate container's the previous container's image.
Added in additional functionality to reset any entrypoints for the intermediate container and pull/retry handling if the image does not exist.
Updated test coverage to check if an container is recreated with an entrypoint it is handled correctly.
2014-01-19 18:40:21 +00:00
Ben Firshman 56c6efdfce Add scale command
Closes #9
2014-01-16 18:09:46 +00:00
Ben Firshman 8ed86ed551 Add number to container 2014-01-16 18:05:59 +00:00
Aanand Prasad 21528f08d4 Vendor docker-py
From 9dc03c5737
2014-01-16 13:30:01 +00:00
Aanand Prasad ee0c4bf690 Fix test regression 2014-01-16 12:32:16 +00:00
Aanand Prasad ea4753c49a Use an anonymous intermediate container so that when recreating containers, suffixes always start from 1 2014-01-16 12:32:15 +00:00
Aanand Prasad f5f9357736 Remove project.create_containers(), revamp project.recreate_containers()
`recreate_containers` now returns two lists of old+new containers, along
with their services.
2014-01-16 12:32:15 +00:00
Aanand Prasad bdc6b47e1f service.recreate_containers() no longer removes the old containers
We need to keep them around until the new ones have been started.
2014-01-16 12:32:15 +00:00
Aanand Prasad 3669236aa1 Support volumes in config with an unspecified host path 2014-01-16 12:32:15 +00:00
Aanand Prasad 207e83ac2f Be sure to test that recreate_containers updates config 2014-01-16 12:32:15 +00:00
Ben Firshman 3c5e334d9d Add recreate_containers method to service 2014-01-16 12:32:15 +00:00
Ben Firshman 7a1fb3a8d2 Fix ordering of port mapping 2014-01-16 01:54:05 +00:00
Aanand Prasad 8cab05feb4 Failing (on 2.7, at least) smoke test for 'fig ps'
See #8.
2014-01-09 15:32:50 +00:00
Aanand Prasad 892677a9d3 Very basic CLI smoke test
See #8.
2014-01-09 15:32:24 +00:00
Christopher Grebs 93b9b6fd9f First version with python3 support.
* Moved requirements*.txt files to proper spec definitions in setup.py
 * Added a new fig.compat module to store some compatibility code
2014-01-06 17:58:49 +00:00
Ben Firshman f96a1a0b35 Fix Python 2.6 2014-01-06 17:58:49 +00:00
Ben Firshman ff9fa5661d Fix Python 2.6 2014-01-06 11:22:46 +00:00
Ben Firshman 853d8ad280 Namespace tests inside a project
So it doesn't delete all your containers for every test. Cool.
2014-01-02 15:27:51 +00:00
Aanand Prasad d4f3ed1840 Fix 'fig up' behaviour
- For each service, creates a container if there are none (stopped OR
  started)
- Attaches to all containers (unless -d is passed)
- Starts all containers
- On ^C, kills all containers (unless -d is passed)
2013-12-31 13:02:08 +00:00
Aanand Prasad 9ed6538693 Extract docker URL logic, use it in tests as well 2013-12-31 12:37:17 +00:00
Aanand Prasad 0cafdc9c6c plum -> fig 2013-12-20 20:28:24 +00:00
Aanand Prasad 13a30c327a Container.name strips the leading slash 2013-12-20 19:33:41 +00:00
Aanand Prasad 8291d36eaf Fix stray test regression 2013-12-20 19:30:31 +00:00
Aanand Prasad d3346fa174 up, start, stop, kill and rm all accept a list of services 2013-12-20 18:32:55 +00:00
Aanand Prasad 81093627fe Implement kill and rm 2013-12-20 18:30:59 +00:00
Aanand Prasad a4710fa9e1 'plum up' is now the special magic
'start' and 'stop' are now analogous to their Docker namesakes.
2013-12-20 18:30:59 +00:00
Ben Firshman 507940535f Tag built images and use them when starting
A basic measure to get round the fact that adding isn't cached. Once
Docker supports cached adds, this is probably redundant.
2013-12-20 16:23:40 +00:00
Ben Firshman 326438b170 Pick correct numbers for one off containers 2013-12-20 12:55:45 +00:00
Ben Firshman 2f28265d10 Add support for differentiating one-off containers
This is a basic start, the API is pretty shonky.
2013-12-20 10:46:55 +00:00
Ben Firshman 2d2d81d33f Rename "service collection" to "project" 2013-12-19 16:55:12 +00:00
Ben Firshman c488710625 Add project option to services 2013-12-19 15:16:17 +00:00
Ben Firshman 6c551a200b Do not allow underscores in names 2013-12-19 14:47:43 +00:00
Ben Firshman a5fc880d10 Refactor service to add a container object 2013-12-18 18:37:48 +00:00
Ben Firshman 5e1e4a71e0 Rename ServiceTest 2013-12-18 17:01:50 +00:00
Ben Firshman 87c46e281c Add support for specifying external port 2013-12-18 11:14:34 +00:00
Ben Firshman 772585109d Moved tests to root directory 2013-12-14 16:34:24 +00:00