Skip to content

Conversation

@jzeuzs
Copy link
Contributor

@jzeuzs jzeuzs commented Nov 9, 2025

Implements railway restart which restarts a deployment. This has been tested.

Resolves #616.

Also resolves cargo clippy errors.

@ndneighbor ndneighbor added the release/patch Author patch release label Nov 13, 2025
Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here. This mostly looks good. Would love to merge soon!

.ok_or_else(|| anyhow!("The service specified doesn't exist in the current environment"))?;

if let Some(ref latest) = service_in_env.node.latest_deployment {
if latest.can_redeploy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this check for restarting

Comment on lines +94 to +135
// Wait for healthchecks via latest deployment status
let max_wait = Duration::from_secs(300);
let poll_interval = Duration::from_secs(2);
let start = std::time::Instant::now();
loop {
if start.elapsed() > max_wait {
spinner.finish_and_clear();
bail!("Timed out waiting for health checks after restart");
}

let resp = post_graphql::<queries::LatestDeployment, _>(
&client,
configs.get_backboard(),
queries::latest_deployment::Variables {
service_id: service.node.id.clone(),
environment_id: linked_project.environment.clone(),
},
)
.await?;

let si = resp.service_instance;
if let Some(ld) = si.latest_deployment {
match ld.status {
queries::latest_deployment::DeploymentStatus::SUCCESS => {
spinner.finish_with_message(format!(
"Restart successful for service {}",
service.node.name.green()
));
return Ok(());
}
queries::latest_deployment::DeploymentStatus::FAILED
| queries::latest_deployment::DeploymentStatus::CRASHED => {
spinner.finish_and_clear();
bail!("Restart completed but health checks failed");
}
_ => {}
}
}

tokio::time::sleep(poll_interval).await;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended to be here? Deployment restarts don't perform a healthcheck, so this is not relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/patch Author patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --ci Flag to redeploy Command for Restart-Only with Health Check Wait

3 participants