Code Monkey home page Code Monkey logo

projects's Introduction

PlatIAgro Projects

Build Status Quality Gate Status License

Requirements

You may start the server locally or using a docker container, the requirements for each setup are listed below.

Local

Docker

Quick Start

Make sure you have all requirements installed on your computer. Then, you may start the server using either a Docker container or in your local machine.

Run using Docker

Export these environment variables:

export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
export MYSQL_DB_HOST=mysql
export MYSQL_DB_NAME=platiagro
export MYSQL_DB_USER=root
export MYSQL_DB_PASSWORD=
export JUPYTER_ENDPOINT=http://localhost:8888
export KF_PIPELINES_ENDPOINT=127.0.0.1:31380/pipeline
export KF_PIPELINES_NAMESPACE=anonymous

(Optional) Start a MinIO instance:

docker run -d -p 9000:9000 \
  --name minio \
  --env "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
  --env "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
  minio/minio:RELEASE.2018-02-09T22-40-05Z \
  server /data

(Optional) Start a MySQL server instance:

docker run -d -p 3306:3306 \
  --name mysql \
  --env "MYSQL_DATABASE=$MYSQL_DB_NAME" \
  --env "MYSQL_ROOT_PASSWORD=$MYSQL_DB_PASSWORD" \
  --env "MYSQL_ALLOW_EMPTY_PASSWORD=yes" \
  mysql:8.0.3

(Optional) Start a Jupyter Notebook instance:

docker run -d -p 8888:8888 \
  --name jupyter \
  jupyter/base-notebook \
  start-notebook.sh --NotebookApp.token=''

Then, build a docker image that launches the API server:

docker build -t platiagro/projects:0.2.0 .

Finally, start the API server:

docker run -it -p 8080:8080 \
  --name projects \
  --env "MINIO_ENDPOINT=$MINIO_ENDPOINT" \
  --env "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
  --env "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
  --env "MYSQL_DB_HOST=$MYSQL_DB_HOST" \
  --env "MYSQL_DB_NAME=$MYSQL_DB_NAME" \
  --env "MYSQL_DB_USER=$MYSQL_DB_USER" \
  --env "MYSQL_DB_PASSWORD=$MYSQL_DB_PASSWORD" \
  --env "JUPYTER_ENDPOINT=$JUPYTER_ENDPOINT" \
  platiagro/projects:0.2.0

Run Local:

Export these environment variables:

export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
export MYSQL_DB_HOST=localhost
export MYSQL_DB_NAME=platiagro
export MYSQL_DB_USER=root
export MYSQL_DB_PASSWORD=
export JUPYTER_ENDPOINT=http://localhost:8888
export KF_PIPELINES_ENDPOINT=127.0.0.1:31380/pipeline
export KF_PIPELINES_NAMESPACE=anonymous

(Optional) Create a virtualenv:

virtualenv -p python3 venv
. venv/bin/activate

Install Python modules:

pip install .

(Optional) Initialize database:

platiagro-init-db

Then, start the API server:

python -m projects.api.main

Testing

Install the testing requirements:

pip install .[testing]

Export these environment variables:

export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
export MYSQL_DB_HOST=localhost
export MYSQL_DB_NAME=platiagro
export MYSQL_DB_USER=root
export MYSQL_DB_PASSWORD=
export JUPYTER_ENDPOINT=http://localhost:8888
export KF_PIPELINES_ENDPOINT=localhost:5000
export KF_PIPELINES_NAMESPACE=anonymous

Use the following command to run all tests:

pytest

Use the following command to run lint:

flake8 --max-line-length 127 projects/

API

See the PlatIAgro Projects API doc for API specification.

projects's People

Contributors

fberanizo avatar shiguemi32 avatar miguelfferraz avatar samborba avatar lucaslzl avatar alendegeraldo avatar gvechini avatar mmaioli avatar cedric-matheus avatar lborro avatar andreiauratsuka avatar snyk-bot avatar

Watchers

James Cloos avatar

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.