You may start the server locally or using a docker container, the requirements for each setup are listed below.
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.
Export these environment variables:
export KF_PIPELINES_ENDPOINT=0.0.0.0:31380/pipeline
export KF_PIPELINES_NAMESPACE=deployments
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=
(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:5.7
Build a docker image that launches the API server:
docker build -t platiagro/pipelines:0.2.0 .
Finally, start the API server:
docker run -it -p 8080:8080 \
--name pipelines \
platiagro/pipelines:0.2.0
Export these environment variables:
export KF_PIPELINES_ENDPOINT=0.0.0.0:31380/pipeline
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=
(Optional) Create a virtualenv:
virtualenv -p python3 venv
. venv/bin/activate
Install Python modules:
pip install .
Then, start the API server:
python -m pipelines.api.main
Install the testing requirements:
pip install .[testing]
Use the following command to run all tests:
pytest
Use the following command to run lint:
flake8
See the PlatIAgro Pipelines API doc for API specification.