Code Monkey home page Code Monkey logo

beta-platform's Introduction

MedTune Platform ~ Beta v0.1.6

/!\ This repository is no longer maintained. MedTune official platform under development

GitHub license GitHub pull-requests GitHub issues GitHub release

Build Status & Coverage

branch Status Quality Coverage
Master CircleCI CodeFactor codecov
Dev CircleCI CodeFactor

Table of content

Overview

MedTune Beta platform is a proof of concept prototype, focused on serving scalable AI solutions, into different types of customers.

Concepts

TODO ASAP

Getting started

1 - Prerequisites

You can compile the binaries your self or use our containers images.

To compile medtune-beta command line you need a Golang Compiler (Tested on 1.11, 1.10 and 1.9)

To run medtune-beta platform side services you will need a container engine/orchestrator (like Docker, Kubernetes).

Database

Medtune Beta runs next to postgres database (if you want to go beyond signup).

Cache

The application cache users sessions on a Redis cache database.

Capsules

Some of MedTune demos might need to setup their correspendent Capsules (server that perform inference computations). Docker or cri-o are enought to make things work, but it requires a lot of handy work. We recommand to use Docker compose or Kubernetes for easier setup.

2 - Configuration

All configurations needed are well commented in config.yaml

3 - Deploy

Once capsules are set (or not), you can build MedTune Beta Platform and use it localy:

Using Golang compiler
# Set your $GOPATH
# Make sure your working directory is $GOPATH/src/github.com/medtune

# Clone project
git clone https://github.com/medtune/beta-platform && cd beta-platform

# Fast run
make run

# Compile for current OS/ARCH 
# Use GOOS=X GOARCH=Y if you are compiling for other platforms
make release
# make release-cmd
# make release-dev
# make release-debug
# make release-linux

# Run server
medtune-beta start
Using Docker engine
# build alpine based image
make build-alpine # medtune/beta-platform:prod-alpine

# build alpine based image for k8s cluster
make build-k8s # medtune/beta-platform:prod-k8s

# build all images
make build-all

# Run container
docker run \
   --name=beta-platform \
   -p 8005:8005 \
   medtune/beta-platform:latest
Using go command
# Install package
go get -u github.com/medtune/beta-platform/...

# Run server
export $STATIC_PATH=/dir/files/static
medtune-beta run --port=8005 --static=$STATIC_PATH
Using Docker hub
# Pull image
docker pull medtune/beta-platform:TAG # TAG=prod | prod-alpine | prod-k8s | latest

# Run container
docker run --name=beta-platform -p 8005:8005 medtune/beta-platform:TAG
Using Docker compose
# Create docker swarm
docker-compose up -d
Using kubernetes
# Create deployment
kubectl create -f deployments/kubernetes/

# Generate kubernetes configuration from docker-compose.yaml
make gen-k8s

Development utils

CICD

See .circleci/config.yaml for more informations about CI/CD setup

Testing
# Unit tests
make tests

# racing & coverage tests
make test-cov
Generating kubernetes deployment yaml files
# Generate kubernetes configuration from docker-compose.yaml
make gen-k8s
Cleaning demo files
# Clean all demos static images
make clean-demos
Scene debuging (capsules)
# Makesure your docker engine is connected to medtune hub
make start-scene

# Stop all capsules containers
make stop-scene

# Kill all capsules containers
make kill-scene

Command line

You can find medtune-beta command line docs at ./cmd

Changelog

See CHANGELOG.md

Contributing

For contributions please refer to our friendly code of conduct in how-we-work repository ๐Ÿ˜„.

Maintainers

See MAINTAINERS

License

Medtune Beta Platform is released under the Apache 2.0 license. See LICENSE.txt.

TODO

  • End2End Tests
  • pprof

beta-platform's People

Contributors

a-hilaly avatar aelbouchti avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

beta-platform's Issues

Session package and initpkg

Actually session functions are written at server/middleware, normally we should keep only the middleware functions, and move other logic to pkg/session

Initpkg production and debug mode

pkg/Inits is responsible for initialising all necessary packages that are used by the server.

We need two different modes for running inits: Debug and Production. Debug mode should allow skipping some initialisations while Production mode need to panic() whenever something is going wrong at startup.

Models logic implementations

For example for user model we can have functions that directly handles users authentication /creation etc ... same for all other models

Capsule's client

Before diving into Capsules project, we could create a simple client that will handle inference and look ups on Tensorflow freezed models.
Keep in mind that gRPC is required also TensorflowServing signatures

Data validation package

at pkg/validator we need a certain API for validating data objects all sort of uploaded images/videos/archives etc
Keep in mind extensions aren't enough for validating files. Reading headers is the right way.

Debug web site for dev support

Separating application logic from the user interface, in order to accelerate design developpement and isolate business components.

go run main.go --debug to show-up all compiled templates would be awesome

Cobra CLI support

Needed command line formats:

Startup pre check

medtune-beta start

Run server

medtune-beta start --port=8080 --debug=true

Get version

medtune-beta version

Sync models

medtune-beta sync-db

Login middleware

Instead of handling session logic at each route , it would be easier to set a middleware for all private content:
Something like this example works but only if we abort connection.

import (
	"github.com/gin-contrib/sessions"
	"github.com/gin-gonic/gin"
)

func LoggedOnly() gin.HandlerFunc {
	return func(c *gin.Context) {
		s := sessions.Default(c)
		if v := s.Get("logged"); v == nil || !v.(bool) {
			c.AbortWithStatus(404)
			return
		}
	}
}

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.