Skip to content

Commit

Permalink
chore: use ant as the antctl service user
Browse files Browse the repository at this point in the history
We want the service user to be aligned with the user we use for the deployment, and we've already
changed that to the `ant` user.
  • Loading branch information
jacderida committed Dec 3, 2024
1 parent ac4202d commit 9ccc536
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion ant-logging/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ant_logging

Logging utilities for the `safe_network` repository.
Logging utilities for the `autonomi` repository.

We define a logging approach that can be used across multiple crates or binaries.
20 changes: 10 additions & 10 deletions ant-node-manager/src/add_services/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n
antnode_path: PathBuf::from("/var/antctl/services/antnode1/antnode"),
service_name: "antnode1".to_string(),
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: latest_version.to_string(),
}],
Expand Down Expand Up @@ -1103,7 +1103,7 @@ async fn add_new_node_should_add_another_service() -> Result<()> {
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: latest_version.to_string(),
}],
Expand Down Expand Up @@ -1831,7 +1831,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_is_used() -> R
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -1952,7 +1952,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_in_range_is_us
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -2923,7 +2923,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_is_use
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -3045,7 +3045,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_in_ran
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -3414,7 +3414,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_is_used()
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -3536,7 +3536,7 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_in_range_i
service_name: "antnode1".to_string(),
status: ServiceStatus::Added,
upnp: false,
user: Some("safe".to_string()),
user: Some("ant".to_string()),
user_mode: false,
version: "0.98.1".to_string(),
}],
Expand Down Expand Up @@ -4210,7 +4210,7 @@ async fn add_auditor_should_return_an_error_if_a_auditor_service_was_already_cre
pid: Some(1000),
service_name: "auditor".to_string(),
status: ServiceStatus::Running,
user: "safe".to_string(),
user: "ant".to_string(),
version: latest_version.to_string(),
}),
faucet: None,
Expand Down Expand Up @@ -4453,7 +4453,7 @@ async fn add_faucet_should_return_an_error_if_a_faucet_service_was_already_creat
pid: Some(1000),
service_name: "faucet".to_string(),
status: ServiceStatus::Running,
user: "safe".to_string(),
user: "ant".to_string(),
version: latest_version.to_string(),
}),
environment_variables: None,
Expand Down
6 changes: 3 additions & 3 deletions ant-node-manager/src/bin/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,14 +1411,14 @@ async fn configure_winsw(verbosity: VerbosityLevel) -> Result<()> {
use ant_node_manager::config::get_node_manager_path;

// If the node manager was installed using `safeup`, it would have put the winsw.exe binary at
// `C:\Users\<username>\safe\winsw.exe`, sitting it alongside the other safe-related binaries.
// `C:\Users\<username>\autonomi\winsw.exe`, sitting it alongside the other safe-related binaries.
//
// However, if the node manager has been obtained by other means, we can put winsw.exe
// alongside the directory where the services are defined. This prevents creation of what would
// seem like a random `safe` directory in the user's home directory.
// seem like a random `autonomi` directory in the user's home directory.
let safeup_winsw_path = dirs_next::home_dir()
.ok_or_else(|| eyre!("Could not obtain user home directory"))?
.join("safe")
.join("autnomi")
.join("winsw.exe");
if safeup_winsw_path.exists() {
ant_node_manager::helpers::configure_winsw(&safeup_winsw_path, verbosity).await?;
Expand Down
2 changes: 1 addition & 1 deletion ant-node-manager/src/cmd/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn add(
print_banner("Add Daemon Service");
}

let service_user = "safe";
let service_user = "ant";
let service_manager = ServiceController {};
debug!("Trying to create service user '{service_user}' for the daemon");
service_manager.create_service_user(service_user)?;
Expand Down
2 changes: 1 addition & 1 deletion ant-node-manager/src/cmd/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub async fn add(
let service_user = if user_mode {
None
} else {
let service_user = user.unwrap_or_else(|| "safe".to_string());
let service_user = user.unwrap_or_else(|| "ant".to_string());
service_manager.create_service_user(&service_user)?;
Some(service_user)
};
Expand Down
Loading

0 comments on commit 9ccc536

Please sign in to comment.