Updating docker-compose.yml via API

Hi,

I’m trying to use the API to integrate into by CI process to update the docker-compose (and possibly rancher-compose) files as part of the deployment.

As a test, I’m taking a simple test stack, and trying to add new environment variables, and update an existing one.

The initial docker-compose.yml is

version: '2'
services:
  Alpine:
    image: alpine
    environment:
      SHOW: 'false'
    stdin_open: true
    tty: true
    labels:
      io.rancher.container.pull_image: always

I’m submitting this via the API:

version: '2'
services:
  Alpine:
    image: alpine
    stdin_open: true
    tty: true
    labels:
    - io.rancher.container.pull_image: always
    environment:
    - RACK_ENV=development
    - SHOW=true
    - SESSION_SECRET=123 

And I seem to get a valid response: a dump of the stack resource.

However, the environment variables aren’t being updated.

Any thoughts on what I’m doing wrong?

Regards,
Andy

You need to call the upgrade action, there are fields for the compose files but updating then does not trigger anything to happen

Hi Vincent,
Thanks for getting back to me.

I think I already am calling upgrade:

http://<rancher_URL>/v2-beta/stacks/?action=upgrade

Is that what you meant?

Regards
Andy