{"id":18368691,"url":"https://github.com/radanalyticsio/tutorial-sparkpi-scala-scalatra","last_synced_at":"2025-04-10T19:38:24.513Z","repository":{"id":72027279,"uuid":"140650266","full_name":"radanalyticsio/tutorial-sparkpi-scala-scalatra","owner":"radanalyticsio","description":"SparkPI Implemented on the Scalatra framework.","archived":false,"fork":false,"pushed_at":"2018-07-26T20:50:31.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T20:53:10.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radanalyticsio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-12T02:28:02.000Z","updated_at":"2018-09-24T17:12:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0765948-9f06-4921-aad0-6d5007bf0086","html_url":"https://github.com/radanalyticsio/tutorial-sparkpi-scala-scalatra","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radanalyticsio%2Ftutorial-sparkpi-scala-scalatra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radanalyticsio%2Ftutorial-sparkpi-scala-scalatra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radanalyticsio%2Ftutorial-sparkpi-scala-scalatra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radanalyticsio%2Ftutorial-sparkpi-scala-scalatra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radanalyticsio","download_url":"https://codeload.github.com/radanalyticsio/tutorial-sparkpi-scala-scalatra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281427,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:27:05.218Z","updated_at":"2025-04-10T19:38:24.484Z","avatar_url":"https://github.com/radanalyticsio.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My First Radanalytics App - Scala with Scalatra\nThis application exposes a simple web service that servers (GET) requests that will use Apache Spark to rougly calculate the value of π. This code is based on the [Spark PI Example](https://github.com/apache/spark/blob/master/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala) that is distributed with the Spark project. It is a tutorial application to show how to get started using Scala with the [Radanalytics platform](https://radanalytics.io), and is intended to be deployed to Openshift.\n\nIn addition to demonstrating how to deploy a simple Scala microservice to Openshift, it also contains examples of how to unit test Spark jobs using the [Spark Testing Base](https://github.com/holdenk/spark-testing-base) project.\n\n## Quick start\nIt is a prerequesite that you have an Openshift cluster running and are logged in with the `oc` command line tool.\n\n1. Setup the project and import the [Radanalytics](http://radanalytics.io) resources\n   ```bash\n   oc new-project oshinko\n   oc create -f https://radanalytics.io/resources.yaml\n   oc new-app oshinko-webui\n   ```\n\n2. Create an Apache Spark Cluster\n    * Go to the Oshinko WebUI you installed on Openshift. From the Oshinko console, choose 'Deploy' and create an Apache Spark cluster named 'spark'\n\n3. Deploy the Application\n   ```bash\n   oc new-app --template oshinko-scala-spark-build-dc \\\n    -p APPLICATION_NAME=tutorial-sparkpi-scala-scalatra \\\n    -p GIT_URI=https://github.com/reynoldsm88/tutorial-sparkpi-scala-scalatra \\\n    -p APP_MAIN_CLASS=io.radanalytics.examples.scalatra.sparkpi.Main \\\n    -p APP_FILE=tutorial-sparkpi-scala-scalatra-assembly-0.0.1-SNAPSHOT.jar \\\n    -p SBT_ARGS=\"clean assembly\" \\\n    -p APP_ARGS=\"-Xms1024M, -Xmx2048M, -XX:MaxMetaspace=1024M\" \\\n    -p OSHINKO_CLUSTER_NAME=\"spark\"\n   ```\n\n4. Expose the Route\n   ```bash\n   oc expose svc/tutorial-sparkpi-scala-scalatra\n   ```\n\n5. Check that the service is running and can perform calculations\n   ```bash\n   URL=\"http://$(oc get route tutorial-sparkpi-scala-scalatra | grep tutorial-sparkpi-scala-scalatra | awk '{print $2}')/sparkpi\"\n   curl $URL\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradanalyticsio%2Ftutorial-sparkpi-scala-scalatra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradanalyticsio%2Ftutorial-sparkpi-scala-scalatra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradanalyticsio%2Ftutorial-sparkpi-scala-scalatra/lists"}