-
Notifications
You must be signed in to change notification settings - Fork 7
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
dev server + backend server at once #82
Comments
Current thoughts are: Premise: Windows
That way, if front is needed either in the background with backend or on its own. And the backend takes priority as it also is the better/production env as it serves what the front dev server serves. |
Experimental solution to this is what |
R package |
Thanks @mpadge this is useful, I must have not used Thanks again. |
Gives me great pleasure to share first ever library(geoplumber)
d <- file.path(tempdir(), "gp")
gp_create(d)
#> Creating directory: /var/folders/z7/l4z5fwqs2ksfv22ghh2n9smh0000gp/T//RtmpBelYrg/gp
#> To build/run app, set working directory to: /var/folders/z7/l4z5fwqs2ksfv22ghh2n9smh0000gp/T//RtmpBelYrg/gp
#> Standard output from create-react-app works.
#> You can run gp_ functions from directory: /var/folders/z7/l4z5fwqs2ksfv22ghh2n9smh0000gp/T//RtmpBelYrg/gp
#> To build the front end run: gp_build()
#> To run the geoplumber app: gp_plumb()
#> Happy coding.
setwd(d)
ps <- gp_plumb()
#> WARNING:
#> Looks like geoplumber was not built, serveing API only.
#> To serve the front end run gp_build() first.
ps
#> PROCESS 'R', running, pid 1419.
Sys.sleep(1) # just in case
ps
#> PROCESS 'R', running, pid 1419.
require(RCurl)
#> Loading required package: RCurl
webpage <- getURL("http://localhost:8000")
webpage <- readLines(tc <- textConnection(webpage)); close(tc)
tail(webpage)
#> [1] " <p>build missing</p>" " </div>"
#> [3] "</div>" ""
#> [5] "</body>" "</html>"
ps$kill()
#> [1] TRUE Created on 2020-05-17 by the reprex package (v0.3.0) |
Amazing timing - I'm grappling with exactly those issues in another repo right now, trying to get |
Hi Mark, got the insight from that repo, report package or something, I thought I had put a link in the above comment. Yes, must get geoplumber out! |
I don't know why but |
Nor does it happen on Travis, again strange! |
Yeah, the |
@layik I managed to fix my errors, mostly by using the debugging abilities of ps <- callr::r_bg (f, list (r = r,
port = as.integer (port)),
stdout = "/tmp/out",
stderr = "/tmp/err") Notes:
|
Thank you very much Mark, I take it you didn't (thankfully) hit the 'No environment file in temp dir' error. I will note these as they are too precious and who knows might save me days. |
No, but stuff i'll be doing today will involve passing envvars through, but |
Missed this comment, thanks Mark. I think I need to get to know the package better so again your insights will come handy. |
Reopen if this is needed. |
At the moment, there is no strategy to start both separately without one blocking the other.
Plumber uses ... (will fill that gap later) to start the backend server. And
npm start
does the front end, which is a blocking command.At least on macOS cannot be sent to the back with say
system("npm start &)
orsystem("npm start", wait = FALSE)
. Though works fine if continues to block which makes impossible for backend to run.S needs better
system
andsysteme2
understanding or more from R. Relevant functions are:gp_plum
andgp_plumb_front
. Of course, in the shell, always done it in two different windows (tmux or not).The text was updated successfully, but these errors were encountered: