Bookdown on Shinyproxy


#1

Has anyone been able to get a bookdown site working in shinyproxy?

I can get a rmarkdown document rendering and showing using something like the following:
rmarkdown::run(file='/root/code/test_markdown.Rmd')

But I haven’t been able to do the same with bookdown, when I run:
bookdown::serve_book(dir = '.', output_dir = '_book', preview = TRUE, in_session = TRUE, quiet = FALSE)

I get a book to ‘knit’ but the app times out without redirecting me to the homepage


#2

Hi @akenny,

Yes, it works, the only thing is that you need to specify host = "0.0.0.0" for the serve_book and make sure the correct port is used in the application.yml (4321 by default, or you can pass a custom one to serve_book as well).

An example Dockerfile (assuming your book is contained in the “book” folder):

FROM openanalytics/r-base

# install required R packages
RUN install.r bookdown servr

# install pandoc
RUN wget https://github.com/jgm/pandoc/releases/download/2.6/pandoc-2.6-1-amd64.deb
RUN dpkg -i pandoc-2.6-1-amd64.deb

# copy your book contents
COPY book /root/book/

# use default port for shinyproxy apps, so you don't have to add port in application.yml
EXPOSE 3838  

CMD ["R", "-e", "bookdown::serve_book('/root/book', port = 3838, host = '0.0.0.0')"]