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

ability to update multiple services #11

Closed
zacksiri opened this Issue Apr 4, 2016 · 8 comments

Comments

Projects
None yet
4 participants
@zacksiri

zacksiri commented Apr 4, 2016

Sometimes you have multiple services running from 1 docker image, and woudl be nice to be able to update multiple services

@bradrydzewski

This comment has been minimized.

Show comment
Hide comment
@bradrydzewski

bradrydzewski May 9, 2016

Contributor

In the short term you can add multiple rancher blocks to the yaml like this:

deploy:
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest

If you are interested in the ability to update multiple services in a single block feel free to send a pull request with the functionality. I'm the core drone maintainer and I've never used Rancher -- so we rely on pull requests from the community for these sort of improvements. Cheers!

Contributor

bradrydzewski commented May 9, 2016

In the short term you can add multiple rancher blocks to the yaml like this:

deploy:
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest

If you are interested in the ability to update multiple services in a single block feel free to send a pull request with the functionality. I'm the core drone maintainer and I've never used Rancher -- so we rely on pull requests from the community for these sort of improvements. Cheers!

@josmo

This comment has been minimized.

Show comment
Hide comment
@josmo

josmo Jan 25, 2017

Owner

@zacksiri I'm looking over the open issues with the plugin and wondered if with the option @bradrydzewski mentioned, does it still makes sense to add multiple service upgrades due to the complexity it adds. ie. batch size, auto-upgrades, etc are often times different per services even if based on the same image. I can add the above to the docs and that should hit all use cases unless I'm missing something :)

Owner

josmo commented Jan 25, 2017

@zacksiri I'm looking over the open issues with the plugin and wondered if with the option @bradrydzewski mentioned, does it still makes sense to add multiple service upgrades due to the complexity it adds. ie. batch size, auto-upgrades, etc are often times different per services even if based on the same image. I can add the above to the docs and that should hit all use cases unless I'm missing something :)

@shnhrrsn

This comment has been minimized.

Show comment
Hide comment
@shnhrrsn

shnhrrsn Jan 10, 2018

@josmo This would be helpful in terms of keep everything DRY.

Take for instance the following config:

pipeline:

  # ...

  deploy_api:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_scheduler:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-scheduler
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_high:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-high
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_low:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-low
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

It's super repetitive and if you want to change one of the more 'global' values, you need to change it in multiple spots, which can of course be fairly error prone. Refactoring the above to a single step with multiple services would be great:

pipeline:

  # ...

  deploy:
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    secrets: [ rancher_access_key, rancher_secret_key ]
    services:
      - service: stack/service
        start_first: true
        confirm: true
        timeout: 300
        batch_size: 1
      - service: stack/service-scheduler
        start_first: false
        confirm: true
      - service: stack/stack/service-queue
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-high
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-low
        start_first: false
        confirm: true
        batch_size: 5
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

shnhrrsn commented Jan 10, 2018

@josmo This would be helpful in terms of keep everything DRY.

Take for instance the following config:

pipeline:

  # ...

  deploy_api:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_scheduler:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-scheduler
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_high:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-high
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_low:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-low
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

It's super repetitive and if you want to change one of the more 'global' values, you need to change it in multiple spots, which can of course be fairly error prone. Refactoring the above to a single step with multiple services would be great:

pipeline:

  # ...

  deploy:
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    secrets: [ rancher_access_key, rancher_secret_key ]
    services:
      - service: stack/service
        start_first: true
        confirm: true
        timeout: 300
        batch_size: 1
      - service: stack/service-scheduler
        start_first: false
        confirm: true
      - service: stack/stack/service-queue
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-high
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-low
        start_first: false
        confirm: true
        batch_size: 5
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]
@bradrydzewski

This comment has been minimized.

Show comment
Hide comment
@bradrydzewski

bradrydzewski Jan 10, 2018

Contributor

@shnhrrsn have you considered using YAML anchors to reduce boilerplate? I believe this can be handled at the YAML level without having to change the plugin itself.

deploy: &deploy
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

pipeline:
  deploy_api:
    <<: *deploy
    service: stack/service


  deploy_scheduler:
    <<: *deploy
    service: stack/service-scheduler
Contributor

bradrydzewski commented Jan 10, 2018

@shnhrrsn have you considered using YAML anchors to reduce boilerplate? I believe this can be handled at the YAML level without having to change the plugin itself.

deploy: &deploy
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

pipeline:
  deploy_api:
    <<: *deploy
    service: stack/service


  deploy_scheduler:
    <<: *deploy
    service: stack/service-scheduler
@shnhrrsn

This comment has been minimized.

Show comment
Hide comment
@shnhrrsn

shnhrrsn Jan 10, 2018

I'll give that a try, thanks for the quick reply!

walks away in shame

shnhrrsn commented Jan 10, 2018

I'll give that a try, thanks for the quick reply!

walks away in shame

@josmo

This comment has been minimized.

Show comment
Hide comment
@josmo

josmo Jan 15, 2018

Owner

@shnhrrsn I just wanted to check if what Brad mentioned would work :) If it does I'm going to close this out.

Owner

josmo commented Jan 15, 2018

@shnhrrsn I just wanted to check if what Brad mentioned would work :) If it does I'm going to close this out.

@shnhrrsn

This comment has been minimized.

Show comment
Hide comment
@shnhrrsn

shnhrrsn Jan 15, 2018

Yep, worked perfect!

shnhrrsn commented Jan 15, 2018

Yep, worked perfect!

@josmo

This comment has been minimized.

Show comment
Hide comment
@josmo

josmo Jan 15, 2018

Owner

Glad to hear!

Owner

josmo commented Jan 15, 2018

Glad to hear!

@josmo josmo closed this Jan 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment