gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/docs/executors/docker_machine.md (about)

     1  # Install and register GitLab Runner for autoscaling with Docker Machine
     2  
     3  > The auto scale feature was introduced in GitLab Runner 1.1.0.
     4  
     5  For an overview of the autoscale architecture, take a look at the
     6  [comprehensive documentation on autoscaling](../configuration/autoscale.md).
     7  
     8  ## Preparing the environment
     9  
    10  In order to use the autoscale feature, Docker and GitLab Runner must be
    11  installed in the same machine:
    12  
    13  1. Log in to a new Linux-based machine that will serve as a bastion server
    14     where Docker will spawn new machines from
    15  1. [Install GitLab Runner](../install/index.md)
    16  1. [Install Docker Machine](https://docs.docker.com/machine/install-machine/)
    17  1. Optionally but recommended, prepare a
    18     [proxy container registry and a cache server](../install/registry_and_cache_servers.md)
    19     to be used with the autoscaled Runners
    20  
    21  If you need to use any virtualization/cloud providers that aren't handled by
    22  Docker's Machine internal drivers, the appropriate driver plugin must be
    23  installed. The Docker Machine driver plugin installation and configuration is
    24  out of the scope of this documentation. For more details please read the
    25  [Docker Machine documentation](https://docs.docker.com/machine/)
    26  
    27  ## Configuring GitLab Runner
    28  
    29  1. [Register a GitLab Runner](../register/index.md#gnulinux) and select the
    30     `docker+machine` executor when asked.
    31  1. Edit [`config.toml`](../commands/README.md#configuration-file) and configure
    32     the Runner to use Docker machine. Visit the dedicated page covering detailed
    33     information about [GitLab Runner Autoscaling](../configuration/autoscale.md).
    34  1. The **first time** you're using Docker Machine, it's best to execute manually
    35     `docker-machine create ...` with your chosen driver and all options from the
    36     `MachineOptions` section. This will set up the Docker Machine environment
    37     properly and will also be a good validation of the specified options.
    38     After this, you can destroy the machine with `docker-machine rm [machine_name]`
    39     and start the Runner.
    40  
    41      NOTE: **Note:**
    42      Multiple concurrent requests to `docker-machine create` that are done
    43      **at first usage** are not good. When the `docker+machine` executor is used,
    44      the Runner may spin up few concurrent `docker-machine create` commands. If
    45      Docker Machine was not used before in this environment, each started process
    46      tries to prepare SSH keys and SSL certificates (for Docker API authentication
    47      between Runner and Docker Engine on the autoscaled spawned machine), and these
    48      concurrent processes are disturbing each other. This can end with a non-working
    49      environment. That's why it's important to create a test machine manually the
    50      very first time you set up the Runner with Docker Machine.
    51  
    52  1. Now, you can try and start a new pipeline in your project. In a few seconds,
    53     if you run `docker-machine ls` you should see a new machine being created.
    54  
    55  ## Upgrading the Runner
    56  
    57  1. Check if your operating system is configured to automatically restart the
    58     Runner (for example, by checking its service file):
    59      - **if yes**, ensure that service manager is [configured to use `SIGQUIT`](../configuration/init.md)
    60        and use the service's tools to stop the process:
    61          ```
    62          # For systemd
    63          sudo systemctl stop gitlab-runner
    64  
    65          # For upstart
    66          sudo service gitlab-runner stop
    67          ```
    68      - **if no**, you may stop the Runner's process manually:
    69  
    70          ```bash
    71          sudo killall -SIGQUIT gitlab-runner
    72          ```
    73  
    74      NOTE: **Note:**
    75      Sending the [`SIGQUIT` signal](../commands/README.md#signals) will make the
    76      Runner to stop gracefully. It will stop accepting new jobs, and will exit
    77      as soon as the current jobs are finished.
    78  
    79  1. Wait until the Runner exits. You can check its status with `gitlab-runner status`
    80      or await a graceful shutdown for up to 30 minutes with:
    81  
    82      ```bash
    83      for i in `seq 1 180`; do # 1800 seconds = 30 minutes
    84          gitlab-runner status || break
    85          sleep 10
    86      done
    87      ```
    88  
    89  1. You can now safely install the new Runner without interrupting any jobs