cml.dev icon indicating copy to clipboard operation
cml.dev copied to clipboard

Special parameters for the git lab runner and docker container that it run

Open dmytro-spodarets opened this issue 5 years ago โ€ข 8 comments

In some cases, I need to configure special parameters for the git lab runner that is created by the CML runner. I also need to be able to set special options for running the container. For example:

  • git lab runner must have the parameter: privileged = true or
  • docker container must be started with the option: --log-driver=fluentd --log-opt fluentd-address=XX.XX.XX.XX:24224

dmytro-spodarets avatar Oct 18 '21 13:10 dmytro-spodarets

You can probably use the DOCKER_PRIVILEGED environment variable in the first case. Log driver options don't seem to be supported by GitLab runners configuration, though.

0x2b3bfa0 avatar Oct 20 '21 15:10 0x2b3bfa0

I wonder if we should close this issue with a cml.dev/doc pull request. ๐Ÿค” Allowing arbitrary config.toml values doesn't seem to provide any particular benefit when compared to the (already working) environment variable propagation.

0x2b3bfa0 avatar Oct 20 '21 15:10 0x2b3bfa0

Does using environment variables also work for runners on cloud machines? I have been trying to set the shared memory through DOCKER_SHM_SIZE by passing script=$(echo 'DOCKER_SHM_SIZE=4g' | base64) to --cloud-startup-script but with no success so far.

MaxHuerlimann avatar Jan 17 '22 22:01 MaxHuerlimann

Something like cml runner ยทยทยท --cloud-startup-script="$(echo "export DOCKER_SHM_SIZE=4g" | base64 --wrap=0)" should work as expected after releasing https://github.com/iterative/terraform-provider-iterative/pull/370.

0x2b3bfa0 avatar Jan 17 '22 23:01 0x2b3bfa0

That's amazing! my training will finally be blazing fast again :) You're the best

MaxHuerlimann avatar Jan 17 '22 23:01 MaxHuerlimann

๐Ÿ”” @MaxHuerlimann & @dmitry-spodarets, https://github.com/iterative/terraform-provider-iterative/pull/370 has been released. Can you confirm that it works as expected?

0x2b3bfa0 avatar Jan 27 '22 04:01 0x2b3bfa0

When I add --cloud-startup-script="$(echo "export DOCKER_SHM_SIZE=4g" | base64 --wrap=0)" such that the comment is

- cml-runner
      --cloud=azure
      --cloud-region=eu-west
      --cloud-type=m
      --labels=cml-runner
      --cloud-startup-script=$(echo "export DOCKER_SHM_SIZE=4g" | base64 --wrap=0)

the deployment fails. The error message contains

Error: Error checking the runner status\nโ”‚ \nโ”‚   with iterative_cml_runner.runner,\nโ”‚   on main.tf line 14, in resource \"iterative_cml_runner\" \"runner\":\nโ”‚   14: resource \"iterative_cml_runner\" \"runner\" {\nโ”‚ \nโ”‚ -- Logs begin at Thu 2022-01-27 12:44:00 UTC, end at Thu 2022-01-27\nโ”‚ 12:49:37 UTC. --\nโ”‚ Jan 27 12:49:22 iterative systemd[1]: Started cml.service.\nโ”‚ Jan 27 12:49:28 iterative cml.sh[17542]:\nโ”‚ {\"level\":\"info\",\"message\":\"Preparing workdir\nโ”‚ /tmp/tmp.xgJw8Xty7f/.cml/cml-jdr96m7kf4...\"}\nโ”‚ Jan 27 12:49:28 iterative cml.sh[17542]:\nโ”‚ {\"level\":\"info\",\"message\":\"Launching gitlab runner\"}\nโ”‚ Jan 27 12:49:32 iterative cml.sh[17542]:\nโ”‚ {\"level\":\"warn\",\"message\":\"SpotNotifier can not be started.\"}

If I remove the script line the deployment succeeds.

MaxHuerlimann avatar Jan 27 '22 13:01 MaxHuerlimann

@MaxHuerlimann, can you please try it again?

0x2b3bfa0 avatar Oct 04 '22 15:10 0x2b3bfa0