A Racetrack plugin allowing to deploy services to remote Docker Daemon
-
Install racetrack client and generate ZIP plugin by running:
make bundle
Afterward, activate the plugin in Racetrack Dashboard Admin page by uploading the zipped plugin file:
racetrack plugin install remote-docker-*.zip
Alternatively, you can install the latest plugin by running:
racetrack plugin install github.com/TheRacetrack/plugin-remote-docker
-
Download docker client and keep it in the working directory:
mkdir -p ~/racetrack cd ~/racetrack curl https://download.docker.com/linux/static/stable/x86_64/docker-24.0.5.tgz --output docker.tgz tar -zxvf docker.tgz -C . --transform 's/^docker//' docker/docker rm docker.tgz
This binary will be mounted to the remote Pub container.
-
Install Racetrack's Pub gateway on a remote host, which will dispatch the traffic to the local jobs. Generate a strong password that will be used as a token to authorize only the requests coming from the master Racetrack:
REMOTE_GATEWAY_TOKEN='5tr0nG_PA55VoRD' IMAGE=ghcr.io/theracetrack/racetrack/pub:latest DOCKER_GID=$((getent group docker || echo 'docker:x:0') | cut -d: -f3) mkdir -p .docker chmod 777 .docker docker network create racetrack_default || true docker pull $IMAGE docker rm -f pub-remote || true docker run -d \ --name=pub-remote \ --user=100000:$DOCKER_GID \ --env=AUTH_REQUIRED=true \ --env=AUTH_DEBUG=true \ --env=PUB_PORT=7105 \ --env=REMOTE_GATEWAY_MODE=true \ --env=REMOTE_GATEWAY_TOKEN="$REMOTE_GATEWAY_TOKEN" \ -p 7105:7105 \ --volume "/var/run/docker.sock:/var/run/docker.sock" \ --volume "`pwd`/docker:/opt/docker" \ --volume "`pwd`/.docker:/.docker" \ --restart=unless-stopped \ --network="racetrack_default" \ --add-host host.docker.internal:host-gateway \ $IMAGE
-
Go to Racetrack's Dashboard, Administration, Edit Config of the plugin. Prepare the following data:
- Host IP or DNS hostname
- Credentials to the Docker Registry, where Job images will be located.
Save the YAML configuration of the plugin:
infrastructure_targets: docker-daemon-1: remote_gateway_url: 'http://1.2.3.4:7105/pub' remote_gateway_token: '5tr0nG_PA55VoRD' docker: docker_registry: 'docker.registry.example.com' username: 'DOCKER_USERNAME' password: 'READ_WRITE_TOKEN'