Code Monkey home page Code Monkey logo

shinyproxy-config's Introduction

Setting Up Docker-Compose for ShinyProxy

How to use

Download a template:

# Download a template
git clone [email protected]:kassambara/shinyproxy-config.git
cd shinyproxy-config/docker-compose-example

Template folder structure:

docker-compose-example
├── docker-compose.yml
├── shinyapps
│   └── euler-docker
│       ├── Dockerfile
│       ├── Rprofile.site
│       └── euler
│           ├── server.R
│           └── ui.R
└── shinyproxy
    ├── Dockerfile
    └── application.yml

Content of the docker-compose.yml:

version: "3.6"
services:
  shinyproxy:
    image: datanovia/shinyproxy
    container_name: dnv_shinyproxy
    restart: on-failure
    build: ./shinyproxy
    networks:
      - dnv-net
    ports:
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./shinyproxy-logs/server:/log
      - ./shinyproxy-logs/container:/container-logs
      - ./shinyproxy/application.yml:/opt/shinyproxy/application.yml
  euler:
    image: euler-docker
    container_name: dnv_euler
    build: ./shinyapps/euler-docker
    networks:
      - dnv-net

networks:
  dnv-net:
    name: dnv-net

Content of the ShinyProxy application.yaml:

proxy:
  title: ShinyProxy
  port: 8080
  authentication: simple
  admin-groups: admins
  users:
  - name: jack
    password: password
    groups: admins
  - name: jeff
    password: password
  docker:
      internal-networking: true
      container-network: dnv-net
  # change this route to your work directory, use absolute path
  # work-directory: /Users/kassambara/Documents/shinyproxy-docker-compose-example
  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    container-network: "${proxy.docker.container-network}"
    # container-volumes: ["${proxy.work-directory}/apps:/apps"]
  - id: euler
    display-name: Euler's number
    container-cmd: ["R", "-e", "shiny::runApp('/root/euler')"]
    container-image: euler-docker
    container-network: "${proxy.docker.container-network}"

logging:
  file:
    /log/shinyproxy.log

Docker uses networks to enable communication between containers. For ShinyProxy to communicate properly with the Shiny App, the network specified in docker-compose.yml must be the same as the same as that listed in application.yml. (Tip, if you’re using a docker-compose file to launch the app, don’t set up the docker network manually, see here for why).

Each container listed in services: is named in container_name, with the Dockerfile being pointed to via. the context and Dockerfile variables. If the container was terminated with an error code, the restart line instructs Docker what action is to be taken . The networks variables lists the Docker network that the container has access to.

The network used by all applications in this docker-compose must match the network specified in the ShinyProxy application.yml.

Building and running

# Go into your project folder
cd shinyproxy-config/docker-compose-example
# Build all docker images
docker-compose build
# Run shinyproxy
docker-compose up -d shinyproxy

Visit: http://localhost:8080

To stop shinyproxy use docker-compose down.

Other Examples of configuration

shinyproxy-config's People

Contributors

kassambara avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

fkotey skybett j0vid

shinyproxy-config's Issues

how to access a sub-directory with volume argument ?

Please how to specify many a subdirectory volume if I want something like that:

container-volumes: ["/home/xx/dataspace/shiny_test/datas:/root/app_test/datas"]

In application.yml working but only one volume ...

Solution in docker-compose.yml not working:
volumes:
- /home/xx/dataspace/sqi_dashboard/datas:/root/sqi_dashboard/datas
- /home/xx/dataspace/sqi_dashboard/inputs:/root/sqi_dashboard/inputs
- /home/xx/dataspace/sqi_dashboard/outputs:/root/sqi_dashboard/outputs
Thanks

Azure Web App

Is it possible to deploy an app using this as a template to azure app services using Docker compose and if so, what changes could i possibly make to be able to do this. I tried pushing both containers in an azure registry but i was not able to access the app from the shiny server due to docker refusing to connect to the app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.