Skip to content

Commit

Permalink
websocket rpc + users in config + small code structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Smehnov committed Aug 26, 2024
1 parent a07c38c commit 1f7b56c
Show file tree
Hide file tree
Showing 20 changed files with 894 additions and 502 deletions.
11 changes: 0 additions & 11 deletions .gitpod.yml

This file was deleted.

68 changes: 58 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ base64 = "0.22.0"
libp2p-identity = { version="0.2.8", features=["peerid"]}
openssl = { version = "0.10", features = ["vendored"] }
libp2p-kad = "0.45.3"
tokio-tungstenite = "0.23.1"


18 changes: 0 additions & 18 deletions config_example.json

This file was deleted.

15 changes: 8 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
api_key=$1
owner_public_key=$1
secret_key=$2
echo $api_key
os=$(uname)
architecture=$(uname -m)
Expand All @@ -9,7 +10,7 @@ if [[ "$os" == "Darwin" ]]; then
fi

username=$(whoami)
agent_download_url="$(curl -s https://api.github.com/repos/merklebot/robot-agent/releases/latest | grep /robot-agent-$platform | cut -d : -f 2,3 | tr -d \")"
agent_download_url="$(curl -s https://api.github.com/repos/otaberu/robot-agent/releases/latest | grep /robot-agent-$platform | cut -d : -f 2,3 | tr -d \")"



Expand All @@ -31,22 +32,22 @@ SERVICE_NAME=robot-agent.service

echo "Creating systemd service"

service_path=/etc/systemd/system/merklebot.service
service_path=/etc/systemd/system/robotagent.service

sudo tee -a $service_path << EOF
[Unit]
Description=Merklebot robot agent
Description=Robot agent
After=network.target
[Service]
ExecStart=$agent_binary_location -a $api_key
ExecStart=$agent_binary_location -o $owner_public_key -k $secret_key
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF


sudo systemctl enable merklebot
sudo systemctl start merklebot
sudo systemctl enable robotagent
sudo systemctl start robotagent
echo "Service Started"
56 changes: 0 additions & 56 deletions script.py

This file was deleted.

7 changes: 5 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub struct Args {
#[arg(short = 'm', long, default_value = "normal")]
pub mode: String,

#[arg(short = 's', long, default_value = "rn.socket")]
pub socket_filename: String,
#[arg(short = 's', long)]
pub socket_filename: Option<String>,

#[arg(short = 'f', long, default_value = "rn.key")]
pub key_filename: String,
Expand All @@ -18,6 +18,9 @@ pub struct Args {
#[arg(short = 'l', long, default_value = "8765")]
pub port_libp2p: String,

#[arg(short = 'r', long)]
pub rpc: Option<String>,

#[arg(short = 'c', long, default_value = "rn.json")]
pub config_path: String,

Expand Down
15 changes: 6 additions & 9 deletions src/commands/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ use base64::{engine::general_purpose, Engine as _};
use crate::{
commands::{RobotJob, RobotJobResult},
store::Jobs,
utils::files::{
create_job_data_dir, get_files_in_directory_recursively, get_job_data_path,
get_data_path, upload_content,
},
utils::files::create_job_data_dir,
};

pub async fn execute_launch(robot_job: RobotJob, jobs: Jobs) {
Expand Down Expand Up @@ -111,7 +108,7 @@ impl DockerLaunch {
Ok(path) => {
info!("Sharing dir {}", path);
// 2. Share folder as volume
volumes.push(format!("{}:{}", path, "/merklebot/job_data/"));
volumes.push(format!("{}:{}", path, "/rn/job_data/"));
}
_ => {
error!("Couldn't create shared dir for job {}", robot_job.id);
Expand Down Expand Up @@ -230,7 +227,7 @@ impl DockerLaunch {
}
}
crate::store::ChannelMessageToJob::ArchiveRequest {
path,
..
} => {}
}
}
Expand Down Expand Up @@ -298,16 +295,16 @@ impl DockerLaunch {
status: String::from("done"),
logs: concatenated_logs,
};
let job_data_path = get_job_data_path(&robot_job.id);

//let job_data_path = get_job_data_path(&robot_job.id);
//
// if let Some(true) = &self.args.store_data {
// match get_files_in_directory_recursively(&job_data_path) {
// //TODO: change to path
// Ok(paths) => {
// info!("{:?}", paths);
// for path in paths {
// let path_str = path.as_path().display().to_string();
// let key = path_str.replace(&get_merklebot_data_path(), "");
// let key = path_str.replace(&get_rn_data_path(), "");
// upload_content(
// agent.robot_server_url.clone(),
// path,
Expand Down
Loading

0 comments on commit 1f7b56c

Please sign in to comment.