MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / ensure_proxy

Method ensure_proxy

src/docker/proxy_manager.rs:195–227  ·  view source on GitHub ↗

Ensures the proxy for the given configuration is running and healthy. This method: 1. Checks if the proxy for this config is already running (skips build if so) 2. Builds the proxy image if needed 3. Ensures the external network exists 4. Starts the proxy container if not running 5. Waits for the proxy to become healthy # Returns `Ok(container_name)` - the proxy container name on success `Err` i

(
        &self,
        proxy_config: &ResolvedProxyConfig,
        logger: &TaskLogger,
    )

Source from the content-addressed store, hash-verified

193 /// * `Ok(container_name)` - the proxy container name on success
194 /// * `Err` if proxy cannot be started or becomes unhealthy
195 pub(crate) async fn ensure_proxy(
196 &self,
197 proxy_config: &ResolvedProxyConfig,
198 logger: &TaskLogger,
199 ) -> Result<String> {
200 let container_name = proxy_config.proxy_container_name();
201
202 // Skip build if proxy is already running - config changes will be
203 // picked up when the proxy is stopped and restarted
204 if !self.is_proxy_running(&container_name).await? {
205 self.build_proxy(false, logger)
206 .await
207 .context("Failed to build proxy image")?;
208 }
209
210 // Ensure external network exists
211 let network_name = proxy_config.external_network_name();
212 self.ensure_network(&network_name)
213 .await
214 .context("Failed to ensure network exists")?;
215
216 // Check if proxy container exists and is running
217 self.ensure_proxy_container(proxy_config)
218 .await
219 .context("Failed to ensure proxy container is running")?;
220
221 // Wait for proxy to be healthy
222 self.wait_for_proxy_health(&container_name, logger)
223 .await
224 .context("Failed to wait for proxy health")?;
225
226 Ok(container_name)
227 }
228
229 /// Resolves the IP address of the proxy container on the specified network.
230 ///

Calls 7

proxy_container_nameMethod · 0.80
is_proxy_runningMethod · 0.80
build_proxyMethod · 0.80
external_network_nameMethod · 0.80
ensure_networkMethod · 0.80
wait_for_proxy_healthMethod · 0.80