possible to run as docker container?

Whenever you feel like talking about something else, there's always the off-topic forum
Post Reply
bowerth
Posts: 3
Joined: Tue Jul 04, 2017 7:48 am

possible to run as docker container?

Post by bowerth »

hello -
I have created a small dockerfile to test jamovi as Fedora user
it seems successful with the limitation that I don't see any front-end (no surprise)
My question: does jamovi expose a URL to the host system that can be accessed using a web browser?
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: possible to run as docker container?

Post by jonathon »

hi bowerth,

great you've got it working in docker!

sorry for the delay in getting back to you. yes, when jamovi starts up, it listens on some ports which should be accessible from a web browser. it will pick them at random, but it's possible to specify them.

however, this probably will require a small amount of work from me to get this working properly. the client-side code is currently electron specific in a couple of places, so i'll need to make it more general.

give me a few days, and chase me up if i take too long.

jonathon
bowerth
Posts: 3
Joined: Tue Jul 04, 2017 7:48 am

Re: possible to run as docker container?

Post by bowerth »

cheers, I will stay tuned

my dockerfile:

```
FROM ubuntu:16.04
RUN apt-get update
# enable install from PPA
RUN apt-get install -y software-properties-common
RUN apt-get install -y python-software-properties
# install jamovi
RUN add-apt-repository ppa:jonathon-love/jamovi
RUN apt-get update && apt-get install -y jamovi
```
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: possible to run as docker container?

Post by jonathon »

hey, sorry for the delay, it took longer than i thought.

the latest 0.8.0.4 can be used as a server, and is useable from a web browser.

you can now run:

jamovi-server

and it will spawn a server which listens on port 1337. you can also go:

jamovi-server 12345 --if=*

where 12345 is a different port number, and --if=* causes it to listen on all interfaces (not just localhost).

thanks for bringing this up. let me know if you have any other Qs.

jonathon
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: possible to run as docker container?

Post by jonathon »

OK, this is my docker file:
FROM ubuntu:16.04
RUN apt-get update
# enable install from PPA
RUN apt-get install -y software-properties-common

# install jamovi
RUN add-apt-repository ppa:jonathon-love/jamovi
RUN apt-get update && apt-get install -y jamovi-server

EXPOSE 41337
EXPOSE 41338
EXPOSE 41339

ENTRYPOINT ["/usr/bin/jamovi-server"]
CMD ["41337", "--if=*"]
and i run it with:

docker run -p41337:41337 -p41338:41338 -p41339:41339 <image name>

and then i can browse to localhost:41337

jonathon
vmoreno
Posts: 21
Joined: Mon Jun 05, 2017 6:04 pm

Re: possible to run as docker container?

Post by vmoreno »

Hi,
This Dockerfile worked a while ago, but I have tried it now and build works, but run stops with a python error message from server.py

ImportError: No module named 'tornado'

I have added tornado with pip3, but then other ImportErrors appear

The docker version is useful
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: possible to run as docker container?

Post by jonathon »

oh yup. you've just got to keep following up those missing dependencies.

but what's your use-case? the flatpak is probably an easier way to achieve it.
vmoreno
Posts: 21
Joined: Mon Jun 05, 2017 6:04 pm

Re: possible to run as docker container?

Post by vmoreno »

Hi Jonathon,
I managed to run it again. I had to add some python libraries and the environment to make it work.
The code in /usr/lib/jamovi/bin/env.conf is needed, perhaps not all the lines.

Here is the Dockerfile:

#######
FROM ubuntu:16.04
RUN apt-get update
# enable install from PPA
RUN apt-get install -y software-properties-common

# install jamovi
RUN add-apt-repository ppa:jonathon-love/jamovi
RUN apt-get update && apt-get install -y jamovi-server

RUN apt-get install -y python3-tornado python3-protobuf python3-yaml python3-nanomsg python3-scipy

EXPOSE 41337
EXPOSE 41338
EXPOSE 41339

ENV JAMOVI_HOME=/usr/lib/jamovi
ENV R_HOME=$JAMOVI_HOME/lib/R
ENV R_LIBS=$JAMOVI_HOME/lib/R/library:../Resources/modules/base/R
ENV PYTHONHOME=$JAMOVI_HOME
ENV PYTHONPATH=$JAMOVI_HOME/Resources/jamovi/server

ENV LD_LIBRARY_PATH=$JAMOVI_HOME/lib:$JAMOVI_HOME/lib/R/lib
ENV LD_PRELOAD=libcurl.so.3

ENV JAMOVI_MODULES_PATH=$JAMOVI_HOME/Resources/modules
ENV JAMOVI_EXAMPLES_PATH=$JAMOVI_HOME/Resources/jamovi/examples
ENV JAMOVI_CLIENT_PATH=$JAMOVI_HOME/Resources/jamovi/client
ENV JAMOVI_SERVER_CMD="$JAMOVI_HOME/bin/python3 -u -m jamovi.server 0 --debug --stdin-slave"

ENTRYPOINT ["/usr/bin/jamovi-server"]
CMD ["41337", "--if=*"]

#######

# docker build -t jamovi-image .
# docker run -d -p41337:41337 -p41338:41338 -p41339:41339 --rm --name jamovi jamovi-image
# open http://localhost:41337
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: possible to run as docker container?

Post by jonathon »

great!
Post Reply