meztez / plumberDeploy

Other
50 stars 12 forks source link

do_deploy_api() not working #7

Closed csearcy31 closed 4 years ago

csearcy31 commented 4 years ago

Hello. I know this is a very new package, so I wouldn't expect it to be perfect by any means at this point. However, I wanted to point out an issue I'm having when attempting to deploy my API to DigitalOcean. I have tried this on multiple machines and with many different configurations and continue to get the same error. I am using dev versions of plumber, plumberDeploy, and analogsea.

I am able to successfully create and provision droplets using plumberDeploy::do_provision(unstable = TRUE). It may also be worth noting that the example "hello" API deployed by do_provision() also fails with the same error.

The error I'm getting is this: Rscript[75862]: Error: attempt to apply non-function

Trace looks like this:

4: stop("ssh failed\n", cmd, call. = FALSE)
3: do_ssh(droplet, lines, user, keyfile = keyfile, ssh_passwd = ssh_passwd, 
       verbose = verbose)
2: analogsea::droplet_ssh(droplet, paste0("systemctl status ", serviceName))
1: plumberDeploy::do_deploy_api(droplet = "********", path = "test", 
       localPath = "*******************************", 
       port = 8000)

My original thinking was that droplet_ssh() or do_ssh() might have been the problem, but they're both called earlier in the deployment and seem to work fine. It looks like, for some reason, systemctl status plumber-test is not working.

Thanks so much for your help!

meztez commented 4 years ago

Do you have reprex code we could look at?

csearcy31 commented 4 years ago

I'm having trouble creating a real reprex because of the authentication required, but this is the (unevaluated) code. The plumber.R file I'm attempting to deploy is extremely minimal. It's basically just supposed to print the date.

plumber.R:

#* @get /
function() {
  Sys.Date()
}

REPREX:

## load packages
library(analogsea)
library(plumber)
library(plumberDeploy)
library(ssh)
## create and provision droplet
mydrop <- do_provision(unstable = TRUE, example = FALSE)
## deploy to DigitalOcean
plumberDeploy::do_deploy_api(
  droplet    = mydrop,
  path       = "test",
  localPath  = "./api", # location of plumber.R file
  port       = 8000
)

Created on 2020-09-09 by the reprex package (v0.3.0)

meztez commented 4 years ago

I'll take a look tonight after work

csearcy31 commented 4 years ago

That's great. Thank you so much!

meztez commented 4 years ago

So you got a Error: attempt to apply non-function because function name pr$setUI in plumber.service was not updated to match new name pr$setDocs. They have been updated.

csearcy31 commented 4 years ago

That worked perfectly! Thank you so much @meztez !