Skip to content

Commit

Permalink
fix: add hosts file to runc (#1386)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
Fixes RVT-4074
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Nov 21, 2024
1 parent 57d6d66 commit 76089bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/infra/client/manager/src/actor/oci_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,13 @@ fn mounts(opts: &ConfigOpts) -> Result<serde_json::Value> {
"type": "bind",
"source": opts.actor_path.join("resolv.conf").to_str().context("resolv.conf path")?,
"options": ["rbind", "rprivate"]
}
},
{
"destination": "/etc/hosts",
"type": "bind",
"source": opts.actor_path.join("hosts").to_str().context("hosts path")?,
"options": ["rbind", "rprivate"]
},
]))
}

Expand Down
14 changes: 13 additions & 1 deletion packages/infra/client/manager/src/actor/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl Actor {

// resolv.conf
//
// See also rivet-job.conflist in lib/bolt/core/src/dep/terraform/install_scripts/files/nomad.sh
// See also rivet-actor.conflist in packages/services/cluster/src/workflows/server/install/install_scripts/files/pegboard_configure.sh
fs::write(
actor_path.join("resolv.conf"),
indoc!(
Expand All @@ -314,6 +314,18 @@ impl Actor {
)
.await?;

// hosts
fs::write(
actor_path.join("hosts"),
indoc!(
"
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
"
),
)
.await?;

Ok(())
}

Expand Down
1 change: 0 additions & 1 deletion packages/infra/client/manager/src/runner.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
io::Write,
os::unix::process::CommandExt,
path::{Path, PathBuf},
process::Stdio,
Expand Down

0 comments on commit 76089bb

Please sign in to comment.