Home

Awesome

Last Mile Delivery API

Build Status Get help on Codementor Made in Indonesia

Live Preview

You can use https://last-mile-delivery.herokuapp.com/ for Live Preview, this instance running on free Dyno hours, so please expect error when our database records limit or hours limit reached.

How to run from source

$ cp .env.example .env
PORT=8080 # this is the port we want to expose, if you change this, please look at the `docker-compose.yml` as well
GOOGLE_MAPS_API_KEY= # this is the Google Maps API Key
$ ./start.sh

How to run from packaged Docker image

We've prebuild Docker image stored as mappuji/last-mile-delivery in DockerHub. Where you can run it like this

$ docker-compose -f docker-compose.yml -f docker-compose.prod.yml

This run exactly the same thing with running it from source except we use prebuilt image that already pushed to DockerHub.

Design Documentation

The architectural design of the system can be open at empeje.github.io/last-mile-delivery.

Maintaining Documentation

  1. You can maintain the documentation by adding mermaid-js diagram DSL in the docs/index.html

  2. Upload the GitHub pages using

    $ yarn deploy:docs
    

Development Infrastructure Checklist

MetricsNotesImplemented
Code QualityStandardization and static check using ESLint✓ Yes
Unit TestingUnit level testing for models✓ Yes
Integration TestingIntegration level testing e.g. API✓ Yes
End-to-end TestingBlackbox testing, running real service with real ext. serviceNA
Auto-reload in DevFile watcher that auto reload whenever changes occurs✓ Yes
Continuous Int.Continuous integration using Travis CI for public repository✓ Yes

Production Checklist

MetricsNotesImplemented
CodebaseOne codebase tracked in revision control, many deploys✓ Yes
DependenciesExplicitly declare and isolate dependencies✓ Yes
ConfigStore config in the environment✓ Yes
Backing servicesTreat backing services as attached resources✓ Yes
Build, release, runStrictly separate build and run stages✓ Yes
ProcessesExecute the app as one or more stateless processes✓ Yes
Port bindingExport services via port binding✓ Yes
ConcurrencyScale out via the process model✓ Yes
DisposabilityMaximize robustness with fast startup and graceful shutdown✓ Yes
Dev/prod parityKeep development, staging, and production as similar as possible✓ Yes
LogsTreat logs as event streams✓ Yes
Admin processesRun admin/management tasks as one-off processesNA

Deployment Using Heroku Docker

Update your Heroku CLI

This meant to update your Heroku CLI to support setting up via heroku manifest setup

$ heroku update beta
$ heroku plugins:install @heroku-cli/plugin-manifest

Create your Heroku app

$ heroku create your-app-name --manifest

Create Clear DB add-ons

$ heroku addons:create cleardb:ignite
# command below will return
# CLEARDB_DATABASE_URL: mysql://<username>:<password>@<url>/<database_name>?reconnect=true
$ heroku config | grep CLEARDB_DATABASE_URL # copy the information to config

# Set database configuration
heroku config:set PORT=8080
heroku config:set LOG_FORMAT=simple
heroku config:set SQL_DATABASE=YOUR_HEROKU_DATABASE
heroku config:set SQL_HOST=YOUR_HEROKU_DATABASE_HOST
heroku config:set SQL_PASSWORD=YOUR_HEROKU_DATABASE_PASSWORD
heroku config:set SQL_USERNAME=YOUR_HEROKU_DATABASE_USERNAME
heroku config:set SQL_DIALECT=mysql
heroku config:set SQL_OPERATOR_ALIASES=false
heroku config:set SQL_SEEDER_STORAGE=sequelize
heroku config:set SQL_SEEDER_STORAGE_TABLE_NAME=SequelizeData
heroku config:set GOOGLE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_API_KEY

Deploy your app

$ git push heroku master