-
-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Milestone
Description
We want spotlight run to support docker-compose out of the box. This means the following:
- When no specific command is passed, we should check if:
- There's at least one of the following files in the directory we are in:
docker-compose.yaml,docker-compose.yml,compose.yml,compose.yaml-- note which file exists, we'll use it later - If we have a
docker-composeordockercommand executable in thePATH - If we can successfully run
docker-compose versionordocker compose versionrespectively - The version should be above (figure this out) -- we also know we need at least Docker version 20.04
- There's at least one of the following files in the directory we are in:
- If we pass step 1 above, we then should:
- Set the run command to
docker compose upordocker-compose upaccordingly. Preference should be fordocker-compose. Follow the logic in https://github.com/getsentry/self-hosted/blob/6ae40d837a78c2968a28acf952b1beb9911237f8/install/dc-detect-version.sh#L33 - Extend the command in step 2.1 above with
-f <filename_from_step_1.1> - Based on the file name in step 1.1 above, check if a file with the suffix
.override.ymlor.override.yamlbased on the original filename. If it does, note the file name. - If a matching file is found on step 2.3 above, extend the command from 2.2 with
-f <filename_from_step_2.3> - Parse the file from 1.1 (you'll need a YAML parser), get all the key names under
servicesand note this down - Generate a yaml file in memory, using all the keys from step 2.5 above with the following format:
services: <key1>: environment: - SENTRY_SPOTLIGHT - SENTRY_TRACES_SAMPLE_RATE extra_hosts: - "host.docker.internal:host-gateway" <key2>: environment: - SENTRY_SPOTLIGHT - SENTRY_TRACES_SAMPLE_RATEy extra_hosts: - "host.docker.internal:host-gateway" ... <keyN>: environment: - SENTRY_SPOTLIGHT - SENTRY_TRACES_SAMPLE_RATE extra_hosts: - "host.docker.internal:host-gateway"
- Add the following to the final version of the command from step 2.4 above:
-f --- This is following the merge logic from https://docs.docker.com/compose/how-tos/multiple-compose-files/merge, feel free to refer to that for any corrections or debugging - Change
localhostin Spotlight URL tohost.docker.internalsoSENTRY_SPOTLIGHTenv variable should be something likehttp://host.docker.internal:<port>/stream - Push the yaml file generated in step 2.6 above as
stdinfor the process you are running ast part ofspotlight run
- Set the run command to