- Download and Install node.js if you dont have it: https://nodejs.org/en/download/
- Download https://s3-us-west-2.amazonaws.com/sparkdemosite/init-windows-stack.bat
- on command line run: init-windows-stack.bat yourccid
- Last line should read "ServerlessDeploymentBucketName: ..."
- Leave this window open for later use
- Download and Install node.js if you dont have it: https://nodejs.org/en/download/
- Download https://s3-us-west-2.amazonaws.com/sparkdemosite/setup.sh
- On command line run: bash osx.sh yourccid
- Last line should read "ServerlessDeploymentBucketName: ..."
- Leave this window open for later use
- AWS console login: https://spark19.signin.aws.amazon.com/console
- Test website: https://s3-us-west-2.amazonaws.com/sparkdemosite/index.html
- Moodle Course: https://eclass-future-uat.lmc.ualberta.ca/course/view.php?id=52559
- Enrol yourself in a curse as a student: https://eclass-future-uat.lmc.ualberta.ca/course/view.php?id=52560
- Login to https://spark19.signin.aws.amazon.com/console
- See board for credentials
- From region drop-down in top right, select "US West (Oregon)"
- Click Services Drop-down
- Click Lambda
- Click Create Function
- Select Author from scratch
- Type function name in "myFunctionName" text box: spark2019-yourccid
- Runtime: select Node.js 10.x
- Click Permissions drop-down and under Execution role select "Use and existing role"
- In Existing role drop-down: select "lambda_basic_execution"
- Copy contents of index.js from 'https://github.com/ualberta-eclass/spark2019/blob/master/lambda/index.js' and paste into inline editor (index.js)
- Click "Select a test event" drop-down, select "Configure test event"
- Select create new test event with Event name "test"
- Paste contents of 'https://github.com/ualberta-eclass/spark2019/blob/master/lambda/testevent.json' into editor pane.
- Click Create
- Click Test
- Click Details expansion arrow under Execution result
- Save
Click Services Drop-down
- Click API Gateway
- Find your precreated API gateway: dev-[[yourccid]]-spark-stack
- Click that API.
- Action Menu Dropdown select "Create Resource"
- Resource Name: "mylambda"
- Click "Create Resource"
- Action Menu Dropdown select "Create Method"
- Select "GET" and click checkmark
- Select "Lambda Function" for Integration type
- For "Lambda Function" type spark2019-yourccid
- Leave all other settings default
- Save
- When prompted for "Add Permission to Lambda Function", click "Ok"
- Click "Integration Request"
- Expand "Mapping Templates"
- Select "When there are no templates defined"
- Click "Add mapping template"
- type "application/json" and click checkmark
- Select "Generate template" drop-down and select "Method Request passthrough"
- Click Save
- Action Menu -> "Deploy API"
- Select "dev" from "Deployment stage" selection box
- Click "Deploy"
- Under Stages, expand and select "mylambda" and select "GET"
- Click Invoke URL
- Go to [[YourServiceEndpoint]]/public/demo.html
- In text field paste the invoke URL from previous step and click "Send it".
- Open helloworld.js in an editor
- Comment out body: 'Hello World!',
- Uncomment lines below it and save
- run "serverless deploy function --function helloworld --aws-profile spark" in the command line where you ran the init script
- Refresh the hello-world end point in your browser
- Goto eClass course: https://bit.ly/2VX7hSj
- Log in with you ccid if prompted
- Enter "spark" for enrolment key
- You are now an instructor in a course
- on top right of the page click "Turn editting on"
- Click "Add an activity or resource"
- Click "External Tool" in the popup and Click Add
- Enter "yourccid tool sso" for Activity name
- Click "Show more..."
- For Secure Tool Url enter YOUR api end point for ltilogin (e.g. https://your-api-id.execute-api.us-east-1.amazonaws.com/dev/ltilogin)
- Enter "testkey" for Consumer key
- Enter "testsecret" for Shared secret
- Click "Save and display" at the end of the page
- If everthing went OK you should see the messge "Hello Your Name. Here is the authenticated data from eClass" plus all the data from eClass
- This JSON object contains the course you came from, your role etc. Any user in the course can click this link. The page you see is an iframe with your api page embedded.
- Open ltilogin.js in your fav text editor
- Comment out line 22 to 31
- Un-comment 33 to 42 and save
- Deploy updated function with "serverless deploy function --function ltilogin --aws-profile spark"
- Open tokencallback.js in your fav text editor
- Comment out line 17 to 24
- Un-comment 26 to 35 and save
- Deploy updated function with "serverless deploy function --function tokencallback --aws-profile spark"
- Go to "https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logs:"
- Click /aws/lambda/spark2019-yourccid
- Click on Log Stream