Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve boot related cli output #938

Merged
merged 8 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions programs/psinode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,9 +2097,9 @@ void run(const std::string& db_path,
}
else
{
check(
false,
"should not get here, because service should have been checked already");
check(false,
"should not get here, because service should have been checked "
"already");
}
std::vector<Claim> claim;
result->get(claim);
Expand Down Expand Up @@ -2374,8 +2374,48 @@ void run(const std::string& db_path,
{
if (!showedBootMsg)
{
PSIBASE_LOG(node.chain().getLogger(), notice)
<< "Need genesis block; use 'psibase boot' to boot chain";
std::string xAdminSubdomain;
for (const auto& service : services)
{
if (service.root.string().find("services/x-admin") != std::string::npos &&
service.host.ends_with('.'))
{
xAdminSubdomain = service.host + host;
break;
}
}

if (!xAdminSubdomain.empty())
{
std::string protocol;
std::string port;
for (const auto& listen : http_config->listen)
{
if (std::holds_alternative<psibase::http::tcp_listen_spec<true>>(listen))
swatanabe marked this conversation as resolved.
Show resolved Hide resolved
{
const auto& spec = std::get<psibase::http::tcp_listen_spec<true>>(listen);
protocol = "https://";
port = std::to_string(spec.endpoint.port());
break;
}
else if (std::holds_alternative<psibase::http::tcp_listen_spec<false>>(listen))
{
const auto& spec = std::get<psibase::http::tcp_listen_spec<false>>(listen);
protocol = "http://";
port = std::to_string(spec.endpoint.port());
}
}
xAdminSubdomain = protocol + xAdminSubdomain + ":" + port;
}

std::string message = "Node is not yet booted. To boot, use the 'psibase boot' CLI";
swatanabe marked this conversation as resolved.
Show resolved Hide resolved
if (!xAdminSubdomain.empty())
{
message += " or visit '" + xAdminSubdomain +
"' app in browser for a graphical boot interface";
swatanabe marked this conversation as resolved.
Show resolved Hide resolved
}

PSIBASE_LOG(node.chain().getLogger(), notice) << message;
showedBootMsg = true;
}
//continue;
Expand Down Expand Up @@ -2448,8 +2488,8 @@ int main(int argc, char* argv[])
"Controls client access to the admin API");
opt("database-cache-size",
po::value(&db_cache_size)->default_value({std::size_t(1) << 33}, "8 GiB"),
"The amount of RAM reserved for the database cache. Must be at least 64 MiB. Warning: this "
"will not modify an existing database. This option is subject to change.");
"The amount of RAM reserved for the database cache. Must be at least 64 MiB. Warning: "
"this will not modify an existing database. This option is subject to change.");
#ifdef PSIBASE_ENABLE_SSL
opt("tls-trustfile", po::value(&root_ca)->default_value({}, "")->value_name("path"),
"A list of trusted Certification Authorities in PEM format");
Expand Down
2 changes: 1 addition & 1 deletion rust/psibase/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ async fn boot(
progress.inc(1)
}
if !args.suppress_ok {
println!("Ok");
println!("Ok. Successfully booted {}", args.api);
swatanabe marked this conversation as resolved.
Show resolved Hide resolved
}
Ok(())
}
Expand Down
Loading