Skip to content

Commit

Permalink
Release v0.1.6 (#68)
Browse files Browse the repository at this point in the history
* remove debug db

* Go mod tidy & clean

* Update repo & build steps + freeze warnings

* upgrade etc/ versions

* Fix etc conflicts

* Secrets as argument

* Fix container entrypoint
  • Loading branch information
a-hilaly authored Dec 13, 2018
1 parent 7c3faad commit 6b2b7d4
Show file tree
Hide file tree
Showing 79 changed files with 695 additions and 461 deletions.
Binary file removed CXPBA.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions MAINTAINERS.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<[email protected]> HILALY Mohammed-Amine
<[email protected]> ELBOUCHTI Alaa
<[email protected]> HILALY Mohammed-Amine
<[email protected]> ELBOUCHTI Alaa
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GITCOMMIT=$(shell git rev-parse HEAD)
BUILDDATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
MAJOR=0
MINOR=1
PATCH=5
PATCH=6
REVISION=alpha
VERSION=v$(MAJOR).$(MINOR).$(PATCH)
GOVERSION=1.11
Expand All @@ -14,6 +14,7 @@ CWD=$(shell pwd)
VPATH=github.com/medtune/beta-platform/internal
PROJECTPATH=$(CWD)
AUTHORS=El.bouchti.Alaa/Hilaly.Mohammed-Amine
OWNERS=$(AUTHORS)
LICENSETYPE=Apache-v2.0
LICENSEURL=https://raw.githubusercontent.com/medtune/beta-platform/master/LICENSE.txt

Expand Down Expand Up @@ -203,7 +204,7 @@ push-image:

gen-k8s:
rm -rf deploy/kubernetes/*
kompose convert -f docker-compose.k8s.yml -o deploy/kubernetes
kompose convert -f deployments/docker-compose.k8s-gen.yml -o deployments/k8s-generated

# Test package
tests:
Expand Down Expand Up @@ -337,7 +338,7 @@ kill-capsules:

start:
./medtune-beta start \
-f dev.config.yml \
-f etc/dev.config.yml \
--syncdb \
--create-users \
--sync-cxpba \
Expand All @@ -352,7 +353,7 @@ run:
-tags=gocv \
./cmd/main.go \
start \
-f dev.config.yml \
-f etc/dev.config.yml \
--syncdb \
--sync-cxpba \
--create-users \
Expand All @@ -375,7 +376,7 @@ clean-gen:


clean-demos:
rm -f static/demos/mura/images/*_mn_v2_cam.png
rm -f static/demos/mura/images/*_mn_v2_cam.*
rm -f static/demos/mura/images/[^image_*]*

rm -f static/demos/chexray/images/[^debug.png][^image_*]*
Expand Down
130 changes: 102 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# MedTune Platform ~ Beta v0.1.5
# MedTune Platform ~ Beta v0.1.6

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

[![GitHub license](https://img.shields.io/github/license/medtune/beta-platform.svg)](https://github.com/medtune/beta-platform/blob/iron-master/LICENSE.txt) [![GitHub pull-requests](https://img.shields.io/github/issues-pr/medtune/beta-platform.svg)](https://GitHub.com/medtune/beta-platform/pull/) [![GitHub issues](https://img.shields.io/github/issues/medtune/beta-platform.svg)](https://github.com/medtune/beta-platform/issues) [![GitHub release](https://img.shields.io/github/release/medtune/beta-platform.svg)](https://GitHub.com/medtune/beta-platform/releases)

## Build Status & Coverage

| branch | Status | C.C | C.Q |
| branch | Status | Quality | Coverage |
| --- | --- | --- | --- |
| Master | [![CircleCI](https://circleci.com/gh/medtune/beta-platform/tree/master.svg?style=svg)](https://circleci.com/gh/medtune/beta-platform/tree/master) | [![CodeFactor](https://www.codefactor.io/repository/github/medtune/beta-platform/badge)](https://www.codefactor.io/repository/github/medtune/beta-platform) | [![codecov](https://codecov.io/gh/medtune/beta-platform/branch/master/graph/badge.svg)](https://codecov.io/gh/medtune/beta-platform) |
| Dev | [![CircleCI](https://circleci.com/gh/medtune/beta-platform/tree/dev.svg?style=svg)](https://circleci.com/gh/medtune/beta-platform/tree/dev) | [![CodeFactor](https://www.codefactor.io/repository/github/medtune/beta-platform/badge/dev)](https://www.codefactor.io/repository/github/medtune/beta-platform/overview/dev) | |
Expand All @@ -17,10 +19,6 @@
- [2. Table of content](#table-of-content)
- [3. Overview](#overview)
- [4. Concepts](#concepts)
- [1. Platform](#platform)
- [2. Capsules](#capsules)
- [3. Architecture](#architecture)
- [4. Service Discovery](#service-discovery)
- [5. Getting started](#getting-started)
- [1. Prerequisites](#1-prerequisites)
- [2. Configuration](#2-configuration)
Expand All @@ -41,7 +39,8 @@
- [7. Change log](#changelog)
- [8. Contributing](#contributing)
- [9. Maintainers](#maintainers)
- [10. License](#License)
- [10. License](#license)
- [11. Todo](#todo)

### Overview

Expand All @@ -55,16 +54,23 @@ MedTune Beta platform is a _proof of concept_ prototype, focused on serving scal

##### 1 - Prerequisites

To use medtune-beta command line you need a Golang Compiler (Tested on 1.10 and 1.9)
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 services localy you will need a container engine/orchestrator (like Docker swarm, Kubernetes).
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 some Capsules. [Docker](https://github.com/moby/moby) or [cri-o](https://github.com/kubernetes/cri-o) are enought to make things work, but it requires a lot of handy work. We recommand to use [Swarm](#using-swarm) or [Kubernetes](#kubernetes) for easier setup.
Some of MedTune demos might need to setup their correspendent Capsules (server that perform inference computations). [Docker](https://github.com/moby/moby) or [cri-o](https://github.com/kubernetes/cri-o) are enought to make things work, but it requires a lot of handy work. We recommand to use [Docker compose](#using-docker-compose) or [Kubernetes](#kubernetes) for easier setup.


##### 2 - Configuration
Expand All @@ -84,58 +90,121 @@ Once capsules are set (or not), you can build MedTune Beta Platform and use it l
# Clone project
git clone https://github.com/medtune/beta-platform && cd beta-platform

# Fast run
make run

# Compile for current OS/ARCH
# Use GOOS=linux GOARCH=amd if you are compiling for other platforms
go build -o medtune-beta ./cmd/medtune-beta/main.go
# 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 go get (GOGUETTE)
###### Using Docker engine

```shell
# Install package
go get -u github.com/medtune/beta-platform/

# Run server
medtune-beta run --port=8005 --static=$GOPATH/src/github.com/medtune/beta-platform/static
# 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 Docker engine
###### Using go command

```shell
# Build image
docker build -t . medtune-beta:iron
# Install package
go get -u github.com/medtune/beta-platform/...

# Run container
docker run --name=beta-platform -p 8005:8005 medtune/beta-platform:latest
# Run server
export $STATIC_PATH=/dir/files/static
medtune-beta run --port=8005 --static=$STATIC_PATH
```


###### Using Docker hub

```shell
# Pull image
docker pull medtune/beta-platform:latest
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:latest
docker run --name=beta-platform -p 8005:8005 medtune/beta-platform:TAG
```

###### Using Docker compose

```shell
# Create docker swarm
docker-compose up -d
```

###### Using kubernetes

```shell
# Create deployment
kubectl create -f deploy/kubernetes.yaml
kubectl create -f deployments/kubernetes/

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

###### Using swarm
### Development utils

###### CICD

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

###### Testing

```shell
# Create docker swarm
docker-compose up -d
# Unit tests
make tests

# racing & coverage tests
make test-cov
```

###### Generating kubernetes deployment yaml files

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

###### Cleaning demo files

```shell
# Clean all demos static images
make clean-demos
```

###### Scene debuging (capsules)

```shell
# 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
Expand All @@ -157,3 +226,8 @@ See [MAINTAINERS](MAINTAINERS.txt)
### License

Medtune Beta Platform is released under the Apache 2.0 license. See [LICENSE.txt](LICENSE.txt).

#### TODO

- End2End Tests
- pprof
4 changes: 2 additions & 2 deletions build/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ADD Makefile .
ADD MAINTAINERS.txt .
ADD LICENSE.txt .

ADD config.yml .
ADD CXPBA.xlsx .
ADD etc/config.yml .
ADD assets/CXPBA.xlsx .

ADD .codecov.yml .
ADD .circleci .circleci
Expand Down
4 changes: 2 additions & 2 deletions build/prod.k8s.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN rm -rf vendor cmd pkg server
# Port to expose
EXPOSE 8005

ADD config.k8s.yml .
ADD etc/config.k8s.yml .

# please precise -v $CONFIGPATH:/medtune/beta-platform/deploy
ENTRYPOINT [ "./medtune-beta",\
Expand All @@ -14,5 +14,5 @@ ENTRYPOINT [ "./medtune-beta",\
"--syncdb",\
"--sync-cxpba",\
"--wait",\
"--create-users"]
"--create-users" ]

4 changes: 2 additions & 2 deletions build/prod.linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ WORKDIR /mdtn

ADD medtune-beta .
ADD static static
ADD config.yml config.yml
ADD CXPBA.xlsx CXPBA.xlsx
ADD etc/config.yml config.yml
ADD assets/CXPBA.xlsx CXPBA.xlsx

RUN chmod +x medtune-beta

Expand Down
8 changes: 8 additions & 0 deletions cmd/start/server_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package start
import (
"fmt"
"log"
"strings"
"time"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -48,6 +49,7 @@ var (
cxpbaSync bool
cxpbaFile string
soft bool
secrets string
)

func init() {
Expand All @@ -63,6 +65,7 @@ func init() {
startCmd.Flags().BoolVarP(&wait, "wait", "w", false, "Wait all services to go up")
startCmd.Flags().IntVarP(&maxattempts, "wait-attempts", "c", 60, "Wait max attempts")
startCmd.Flags().IntVarP(&timestamp, "wait-timestamp", "t", 1, "Wait timestamp")
startCmd.Flags().StringVarP(&secrets, "secrets", "u", "", "secrets strings")

startCmd.Flags().BoolVarP(&cxpbaSync, "sync-cxpba", "X", false, "Sync CXBPA before start")
startCmd.Flags().StringVarP(&cxpbaFile, "cxpba-file", "F", "./CXPBA.xlsx", "CXPBA excel file name")
Expand Down Expand Up @@ -99,6 +102,11 @@ func runServer() {
log.Fatalf("failed to load configuration: %v\n\t%v\n", err, configFile)
}

if secrets != "" {
secretsList := strings.Split(secrets, ",")
configuration.Secrets.Signup = secretsList
}

// Init packages
if err := initpkg.InitFromConfig(configuration); err != nil && !soft {
log.Fatalf("failed to initialize packages: %v\n\t%v\n\t%v\n", err, configFile, configuration)
Expand Down
Loading

0 comments on commit 6b2b7d4

Please sign in to comment.