Giter Site home page Giter Site logo

almasaeed2010 / tripal4_services_proof-of-concept Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tripal/tripal4_services_proof-of-concept

0.0 3.0 0.0 20.04 MB

Experimental code for a services-driven approach to Tripal 4

PLpgSQL 99.03% Dockerfile 0.42% Python 0.44% Shell 0.11%

tripal4_services_proof-of-concept's Introduction

Tripal 4 Services Proof-of-concept

Docker containers and experimental code for a services-driven approach to Tripal 4.

Stack:

Drupal7/Tripal [PHP] - the traditional PHP based Tripal environment.

postgreSQL - database

Kong - API gateway. Used to establish routes to services so API calls can be made to the same location. Also can be used to manage authentication and authorization on service calls.

Flask [python] - One of many frameworks that exist for creating services.

Nginx - lightweight web server.

Docker - container-based virtualisation to reduce dependence on host setup.

There may well be better stacks, but this will help us explore these elements with the hope of then knowing better how to assess alternatives.

Preliminary steps

  1. Make sure you have at least 8Gb free on your laptop. (This is actually just a guess.)

  2. Install Docker: https://docs.docker.com/v17.12/install. Note that you will need to create a Docker account.

  3. Consider also installing Kitematic for managing docker containers and images, though this can also be done easily on the command. https://kitematic.com

  4. Install the Insomnia REST client: https://insomnia.rest/download/ (or your prefered REST client test app). This will help with testing services.

  5. Clone this repository: $ git clone https://github.com/tripal/Tripal4_services_proof-of-concept.git

This repository contains 3 base containers to get a Tripal services system running on a local machine. You will need all three containers described below.

Launch all three containers before following the service setup instructions in Gateway/README.md.

Tripal3/

Stripped down Docker image of Tripal 3, populated with experimental gene model, marker, germplasm, and organism data. Nginix is the web server. Adminer Postgres client included.

This Docker container uses Alpine Linux and Alpine Linux Package Manager.

$ cd Tripal3/
$ docker-compose build
$ docker-compose up

Test
$ docker ps
  Should see tripal3_web, adminer, and postgres:10-alpine

Enter container shell
$ docker ps   # to get CONTAINER ID
$ docker exec -it [CONTAINER ID] /bin/sh

Tripal is listening to localhost:8888 (user: admin, password:admin)
Adminer is listening to localhost:8080 (user:postgres, password:example)

Services/

Docker image contains Envoy (API gateway), Flask, Python, sample Python web service scripts.

The starter/ Docker container is a barebones setup for running a Python/Flask service.

$ cd Services/starter/

Build the docker containers
$ docker-compose build  

Setup the Network
$ docker network create tripal-kong

Bring up the containers
$ docker-compose up

Test:
$ docker ps
  Should see starter_starter_service
$ curl http://localhost:5000
  Should see "Hello, World!"

To enter container shell:
$ docker ps   # to get CONTAINER ID
$ docker exec -it [CONTAINER ID] /bin/sh

Gateway/

Docker image contains Kong (gateway) + Konga (management gui) and Postgres (required backend)

To Run:

$ cd Gateway/
$ docker-compose up

access on: http://127.0.0.1:8000
admin: http://127.0.0.1:8001

First time running it, the postgres volume needs to populated, so you may need to stop and restart the service once migrations are completed.

Instructions for getting started with Kong and how to create a sample toy service is in README.md in the Gateway/ directory.

Some helpful Docker commands

Copy files in or out of a container:

$ docker cp [image id]:[path] [path]
$ docker cp [path] [image id]:[path] [path]

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.