Leafwell Description

Leafwell is apps for herbal identification through images, this is the part of the project as web api to deliver data to mobile apps.

Database schema

database

Dev ENV

  • Python 3.6
  • SQLite/MySQL
  • Ubuntu

Setting up for local development

Install virtualenv

sudo apt-get install python3-pip
sudo pip3 install virtualenv 

Create virtualenv

python3 -m venv venv

Activate virtualenv

source venv/bin/activate

Install Dependecies

pip3 install --upgrade pip
pip3 install -r requirements.txt

Setting DB

  • Copy .env.example to .env
  • Fill the right config on .env

Setting FLASK ENV

export FLASK_APP=main.py

Migrate DB

flask db init
flask db migrate
flask db upgrade

Seed Data

flask seed-data

Run on local

flask run

Deploy on Production

  • Configure serverless VPC, link
  • Create Cloud SQL, and connect them to serverless VPC
  • Deploy the image using cloud builds and cloud run
git clone https://github.com/sahalaww/bangjek-web
cd bangjek-web
cp .env.example .env
gcloud builds submit --tag gcr.io/$PROJECT_ID/$IMAGE_NAME:$version
gcloud run deploy $SERVICE_NAME --image $IMAGE_URL --region $REGION 

Setup CI/CD

You can refer to Cloud Build documentation, link already on reference.

Live Web Apps

https://herb-bangjek-oiabruca3q-et.a.run.app

https://herb.azzic.xyz

API Documentation

You can visit our wiki : link

References

  1. Serverless VPC

  2. Cloud Build

  3. Service Account Problem on CI/CD Cloud Build