meztez / plumberDeploy

Other
50 stars 12 forks source link

Error: ssh failed #10

Closed MislavSag closed 3 years ago

MislavSag commented 3 years ago

System details

> sessioninfo::session_info() 
- Session info ```
----------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  Croatian_Croatia.1250       
 ctype    Croatian_Croatia.1250       
 tz       Europe/Warsaw               
 date     2020-09-16                  

- Packages --------------------------------------------------------------------------------------------------------------------------------------------------------------------
 package       * version date       lib source                               
 analogsea     * 0.8.0   2020-01-30 [1] CRAN (R 4.0.2)                       
 askpass         1.1     2019-01-13 [1] CRAN (R 4.0.0)                       
 assertthat      0.2.1   2019-03-21 [1] CRAN (R 4.0.0)                       
 cli             2.0.2   2020-02-28 [1] CRAN (R 4.0.0)                       
 crayon          1.3.4   2017-09-16 [1] CRAN (R 4.0.0)                       
 credentials     1.3.0   2020-07-21 [1] CRAN (R 4.0.2)                       
 curl            4.3     2019-12-02 [1] CRAN (R 4.0.0)                       
 fansi           0.4.1   2020-01-08 [1] CRAN (R 4.0.0)                       
 glue            1.4.1   2020-05-13 [1] CRAN (R 4.0.2)                       
 httr            1.4.1   2019-08-05 [1] CRAN (R 4.0.0)                       
 jsonlite        1.7.0   2020-06-25 [1] CRAN (R 4.0.2)                       
 magrittr        1.5     2014-11-22 [1] CRAN (R 4.0.0)                       
 openssl         1.4.2   2020-06-27 [1] CRAN (R 4.0.2)                       
 packrat         0.5.0   2018-11-14 [1] CRAN (R 4.0.2)                       
 plumberDeploy * 0.1.0   2020-09-16 [1] Github (meztez/plumberDeploy@68257d6)
 R6              2.4.1   2019-11-12 [1] CRAN (R 4.0.0)                       
 rstudioapi      0.11    2020-02-07 [1] CRAN (R 4.0.0)                       
 sessioninfo     1.1.1   2018-11-05 [1] CRAN (R 4.0.0)                       
 ssh             0.7.0   2020-07-21 [1] CRAN (R 4.0.2)                       
 sys             3.3     2019-08-21 [1] CRAN (R 4.0.0)                       
 withr           2.2.0   2020-04-20 [1] CRAN (R 4.0.0)                       
 yaml            2.2.1   2020-02-01 [1] CRAN (R 4.0.0)                       

[1] C:/Users/Mislav/Documents/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.2/library

Example application or steps to reproduce the problem

plumberDeploy::do_provision(208166090)

Describe the problem in detail

I have just tried to execute plumberDeploy::do_provision(208166090) function. After several minutes it returns an error (I ma showing only last part):

...
Unpacking nginx (1.18.0-0ubuntu1) ...
Setting up nginx-common (1.18.0-0ubuntu1) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1) ...
Setting up libgd3:amd64 (2.2.5-5.2ubuntu2) ...
Setting up libnginx-mod-mail (1.18.0-0ubuntu1) ...
Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1) ...
Setting up libnginx-mod-stream (1.18.0-0ubuntu1) ...
Setting up nginx-core (1.18.0-0ubuntu1) ...
Setting up nginx (1.18.0-0ubuntu1) ...
Processing triggers for ufw (0.36-6) ...
Processing triggers for systemd (245.4-4ubuntu3.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
[100%] C:\Users\Mislav\Documents\R\win-library\4.0\plumberDeploy\server\nginx.conf
/etc/nginx/sites-available/plumber
Rules updated
Rules updated (v6)
Rules updated
Rules updated (v6)
Firewall is active and enabled on system startup
[100%] C:\Users\Mislav\Documents\R\win-library\4.0\plumber\plumber\10-welcome\plumber.R
/tmp/SPSKYQXJRZ
[100%] C:\Users\Mislav\AppData\Local\Temp\RtmpAPlCEf\file3cd4709d2761
/etc/systemd/system/plumber-hello.service
Created symlink /etc/systemd/system/multi-user.target.wants/plumber-hello.service → /etc/systemd/system/plumber-hello.service.
â—Ź plumber-hello.service - Plumber API
     Loaded: loaded (/etc/systemd/system/plumber-hello.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2020-09-16 14:16:10 UTC; 1s ago
   Main PID: 49531 (code=exited, status=1/FAILURE)

Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 systemd[1]: Started Plumber API.
Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 Rscript[49531]: Error in loadNamespace(name) : there is no package called ‘plumber’
Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 Rscript[49531]: Calls: :: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 Rscript[49531]: Execution halted
Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 systemd[1]: plumber-hello.service: Main process exited, code=exited, status=1/FAILURE
Sep 16 14:16:10 ubuntu-s-4vcpu-8gb-fra1-01 systemd[1]: plumber-hello.service: Failed with result 'exit-code'.
Error: ssh failed
systemctl status plumber-hello

and:

> traceback()
5: stop("ssh failed\n", cmd, call. = FALSE)
4: do_ssh(droplet, lines, user, keyfile = keyfile, ssh_passwd = ssh_passwd, 
       verbose = verbose)
3: analogsea::droplet_ssh(droplet, paste0("systemctl status ", serviceName))
2: do_deploy_api(droplet, "hello", system.file("plumber", "10-welcome", 
       package = "plumber"), port = 8000, forward = TRUE)
1: plumberDeploy::do_provision(208166090)
meztez commented 3 years ago

I'll switch to pre-compiled binaries, I'll let you know when it is done. Some dependencies are not getting installed when using the default unstable = FALSE

MislavSag commented 3 years ago

Should it work with unstable = TRUE?

meztez commented 3 years ago

It should be fixed now. Thank you for reporting the issue. Plumber system dependencies changed recently and installation failed when using the default unstable value.

MislavSag commented 3 years ago

I suppose I have to install from github and use nstable = TRUE? Do I still have to use ssh list as argument?

meztez commented 3 years ago

You don't need to use unstable = TRUE. Since you already set your ssh key in DO, you don't have to provide it as argument (check analogsea::keys) it should pop up. Yes, you would have to reinstall plumberDeploy from github.

Just running do_provision should work.

I will add a check for ssh_keys.

MislavSag commented 3 years ago

After all adjustments, it works.

I have one new issue. After some time I wanted to delete droplet, but it returns:

Error in ssh::ssh_info(session = session) : 
  ssh session has been disconnected

How can make ssh connection again?. Function analogsea::keys() returns my keys.

meztez commented 3 years ago

That's an analogsea problem, I am not aware of an open issue.

It occures because analogsea does not detect that the sessions was droppped by Digital Ocean. See my comment there https://github.com/meztez/plumberDeploy/issues/8#issuecomment-692851428.

MislavSag commented 3 years ago

I confirm everyithing works now. For now, I am restarting R seesion and that heps, but have also find this solution: https://www.digitalocean.com/community/questions/keep-my-ssh-session-alive. I will try it out.

alphatecht commented 2 years ago

Hi. I was using plumberDeploy successfully untill yesterday. Now I have exactly the same error given above. Would you please check once again whether Plumber system dependencies has changed recently or not, and suggest some directions to solve this error? Thanks

meztez commented 2 years ago

@alpha-wise Please open a new issue and provide a reprex.

https://community.rstudio.com/t/faq-whats-a-reproducible-example-reprex-and-how-do-i-create-one/5219