I am trying to create a demo which is based on 2 docker containers. Each container runs R-Studio (rocker/verse).
One container is publishing API and another container reading the result using GET (inside ShinyApp). When I test API in Swagger generated by plumber it works, however when I test the Request using Postman then what I get is a R-Studio login page
I could also create a network in and both containers could communicate. What I can read from another container is just the same R-Studio login page
establish the network
docker network create -d bridge my-net
Environment publishing API
docker run -d --rm --network=my-net --net-alias=Prod -p 8797:8787 --name Prod rocker/verse
library(plumber)
#* Provide correct configuration automatically
#* @param part_num Part Location in the Group
#* @param grp_num Group Number
#* @get /config
function(part_num, grp_num) {
# read the specification
df1 <- read_csv("/home/myself/r-studio/verify-parts/master_spec.csv")
# extract the needed element
part_num <- as.numeric(part_num)
grp_num <- as.numeric(grp_num)
df1[[part_num]][[grp_num]]
}
plumb(file='api/plumber.R')$run()
Environment executing GET requests from Shiny App
docker run -d --rm --network=my-net --net-alias=Dev -p 8787:8787 --name Dev rocker/verse
library(httr)
url <- "172.19.0.2:8787/p/1c2808f8/config?grp_num=a&part_num=b"`
res <- GET(url)
# interpret the results
element <- rawToChar(res$content)
> output is html page with R studio
I expect the output is the character as it was tested in Swagger, but why the actual output is html web object.
Perhaps there is more simple way to test such setup, appreciate relevant help, thanks!