nteract / commuter

🚎 Notebook sharing hub
BSD 3-Clause "New" or "Revised" License
489 stars 66 forks source link

Docker ? #188

Open rwatts3 opened 7 years ago

rwatts3 commented 7 years ago

I can see Commuter being used as a docker server, while running a commuter instance from within a docker container. If there isn't a plan in place already i'd be happy to contribute a Pull Request, that installs, and runs commuter via docker.

Please let me know your thoughts.

rgbkrk commented 7 years ago

Sounds good to me! I'm guessing the Dockerfile would live at the top of the repo?

rwatts3 commented 7 years ago

Yes it could, but I do not believe it is a requirement. I was thinking about having the Dockerfile, install commuter, via the packaged approach, vs. the source files. But that is up to you.

Also on a side note I noticed, when I try to view my project in commuter after creating a plotly plot, it seems to only show the source code and not the plot that was generated in nteract. Is there something I may be doing wrong ? http://nimb.ws/DuOrSz

rgbkrk commented 7 years ago

commuter doesn't have the plotly transform enabled by default, largely blocked by a size issue

rgbkrk commented 7 years ago

Nevermind, we should be able to -- I did this in the notebook preview demo here:

https://github.com/nteract/nteract/pull/1683

Need to update the code here to accept the plotly transform.

rgbkrk commented 7 years ago

I was thinking about having the Dockerfile, install commuter, via the packaged approach, vs. the source files. But that is up to you.

That's totally cool.

rwatts3 commented 7 years ago

Ok is that something I should do on my end or is that something that will be rolled out ? if so is there a branch I can install for commuter to test it or get it working

rgbkrk commented 7 years ago

No branches or PRs for it at the moment. I'm working on some other things and likely won't visit it for at least a couple weeks. It would be cool if you wanted to add it, following what was in nteract/nteract#1683!

rwatts3 commented 7 years ago

Yeah I'll give that a shot. I was just unsure where to add it. Commuter or Nteract but I haven't looked at the PR yet so that may be self explanatory

On Fri, Jul 7, 2017, 4:52 PM Kyle Kelley notifications@github.com wrote:

No branches or PRs for it at the moment. I'm working on some other things and likely won't visit it for at least a couple weeks. It would be cool if you wanted to add it, following what was in nteract/nteract#1683 https://github.com/nteract/nteract/pull/1683!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nteract/commuter/issues/188#issuecomment-313818140, or mute the thread https://github.com/notifications/unsubscribe-auth/AFFsSUe3jFvArarSjolRd7Yq2yDRRjWiks5sLsS7gaJpZM4ORVoi .

--

-V/R

Ryan Watts

rgbkrk commented 7 years ago

Into commuter itself as a prop to <NotebookPreview. The incarnation should be the same as that nteract PR.

rwatts3 commented 7 years ago

Right on , maybe I can jump in and help.

On Fri, Jul 7, 2017, 6:06 PM Kyle Kelley notifications@github.com wrote:

Into commuter itself as a prop to <NotebookPreview. The incarnation should be the same as that nteract PR.

Side note: I'm about to make the developer experience here 10x better using nteract/nteract#1767 https://github.com/nteract/nteract/pull/1767 and a local branch I've been working on for commuter.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nteract/commuter/issues/188#issuecomment-313823868, or mute the thread https://github.com/notifications/unsubscribe-auth/AFFsScWPyRy-ONg5y8dAAU4ypxxAA2lvks5sLtYdgaJpZM4ORVoi .

--

-V/R

Ryan Watts

rwatts3 commented 7 years ago

As promised, this is a very basic docker setup. Drop these in the directory of your commuter project, and fire away. Docker Compose file provided in case you have a docker-machine setup, and would like to streamline deployments to that instance. I'm currently running with docker and docker-compose using Google Cloud Compute.

Do note the VIRTUAL** and LETSENCRYPT** environment variables are for those that are running nginx with the letsencrypt proxy. This ensures that when you deploy the commuter app it automatically detects and registers ssl certificates.

Example. https://science.ryanwatts.me

docker-compose.yml

version: '3'
services:
  commuter:
    build:
      context: '.'
      dockerfile: 'Dockerfile'
    expose:
      - "4000"
    network_mode: "bridge"
    environment:
      - NODE_ENV=production
      - HOST=0.0.0.0
      # - VIRTUAL_HOST=commuter.somedomain.com
      # - VIRTUAL_PORT=4000
      - LETSENCRYPT_HOST=commuter.somedomain.com
      - LETSENCRYPT_EMAIL=youremail@somedomain.com
      - COMMUTER_STORAGE_BACKEND=local
      - COMMUTER_DISCOVERY_BACKEND=none
      - COMMUTER_PORT=4000
      - COMMUTER_LOCAL_STORAGE_BASEDIRECTORY=/app
      # - COMMUTER_S3_BASE_PREFIX
      # - COMMUTER_S3_PATH_DELIMITER
      # - COMMUTER_BUCKET
      # - COMMUTER_S3_KEY
      # - COMMUTER_S3_SECRET
    volumes: 
      - /opt/commuter:/app/commuter
    restart: always
    command: commuter

Dockerfile

FROM node:latest
MAINTAINER Ryan Watts <rwatts@gmail.com>

# setup container for installation.
RUN mkdir /app
WORKDIR /app
ADD . /app

# run installation/ build commands.
RUN npm i -g @nteract/commuter

ENV HOST=0.0.0.0
ENV PORT=4000

EXPOSE 4000

CMD npm run start