diff --git a/app/init/resources.php b/app/init/resources.php index e80f938fd7..d559213f5e 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -70,12 +70,21 @@ $container->set('localeCodes', fn () => array_map(fn ($locale) => $locale['code' $container->set('executor', fn () => new Executor(), []); -$container->set('jobs', fn () => new Jobs( - (new Client(new CurlAdapter())) - ->withBaseUri(System::getEnv('_APP_JOBS_HOST', '')) +$container->set('jobs', function () { + $client = (new Client(new CurlAdapter())) ->withBearerAuth(System::getEnv('_APP_JOBS_SECRET', '')) - ->withTimeout(30) -), []); + ->withTimeout(30); + + // No host on executor-only installs: keep the injection resolvable and + // fail at call time instead (the client is only used when + // _APP_BUILDS_BACKEND=orchestrator, which requires _APP_JOBS_HOST). + $host = System::getEnv('_APP_JOBS_HOST', ''); + if ($host !== '') { + $client = $client->withBaseUri($host); + } + + return new Jobs($client); +}, []); $container->set('telemetry', fn () => new NoTelemetry(), []); diff --git a/docker-compose.yml b/docker-compose.yml index 416f9e21d7..dbcf8a98cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -515,6 +515,11 @@ services: - _APP_STORAGE_WASABI_BUCKET - _APP_DATABASE_SHARED_TABLES - _APP_DOMAIN_SITES + - _APP_BUILDS_BACKEND + - _APP_BUILDS_VOLUME + - _APP_JOBS_HOST + - _APP_JOBS_SECRET + - _APP_JOBS_ENDPOINT extra_hosts: - host.docker.internal:host-gateway