puppetlabs-docker icon indicating copy to clipboard operation
puppetlabs-docker copied to clipboard

Update docker compose

Open davidphay opened this issue 2 years ago • 16 comments

Update docker compose to the latest version (2.16.0) & install it as docker plugin on linux server since compose v1 will be deprecated on June 2023.

reference: https://docs.docker.com/compose/install/linux/

davidphay avatar Feb 24 '23 17:02 davidphay

docker::compose is a class

Breaking changes to this file WILL impact these 3 modules (exact match):

docker::params is a class

that may have no external impact to Forge modules.

This module is declared in 6 of 580 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Looks like this intends to fix #891.

kenyon avatar Feb 24 '23 23:02 kenyon

@davidphay I've noticed a small issue while testing this PR:

$ file /usr/local/bin/docker-compose-2.16.0
/usr/local/bin/docker-compose-2.16.0: ASCII text, with no line terminators

$ cat /usr/local/bin/docker-compose-2.16.0
Not Found

It seems like the version 1.x download URL does not work for version 2.x:

$ curl -v https://github.com/docker/compose/releases/download/2.16.0/docker-compose-Linux-x86_64 
...
< HTTP/2 404 
< server: GitHub.com

On Docker Compose version 2.x the version number must be prefixed with a v in the download URL:

$ curl -v https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-Linux-x86_64
...
< HTTP/2 302 
< server: GitHub.com

fraenki avatar Mar 06 '23 21:03 fraenki

@davidphay I've noticed a small issue while testing this PR:

$ file /usr/local/bin/docker-compose-2.16.0
/usr/local/bin/docker-compose-2.16.0: ASCII text, with no line terminators

$ cat /usr/local/bin/docker-compose-2.16.0
Not Found

It seems like the version 1.x download URL does not work for version 2.x:

$ curl -v https://github.com/docker/compose/releases/download/2.16.0/docker-compose-Linux-x86_64 
...
< HTTP/2 404 
< server: GitHub.com

On Docker Compose version 2.x the version number must be prefixed with a v in the download URL:

$ curl -v https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-Linux-x86_64
...
< HTTP/2 302 
< server: GitHub.com

Thanks, I fixed the issue !

davidphay avatar Mar 07 '23 11:03 davidphay

Wouldn’t it be a preferred way to install docker compose v2 via “docker-compose-plugin” package as described here https://docs.docker.com/compose/install/linux/#install-using-the-repository ? Also setting the version via params leads to technical debt in my mind - do you agree ?

vegaaz avatar Mar 18 '23 19:03 vegaaz

Wouldn’t it be a preferred way to install docker compose v2 via “docker-compose-plugin” package as described here https://docs.docker.com/compose/install/linux/#install-using-the-repository ? Also setting the version via params leads to technical debt in my mind - do you agree ?

I agree on both.

kenyon avatar Mar 19 '23 04:03 kenyon

Wouldn’t it be a preferred way to install docker compose v2 via “docker-compose-plugin” package as described here https://docs.docker.com/compose/install/linux/#install-using-the-repository ? Also setting the version via params leads to technical debt in my mind - do you agree ?

I started working on this issue too, but I am currently busy… Maybe this can help you ?

if $ensure == 'present' {
    if $facts['os']['family'] == 'windows' {
      # will be defined soon
      # https://docs.docker.com/compose/install/other/
    }
    else {
      case $facts['os']['family'] {
        'Debian': {
          ensure_packages('docker-compose-plugin', { ensure => pick($version,$ensure), require => defined('$docker::use_upstream_package_source') ? { true => Apt::Source['docker'], false => undef } }) #lint:ignore:140chars
        }
        'RedHat': {
          ensure_packages('docker-compose-plugin', { ensure => pick($version,$ensure), require => defined('$docker::use_upstream_package_source') ? { true => Yumrepo['docker'], false => undef } }) #lint:ignore:140chars lint:ignore:unquoted_string_in_selector
        }
        default: {}
      }
    }
  }

vegaaz avatar Mar 19 '23 08:03 vegaaz

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 19 '23 21:04 CLAassistant

@kenyon Hello, I updated the code, is it good for you now ?

davidphay avatar Aug 23 '23 11:08 davidphay

@kenyon linting issue should be fixed

davidphay avatar Aug 25 '23 07:08 davidphay

We need someone from @puppetlabs to approve the GitHub Actions jobs.

kenyon avatar Aug 25 '23 17:08 kenyon

@davidphay The reviewer added some notes, would you mind to fix these two things? Would love to finally see this PR getting merged. :blush:

fraenki avatar Oct 16 '23 14:10 fraenki

@davidphay Thank you for the work you've done on this PR, it has saved me some work. I'd love to get it merged as well and I am available to assist if you don't mind.

ttousai avatar Oct 19 '23 09:10 ttousai

its become more critical that this gets merged since docker-compose v1 has become unreliable.

robertc99 avatar Apr 01 '24 03:04 robertc99

Testing this code. Appears to work ok. Does generate the following warning Warning: This function is deprecated, please use stdlib::ensure_packages instead. at ["/etc/puppetlabs/code/environments/stagingcloudv3/r10k/modules/docker/manifests/compose.pp", 26]

robertc99 avatar Apr 01 '24 03:04 robertc99

This should be closed now that #975 was merged.

kenyon avatar Jul 04 '24 20:07 kenyon