qfieldcloud icon indicating copy to clipboard operation
qfieldcloud copied to clipboard

Multiline command for mirror_transformation_grids service in docker-compose.yml

Open qwenger opened this issue 7 months ago • 0 comments

Up'ing the mirror_transformation_grids service, one gets

[...]
mirror_transformation_grids-1  |    250K .......... .......... .......... .......... .....     100%  163M=0.005s
mirror_transformation_grids-1  |
mirror_transformation_grids-1  | 2025-03-28 12:49:44 (54.1 MB/s) - '/transformation_grids/za_cdngi_sageoid2010.tif' saved [302096/302096]
mirror_transformation_grids-1  |
mirror_transformation_grids-1  | --2025-03-28 12:49:44--  http://chmod/
mirror_transformation_grids-1  | Resolving chmod (chmod)... failed: Try again.
mirror_transformation_grids-1  | wget: unable to resolve host address 'chmod'
mirror_transformation_grids-1  | --2025-03-28 12:49:49--  http://a+r/
mirror_transformation_grids-1  | Resolving a+r (a+r)... failed: Try again.
mirror_transformation_grids-1  | wget: unable to resolve host address 'a+r'
mirror_transformation_grids-1  | /transformation_grids/*: Scheme missing.
mirror_transformation_grids-1  | FINISHED --2025-03-28 12:49:54--
mirror_transformation_grids-1  | Total wall clock time: 3m 54s
mirror_transformation_grids-1  | Downloaded: 447 files, 757M in 22s (34.2 MB/s)

This was also reported in #803 though it wasn't necessarily the core issue and doesn't seem to have been analysed further.

The error clearly comes from the docker-compose.yml syntax: multiple command lines appear to be squashed together despite the | literal style (wget tries to download "chmod"):

[...]
  mirror_transformation_grids:
    image: k3rnelpan1c/alpine-wget:latest
    command: |
      wget --mirror https://cdn.proj.org/ -P /transformation_grids --no-host-directories
      chmod a+r /transformation_grids/*
[...]

I see two ways to fix it:

  1. sh-merge the commands with && (or || if we want to allow wget to fail):
[...]
  mirror_transformation_grids:
    image: k3rnelpan1c/alpine-wget:latest
    command: |
      wget --mirror https://cdn.proj.org/ -P /transformation_grids --no-host-directories
      && chmod a+r /transformation_grids/*
[...]
  1. use list syntax with a sub-shell, as the newlines seem to be kept in that case
[...]
  mirror_transformation_grids:
    image: k3rnelpan1c/alpine-wget:latest
    command:
      - /bin/bash
      - -c
      - |
        wget --mirror https://cdn.proj.org/ -P /transformation_grids --no-host-directories
        chmod a+r /transformation_grids/*
[...]

qwenger avatar Mar 28 '25 13:03 qwenger