mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
bind host ip to 'hazehost'
This commit is contained in:
parent
818092fda8
commit
830155b687
2 changed files with 24 additions and 1 deletions
23
src/cloud.rs
23
src/cloud.rs
|
|
@ -153,6 +153,19 @@ impl Cloud {
|
||||||
.ok_or(Report::msg("No network id in response"))
|
.ok_or(Report::msg("No network id in response"))
|
||||||
.wrap_err("Failed to create network")?;
|
.wrap_err("Failed to create network")?;
|
||||||
|
|
||||||
|
let network_info = docker.inspect_network::<String>(&network, None).await?;
|
||||||
|
let gateway = network_info
|
||||||
|
.ipam
|
||||||
|
.as_ref()
|
||||||
|
.ok_or(Report::msg("Network has no ip info"))?
|
||||||
|
.config
|
||||||
|
.as_deref()
|
||||||
|
.ok_or(Report::msg("Network has no ip info"))?
|
||||||
|
.first()
|
||||||
|
.ok_or(Report::msg("Network has no ip info"))?
|
||||||
|
.get("Gateway")
|
||||||
|
.ok_or(Report::msg("Network has no ip info"))?;
|
||||||
|
|
||||||
let mut containers = Vec::new();
|
let mut containers = Vec::new();
|
||||||
|
|
||||||
let sources_meta = fs::metadata(&config.sources_root)?;
|
let sources_meta = fs::metadata(&config.sources_root)?;
|
||||||
|
|
@ -200,7 +213,15 @@ impl Cloud {
|
||||||
|
|
||||||
let container = options
|
let container = options
|
||||||
.php
|
.php
|
||||||
.spawn(docker, &id, env, &options.db, &network, volumes)
|
.spawn(
|
||||||
|
docker,
|
||||||
|
&id,
|
||||||
|
env,
|
||||||
|
&options.db,
|
||||||
|
&network,
|
||||||
|
volumes,
|
||||||
|
gateway.as_str(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.wrap_err("Failed to start php container")?;
|
.wrap_err("Failed to start php container")?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ impl PhpVersion {
|
||||||
db: &Database,
|
db: &Database,
|
||||||
network: &str,
|
network: &str,
|
||||||
volumes: Vec<String>,
|
volumes: Vec<String>,
|
||||||
|
host: &str,
|
||||||
) -> Result<String> {
|
) -> Result<String> {
|
||||||
pull_image(docker, self.image()).await?;
|
pull_image(docker, self.image()).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -76,6 +77,7 @@ impl PhpVersion {
|
||||||
network_mode: Some(network.to_string()),
|
network_mode: Some(network.to_string()),
|
||||||
// links: Some(links),
|
// links: Some(links),
|
||||||
binds: Some(volumes),
|
binds: Some(volumes),
|
||||||
|
extra_hosts: Some(vec![format!("hazehost:{}", host)]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
networking_config: Some(NetworkingConfig {
|
networking_config: Some(NetworkingConfig {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue