Skip to content

Commit

Permalink
merge: #2670
Browse files Browse the repository at this point in the history
2670: fix(si): Ensure SI containers restart on failure r=stack72 a=stack72

This will ensure any race conditions are fixed by a restart


Co-authored-by: stack72 <[email protected]>
  • Loading branch information
si-bors-ng[bot] and stack72 authored Aug 21, 2023
2 parents 994f405 + 1f94bdd commit 0b5330b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/si-cli/src/cmd/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
.name(container_name.clone())
.image(format!("{0}:stable", container.clone()))
.links(["local-jaeger-1:jaeger"])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -107,6 +108,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
.name(container_name.clone())
.image(format!("{0}:stable", container.clone()))
.expose(PublishPort::tcp(16686), HostPort::new(16686))
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -146,6 +148,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
.name(container_name.clone())
.image(format!("{0}:stable", container.clone()))
.command(vec!["--config", "nats-server.conf", "-DVV"])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -190,6 +193,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
"POSTGRES_USER=si",
"POSTGRES_DB=si",
])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -233,6 +237,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
"SI_COUNCIL__NATS__URL=nats",
"OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317",
])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -282,6 +287,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
.links(vec!["local-nats-1:nats", "local-otelcol-1:otelcol"])
.env(env_vars)
.volumes([format!("{}:/run/cyclone:z", si_data_dir.display())])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -332,6 +338,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
"OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317",
])
.volumes([format!("{}:/run/pinga:z", si_data_dir.display())])
.restart_policy("on-failure", 3)
.build();

let container = docker.containers().create(&create_opts).await?;
Expand Down Expand Up @@ -382,6 +389,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
])
.network_mode("bridge")
.expose(PublishPort::tcp(5156), HostPort::new(5156))
.restart_policy("on-failure", 3)
.volumes([
format!(
"{}:/run/sdf/cyclone_encryption.key:z",
Expand Down Expand Up @@ -437,6 +445,7 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
.links(vec!["local-sdf-1:sdf"])
.env(["SI_LOG=trace"])
.network_mode("bridge")
.restart_policy("on-failure", 3)
.expose(
PublishPort::tcp(8080),
HostPort::with_ip(host_port, host_ip),
Expand Down

0 comments on commit 0b5330b

Please sign in to comment.