DEPRECATED: This app is being sunset in favor of the logistics-wizard application
Supply Chain Weather is a sample Bluemix application which utilizes the Insights for Weather service and two mapping APIs, Leaflet and Esri Leaflet to dynamically create and augment shipments for a retail chain store's supply chain.
The easiest way to deploy the app is to click the Deploy to Bluemix
button above, but here you will find the instructions on manually deploying the application.
If you do not already have a Bluemix account, sign up here
Download and install the Cloud Foundry CLI tool
Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/IBM-Bluemix/supply-chain-weather.git
cd
into this newly created directory
Open the manifest.yml
file and change the host
value to something unique.
The host you choose will determinate the subdomain of your application's URL: <host>.mybluemix.net
Connect to Bluemix in the command line tool and follow the prompts to log in.
$ cf api https://api.ng.bluemix.net
$ cf login
Create the Weather Channel service in Bluemix.
$ cf create-service weatherinsights Free supply-chain-weather-insights
Create the Cloudant service in Bluemix.
$ cf create-service cloudantNoSQLDB Shared supply-chain-datastore
Push the app to Bluemix.
$ cf push
If you do not already have a Bluemix account, sign up here
If you have not already, download node.js and install it on your local machine.
Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/IBM-Bluemix/supply-chain-weather.git
cd
into this newly created directory
Install the required npm and bower packages using the following command
npm install
Create an instance of both the Weather Channel service and the Cloudant service using your Bluemix account. Once you have these services, replace the corresponding credentials in your vcap-local.json
file
Start your app locally with the following command
npm run watch
This command will trigger cake
to build and start your application. When your app has started, your console will print that your server started on: http://localhost:6020
.
Since we are using cake
, the app is rebuilt continuously as changes are made to the local file system. Therefore, you do not have to constantly stop and restart your app as you develop locally. Execute npm run cake
to see the other commands available in the Cakefile
.
Happy developing!
Current Conditions
Description: Retrieve the current conditions at the input coordinates
Example: GET /api/v1/currentConditions?latitude=32.36&longitude=-86.27&units=e
Forecasted Conditions
Description: Retrieve the 10 day forecast at the input coordinates
Example: GET /api/v1/forecastedConditions?latitude=32.36&longitude=-86.27&units=e
Distribution Centers
Description: Retrieve a list of all the distribution centers
Retrieve Example: GET /api/v1/db/distribution
Retail Locations
Description: Retrieve a list of all the retail locations
Retrieve Example: GET /api/v1/db/retail
Shipments
Description: Retrieve a list of all the shipments
Create Example: POST /api/v1/db/shipments
with payload:
{
"_id": "S9",
"type": "shipment",
"service": "ground",
"desc": "This is a sample shipment description",
"distribution": "D3",
"retail": "R4",
"status": "pending",
"curLoc": "Charleston, South Carolina, US",
"curLat": 32.780891,
"curLon": -79.93471,
"estDel": "Thu, 24 Oct 2015",
"lastUpdate": "Thu, 24 Oct 2015 12:15:37 GMT",
"items": [
{
"item": "I1",
"quantity": 85
},
{
"item": "I2",
"quantity": 100
}
]
}
Retrieve Example: GET /api/v1/db/shipments
Items
Description: Retrieve a list of all the items
Retrieve Example: GET /api/v1/db/items
Shipment Notification
Description: Notifies the store manager than a new shipment has been created
Example: GET /api/v1/db/shipments/notify?shipment=S7&environment=dev
Shipment Status Update
Description: Change the status of a shipment based on a manager response
Example: GET /api/v1/db/shipments/status?shipment=S7&status=accepted&environment=dev
The primary source of debugging information for your Bluemix app is the logs. To see them, run the following command using the Cloud Foundry CLI:
$ cf logs supply-chain-weather --recent
For more detailed information on troubleshooting your application, see the Troubleshooting section in the Bluemix documentation.
We are more than happy to accept external contributions to this project, be it in the form of issues and pull requests. If you find a bug, please report it via the Issues section or even better, fork the project and submit a pull request with your fix! Pull requests will be evaulated on an individual basis based on value add to the sample application.
The supply-chain-weather sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:
This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.
Deployment tracking can be disabled by removing require("cf-deployment-tracker-client").track();
from the beginning of the app.js
file.