Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced config file #1233

Closed
wants to merge 2 commits into from
Closed

Advanced config file #1233

wants to merge 2 commits into from

Conversation

jderusse
Copy link

This PR improve the config schema by moving the services under a new top level node services.

version: 1.0
services:
  db:
    image: postgres
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    links:
      - db

Why ?

  • Thank to the version property, the schema is extendable and we can keep Backward Compatibility
  • We can add global parameters (like name, gobal env, global extends, ...)
  • We can manage several versions of the schema (ie if a parameter is renamed in a future version).

What the difference with #463 ?

This PR does not mix service declaration and project configuration:

  • More readable
  • No collision between service's name and project key

I implement an usage of this new schema with an optional property project which replace the directory_name

version: 1.1
project: foo
services:
  db:
    image: postgres
  web:
    build: .

This should fix tickets #45, #745
Then we could extends this schema to fix #210, #318

note: The script does not break backward compatibility 😃 even if someone already use a service named project or .project or version or wathever

@csarrazi
Copy link

Bump

@yosifkit
Copy link

yosifkit commented Jul 7, 2015

Ping @aanand, @bfirsh, @dnephin, @mnowster: any word on whether this is acceptable? Or reasons as to why not (besides the needed DCO sign-off)?

Having a project name in the yml (which is only part of this PR) would go a long way to help swarm integration since name conflicts occur often in multi-team environments.

@aanand
Copy link

aanand commented Jul 8, 2015

@yosifkit The discussion over whether or not the project name belongs in the config file is #745. Until that's resolved, no PR which implements such a change is going to be acceptable.

@docteurklein
Copy link

I'd like to see a "services" entrypoint as well.
Not talking about the project name.
Nor the version constraint.
@aanand I think the project name being included or not is just a possibility.
I would simplify this PR to just allow a "services" key.

Once you moved the services from global, you're free too add more keys at the root of the file,
and avoid clashes with future potential keys (like metadata, project name, version, …).

It'd be cool to let the format open for extension.

For example, I'd like to add a "commands" key at the root of the file to enable a third party tool to read its config inside the compose yml file.

@michaeljs1990
Copy link

Anyway this can be modified to support a / separator instead of _ optionally with a flag something like...

version: 1.1
project: foo
services:
  delimiter: /
  db:
    image: postgres
  web:
    build: .

would build foo/db and foo/web. If it could be made to do that this would be a super helpful pr that would fix many issues that I have to write custom scripts for right now.

@dnephin
Copy link

dnephin commented Oct 6, 2015

Thanks for the contribution! Sorry it's taken a while to respond.

Our focus so far on the config has been to improve the validation and error messages. In the upcoming 1.5.0 release we've got a new jsonschema for handling the validation and much improved error messages.

I think we'd like to add a version to the schema, which may happen as part of #2113. If we're going to break backwards compatibility (or even just introduce a new format), we'd like to make a bunch of changes all at once (not just adding a version in isolation).

Sorry we weren't ready to make this breaking change when this PR was first submitted. Our configuration code has changed significantly since then, so I don't think we'll be able to merge this PR.

@dnephin dnephin closed this Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global env variables
7 participants