-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
use libssh instead of shelling out #143
Comments
How do users typically authenticate? Do you assume they have their keypair setup and everything? Because this will definitely not be the case on Windows systems. |
We strongly recommend that users use ssh keys - and assume they have them in the right place. i guess it'd be nice to fail well with useful message if key not in right place |
The problem is that because ssh is not native to windows, there is no right place. So we'll have to make something in R to let the user provide a keyfile or password. |
okay, makes sense |
Gonna work on a ssh client this week :) |
thanks @jeroen |
pkg by jeroen https://github.com/ropensci/ssh getting there , looking most bueno |
@jeroen a question for you on library(analogsea)
d <- droplet_create() %>% droplet_wait() uploading works great tmp <- tempfile()
saveRDS(mtcars, tmp)
d %>% droplet_upload(tmp, "mtcars2.rds")
#> [100%] /private/var/folders/fc/n7g_vrvn0sx_st0p8lxb3ts40000gn/T/Rtmpg8C0Ru/file10cda7b26f4c3
#> mtcars2.rds But when I download, the behavior isn't what I would expect, where (tmp2 <- tempdir())
#> [1] "/var/folders/fc/n7g_vrvn0sx_st0p8lxb3ts40000gn/T//Rtmpg8C0Ru"
d %>% droplet_download("mtcars2.rds", tmp2)
#> 0 /var/folders/fc/n7g_vrvn0sx_st0p8lxb3ts40000gn/T//Rtmpg8C0Ru/mtcars2.rds
#> 1218 /var/folders/fc/n7g_vrvn0sx_st0p8lxb3ts40000gn/T//Rtmpg8C0Ru/mtcars2.rds/file107b067ff446c
#> 1218 /var/folders/fc/n7g_vrvn0sx_st0p8lxb3ts40000gn/T//Rtmpg8C0Ru/mtcars2.rds/file10cda7b26f4c3 Then reading fails mtcars2 <- readRDS(tmp2)
#> Error in readRDS(tmp2) : error reading from connection
#> In addition: Warning message:
#> In readRDS(tmp2) : error reading the file |
I think you are passing Just upload to |
okay, i think it makes sense now |
@amoeba @Thercast @trestletech @studerus @nicksmithr @berkorbay Thanks to @jeroen pkg ssh we have a new and better way to ssh to droplets. If you have time can you try out a dev version with
or switch to that branch, etc. changes so far in see changes here (master vs. ssh branches): https://github.com/sckott/analogsea/compare/master...ssh?w=1 Let me know of any problems encountered |
Cool! Just tested it out and it works great! |
great, thanks @amoeba |
@sckott Thank you very much for implementing this! I ran a quick test and found a minor problem. I always use ssh keys from my local machines to connect to my droplets, but it appears that the d <- droplet_create(region = "nyc3")
droplet_ssh(d, "ls")
#Error: libssh failure at 'connect': Failed to resolve hostname droplet likely not up yet (Temporary failure in name resolution)
#In addition: Warning message:
#In x$network : partial match of 'network' to 'networks'
# suppose IP is 555.555.5.555
library(ssh)
# this works
ssh_connect(host = "root@555.555.5.555", keyfile = "~/.ssh/id_rsa_digitalocean") It seems the easiest approach would be to add a EDIT: PR filed #153 |
thanks @Thercast looking at the PR |
@jeroen may be able to hook us up with an R libssh client so we don't have to shell out with system/etc., using one of https://www.libssh2.org/ or https://www.libssh.org/
We do a variety of operations in
analogsea
, all funneling into this https://github.com/sckott/analogsea/blob/db3c0ec407ea0c7a7cf1112d58de3fdbaa19b2e1/R/droplet-ssh.R#L164system()
call.For all system calls, we first do two things:
ssh
andscp
installed with this https://github.com/sckott/analogsea/blob/db3c0ec407ea0c7a7cf1112d58de3fdbaa19b2e1/R/zzz.R#L25-L31 (essentiallySys.which
)The different use cases include (all sent to the remote droplet):
apt-get update
apt-get autoremove -y
apt-get install r-base-core r-base-dev --yes --force-yes
scp
, see https://github.com/sckott/analogsea/blob/db3c0ec407ea0c7a7cf1112d58de3fdbaa19b2e1/R/droplet-ssh.R#L70-L77scp
, see https://github.com/sckott/analogsea/blob/db3c0ec407ea0c7a7cf1112d58de3fdbaa19b2e1/R/droplet-ssh.R#L84-L137analogsea
for running docker commands, see https://github.com/sckott/analogsea/blob/db3c0ec407ea0c7a7cf1112d58de3fdbaa19b2e1/R/docklet.RThe text was updated successfully, but these errors were encountered: