Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

How to run Rserve with supervisord in docker container?

$
0
0

I want to run Rserve (as daemon process) in docker container.My basic requirement is I want to have one R program which will be running as background process. To achieve this i have created one R file and I am trying to run same with Rserve. For this i have created supervisor.conf file with below entry.

 [supervisord]

 nodaemon=true

 [program:rserve]

 command=/usr/bin/R CMD Rserve --slave --RS-conf
 /sri-app/rserve/rserve.conf --RS-source /sri-app/rserve/rserve-src.R

 user=root

 autostart=true

 autorestart=true

 stdout_logfile=/tmp/rserve_out.log

 stderr_logfile=/tmp/rserve_err.log

 environment=PATH="/usr/bin/R"

Below are the entries for "rserve.conf" file

 http.port 8080

 remote disable

 auth disable

 daemon enable

 control disable

I have included this supervisor.conf entry in dockerfile as below

 CMD ["/sri-app/run_supervisord.sh"]

where "run_supervisord.sh" has entries below

 #!/bin/bash 

 /usr/bin/supervisord -c /sri-app/api-supervisor.conf

Now the issue is when I am running docker container facing below error.

 2019-11-13 10:39:48,738 INFO supervisord started with pid 102

 2019-11-13 10:39:49,740 INFO spawned: 'rserve' with pid 105

 2019-11-13 10:39:49,870 INFO exited: rserve (exit status 0; not
 expected)

 2019-11-13 10:39:50,873 INFO spawned: 'rserve' with pid 109

 2019-11-13 10:39:50,999 INFO exited: rserve (exit status 1; not
 expected)

 2019-11-13 10:39:53,002 INFO spawned: 'rserve' with pid 112

 2019-11-13 10:39:53,130 INFO exited: rserve (exit status 1; not
 expected)

 2019-11-13 10:39:56,134 INFO spawned: 'rserve' with pid 115


 2019-11-13 10:39:56,264 INFO exited: rserve (exit status 1; not
 expected)

 2019-11-13 10:39:57,265 INFO gave up: rserve entered FATAL state, too
 many start retries too quickly

Any suggestions?

Update :

Dockerfile Entries

FROM ubuntu:16.04
EXPOSE 8080 6311 9000

# --- Project specific entries starts here --
RUN mkdir -p /sri-app/

RUN apt-get install default-jre -y
RUN apt-get install default-jdk -y
RUN R CMD javareconf
RUN apt-get install r-cran-rjava -y
RUN apt-get update
RUN apt-get install libgdal-dev libproj-dev libssl-dev -y
RUN apt-get update && apt-get install -y wget supervisor

COPY . /sri-app
WORKDIR sri-app
RUN R CMD build .
RUN R CMD INSTALL -l "/usr/local/lib/R/site-library/" sri_3.20.4.tar.gz
## Rserve
RUN wget http://www.rforge.net/Rserve/snapshot/Rserve_1.8-5.tar.gz \
    && R CMD INSTALL Rserve_1.8-5.tar.gz

ENV HEALTH_CHECK_URL http://localhost:8080/heartBeat
ENV ACTIVE_ACTIVE true
ENV IS_ENTRY_POINT true
ENV APP_NAME "sr-insights"
ENV NODE_NAME sri-service
ENV APP_UUID "7b24c1c4-9dc8-43e6-8738-bedb86bc0c22"

# -- project specific entries ends here ---

# -- I feel main concerns is in below set of entries ---

COPY runR.sh /sri-app/
COPY run_supervisord.sh /sri-app/
RUN chmod +x /sri-app/run_supervisord.sh
RUN chmod +x /sri-app/runR.sh
CMD ["/sri-app/run_supervisord.sh"]


Viewing all articles
Browse latest Browse all 201919

Trending Articles