Code Monkey home page Code Monkey logo

docker-r-plumber's Introduction

docker-r-plumber

Description

This repository was created for educational purposes. Present image will generate the Plumber API which will broadcast information via the Docker network. Another container linked to the same network will be able to read this information.

Usage for demonstration

Preparation

  1. Clone the following repositories:
  1. Edit the file 'Run_Plumber':
  • replace default user/passwords
  • change name of the Local folders -v [LOCAL_FOLDERA]:[...] and -v [LOCAL_FOLDERB]:[...]

Start Demo

Launch the executable file belonging to this repo Run_Plumber this starts:

  • Container with R Plumber API
  • Container Network
  • 2 Containers with R Studio IDE

End User Space (Shiny App is not in it's own container yet)

Purpose: write all relevant logic relevant to the End User e.g. deploy the GUI App

Access: Safari browser http://localhost:8787

Use: Launch the App that can be found in the mapped folder A

Developer Space

Purpose: write all relevant logic relevant e.g. prepare and test the API

Access: Chrome browser http://localhost:8797

Use: Launch the Plumber API that can be found in the mapped folder B

Published API on it's own container see vladdsm/docker-r-plumber

Purpose: deploy Plumber API

Access: via REST API GET calls from the Shiny Web App...

Use: press button 'Config' in the Shiny App

End Demo:

Launch the executable file Stop_Plumber (this will stop all the containers as well as remove the network)

Connecting Containers [Testing]

This chapter is dedicated to note down the procedure that helps to understand if the docker network is working

Identify docker network IP address

  • from Terminal we execute command to understand actors in the network my-net docker network inspect my-net
  • resulting output is the ip addresses of the containers: API - 172.23.0.4 Prod - 172.23.0.3 Dev - 172.23.0.2 Gateway - 172.23.0.1 Subnet - 172.23.0.0

Ping containers

  • ping API from Prod (RStudio Terminal) e.g. ping 172.23.0.1
  • execute API GET request: -- URL: 172.23.0.4:8797 -- Endpoint: hash_unit
  • result - OK

Use Docker Network Name instead of IP address

The IP address of the network [172.xx.0.y] is always increasing. Every time we will restart docker engine xx value will start from 18... so to insure the right url will be used for GET request we can use the network name which was specified as 'API'. URL for the GET request will be: url <- "API:8797/[endpoint]"

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.