Add required extra Docker network attachments#88
Conversation
There was a problem hiding this comment.
Pull request overview
Adds operator-configurable required Docker network attachments so deployed app containers can join external dependency networks (e.g., sibling Docker Compose networks) before starting, and fail the deploy if those networks are missing/unattachable (avoiding “green” deploys with broken DNS/dependencies).
Changes:
- Introduces
TEMPS_DOCKER_EXTRA_NETWORKSand plumbs it into the deployer runtime. - Adds
DeployRequest.extra_networks(serde-defaulted) and attaches required networks during deploy. - Updates docs, samples, and tests/struct literals for the new config/request fields.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/reference/environment-variables/page.mdx | Documents TEMPS_DOCKER_EXTRA_NETWORKS and operator usage. |
| crates/temps-config/src/service.rs | Adds ServerConfig.docker_extra_networks and CSV env parsing. |
| crates/temps-deployer/src/plugin.rs | Reads config and configures DockerRuntime with extra networks. |
| crates/temps-deployer/src/lib.rs | Adds DeployRequest.extra_networks (defaulted) and updates tests. |
| crates/temps-deployer/src/docker.rs | Implements normalization + required network attachment during deploy; adds unit tests for normalization/defaults. |
| crates/temps-deployer/src/remote.rs | Updates test request construction to include extra_networks. |
| crates/temps-deployer/README.md | Updates deployment example struct literal to include new/required fields. |
| crates/temps-deployments/src/jobs/deploy_image.rs | Initializes extra_networks on deploy requests. |
| crates/temps-deployments/src/handlers/nodes.rs | Updates test ServerConfig construction with docker_extra_networks. |
| crates/temps-status-page/src/tests.rs | Updates test ServerConfig construction with docker_extra_networks. |
| crates/temps-email/src/services/tracking_service_integration_tests.rs | Updates test ServerConfig construction with docker_extra_networks. |
| crates/temps-email/src/services/email_service.rs | Updates test ServerConfig construction with docker_extra_networks. |
| crates/temps-email/src/handlers/tracking_tests.rs | Updates test ServerConfig construction with docker_extra_networks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for network in networks { | ||
| let exists = existing_networks | ||
| .iter() | ||
| .any(|candidate| candidate.name.as_deref() == Some(network.as_str())); | ||
| if !exists { | ||
| return Err(DeployerError::NetworkError(format!( | ||
| "required network '{}' does not exist", | ||
| network | ||
| ))); | ||
| } |
| // Create container | ||
| let container = self | ||
| .docker | ||
| .create_container( | ||
| Some( | ||
| bollard::query_parameters::CreateContainerOptionsBuilder::new() | ||
| .name(&request.container_name) | ||
| .build(), | ||
| ), | ||
| container_config, | ||
| ) | ||
| .await | ||
| .map_err(|e| { | ||
| DeployerError::DeploymentFailed(format!("Failed to create container: {}", e)) | ||
| })?; | ||
|
|
||
| // Multi-host overlay: best-effort additional attach to `temps-overlay` | ||
| // (or whatever the operator configured). Containers always boot with | ||
| // their primary network interface (`temps-app-network`); the overlay | ||
| // attachment is purely additive and silently no-ops when the overlay | ||
| // network isn't present yet on this node. | ||
| self.maybe_attach_overlay(&container.id).await?; | ||
|
|
||
| self.attach_required_networks(&container.id, &request.extra_networks) | ||
| .await?; | ||
|
|
| /// Attach required dependency networks before container start so Docker's | ||
| /// embedded DNS can resolve service names during app boot. | ||
| async fn attach_required_networks( | ||
| &self, | ||
| container_id: &str, | ||
| request_networks: &[String], | ||
| ) -> Result<(), DeployerError> { | ||
| let mut requested = self.extra_networks.clone(); | ||
| requested.extend(request_networks.iter().cloned()); | ||
| let networks = normalize_extra_networks( | ||
| requested, | ||
| &self.network_name, | ||
| self.overlay_network.as_deref(), | ||
| ); | ||
| if networks.is_empty() { | ||
| return Ok(()); | ||
| } | ||
|
|
|
Hi @adamlevineagent! Thanks for the contribution! I think it's a feature needed for existing VPS with services. Could you review and apply the copilot fixes? |
|
Hi David, thank you, and genuinely thank you for making Temps. It is very cool, and we are happy to contribute back for use cases like ours where an app needs to join existing VPS / Docker Compose dependency networks. I reviewed Copilot's comments and pushed a follow-up commit: What changed:
Verification run locally:
One note: Docker is not reachable from this Codex environment, so the Docker-backed tests exercised the repo's existing Docker-unavailable skip path here; the pure name-or-ID unit test did run directly. |
|
@adamlevineagent Nice! What other use cases did you run into? Also, it would mean the world to me to have your testimonial on the webpage to help people discover this project in the future :) |
|
@adamlevineagent can you add changelog for this feature? |
|
Happy for the testimonial, you can credit adamlevineagent on github or The
Playful Universe if you're looking for more of a 'name.'
I'm building agent-wire.com using your backend, we have some supabase stuff
that seemingly required these fixes in order to not periodically have port
assignment issues, requiring shims that were annoying and thus the push
back to you. I'm just the ideas guy tho ;) I can have codex-elaine give
you more details if needed haha.
Best,
TPU
…On Wed, May 13, 2026 at 5:18 AM David Viejo ***@***.***> wrote:
*dviejokfs* left a comment (gotempsh/temps#88)
<#88 (comment)>
@adamlevineagent <https://github.com/adamlevineagent> Nice! What other
use cases did you run into? Also, it would mean the world to me to have
your testimonial on the webpage to help people discover this project in the
future :)
—
Reply to this email directly, view it on GitHub
<#88 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNXKQF4NOZ5ICRKHID5ISAT42RRXTAVCNFSM6AAAAACYZUMHFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINBQHA3DSOBWHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Actually hold on this, we're going to submit an updated pull once we've worked out some remaining issue that arose. |
|
sounds good :) Let me know about the testimonial when you can |
|
Hi @adamlevineagent any news about this? would be cool to have this for 0.1.0. I'm trying to release it next week |
Summary
Verification
Note: cargo check -p temps-config -p temps-deployer -p temps-deployments still fails on Windows in existing docker_cleanup_service code using Docker::connect_with_unix_defaults and inferred cleanup result types; this patch did not touch that path.