In this code pattern, we will create a Soccer Dashboard for English Premier League. The dashboard is created by web crawling the https://www.premierleague.com/ website. The back end utilizes Akka Actor, the front end is done with ReactJS and the data storage is using IBM Cloudant. And the code is deployed on Cloud Foundry.
- Create actors for Akka
- Expose Akka rest APIs
- Crawler actor will start crawling and store information into DB
- Deploy the app into IBM Cloud Foundry
- Ready for user to interact with the app
- Akka: A reactive stream toolkit
- ReactJS: A JavaScript library for building user interfaces
- Cloudant DB: A highly scalable and performant JSON database service
- Cloud Foundry: An open source, multi cloud application platform as a service project
We will be deploying to Cloud Foundry for exposing the APIs from Akka that connects to the IBM Cloudant Database.
- clone the project using
git clone git@github.com:sanjeevghimire/akka-react-cloudant.git
- Login to IBM Bluemix account, create a IBM cloudant database and save the credentials and add those credentials in
application.conf
inakka-epl/src/main/resources/application.conf
- cd akka-epl
- Run
sbt
followed by commandscompile
andrun
. Make sure you chooseCrawlingApp.scala
as running class. This will crawl https://www.premierleague.com/ website and save data as JSON to IBM cloudant database - In another command line window or tab, run
sbt
followed by commandscompile
andrun
. Make sure you chooseSoccerMainController.scala
as running class - In another command line tab,
cd soccer-epl-ui
and runnpm start
- you can now access the Dashboard in url:
http://locahost:3000
In order to deploy to Cloud Foundry, make sure you have an IBM Bluemix account. And you have to install the following to get started.
- Install Cloud Foundry CLI
- Login to CF using:
cf login --sso
and use one-time password from a given URL to login - Create a fat jar using:
sbt assembly
after going to directory:/akka-epl
- You need to have
manifest.yml
file as in the code repository to push it to the cloud foundry app - You can push the app using command:
cf push
- For Debugging you can see the logs to make sure your app is successfully pushed or not using
cf logs akka-react-cloudant --recent
- you can also ssh to the application machine using command:
cf enable-ssh <app_name>
andcf ssh <app_name>