pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
154 stars 24 forks source link

Docklet starts, but seems to return control to R before IP info is complete #166

Closed CerebralMastication closed 5 years ago

CerebralMastication commented 6 years ago

Session Info:

 devtools::session_info()
Session info --------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.830)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2018-08-12                  

Packages ------------------------------------------------------------------------------------
 package       * version    date       source                              
 analogsea     * 0.6.5.9110 2018-08-10 Github (sckott/analogsea@8f1f569)  

Hey Scott (and others!) great project in Analogsea! I'm running into a couple of little snags, however. When I fire up a DO droplet it seems that the API passes control back to R before an IP is ready or somehow the IP doesn't get passed. So I get the following:

> remote_computer <- docklet_create(region = "sfo2", size = "1gb")
Using default ssh keys: id_rsa.pub
NB: This costs $0.01488 / hour until you droplet_delete() it
Waiting for create .........................
> print (remote_computer$networks$v4[[1]]$ip_address)
Error in remote_computer$networks$v4[[1]] : subscript out of bounds
> print(remote_computer)
<droplet>SweatingOasis (105782768)
  IP:        droplet likely not up yet
  Status:    new
  Region:    San Francisco 2
  Image:     Docker 17.03.0-ce on 14.04
  Size:      1gb
  Volumes:

So analogsea did not receive an IP back... but if I go to my DO dashboard I can see that SweatingOasis is up and running with an IP:

image

So my questions are two fold:

  1. Any ideas on why analogsea is not getting the IP?
  2. Given that analogsea knows the name of the instance, but not the IP is there a command that will 'refresh' a node instance and ask the API for the missing info? Right now the only thing I know to do is to kill the droplet, restart the R process, and hope it works.

As a side note, I reproduced this behavior from a Ubuntu box as well as my Mac laptop. I don't get an incomplete load every time I try to connect, but more than 20% of the time.

Thanks!

sckott commented 6 years ago

thx for your question! and for using analogsea 🌊

This is a known issue (E.g., https://github.com/sckott/analogsea/issues/113) - not sure why it happens exactly, but could be due to the last ping to the DO API saying that the droplet is up but somehow it's not true. OR because port 22 is not open yet (we have a check for this now).

The fix I do is just to run the output of docklet_create through droplet() like

d <- docklet_create(region = "sfo2", size = "1gb")
d <- droplet(d$id)

then the d object should have the IP address.

sckott commented 6 years ago

@CerebralMastication let me know if that works or does not work

CerebralMastication commented 5 years ago

@sckott sorry for the slow response. The droplet(d$id) approach seems to work for me. Thanks.

sckott commented 5 years ago

@CerebralMastication glad that works.

I'll see if we need to add this tidbit to the docs ...