You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Use the procedures in the following sections to run the project on AWS Elastic B
9
9
Create a Java 8 SE environment in Elastic Beanstalk to host the application.
10
10
11
11
*To create an Elastic Beanstalk environment running the Java 8 SE platform*
12
+
12
13
1. Open the AWS Elastic Beanstalk Management Console with this preconfigured link: [console.aws.amazon.com/elasticbeanstalk/#/newApplication?applicationName=scorekeep...](https://console.aws.amazon.com/elasticbeanstalk/#/newApplication?applicationName=scorekeep&solutionStackName=Java)
13
14
2. Click **Create application** to create an application with an environment running the Java 8 SE platform.
14
15
3. When your environment is ready, the console redirects you to the environment Dashboard.
@@ -18,6 +19,7 @@ Create a Java 8 SE environment in Elastic Beanstalk to host the application.
18
19
When the Scorekeep API runs in AWS Elastic Beanstalk, it uses the permissions of its EC2 instance to call AWS. Elastic Beanstalk provides a default instance profile that you can extend to grant the application the permissions it needs to read from and write to resource tables in DynamoDB.
19
20
20
21
*To add DynamoDB permissions to the instances in your Elastic Beanstalk environment*
22
+
21
23
1. Open the Elastic Beanstalk instance profile in the IAM console: [aws-elasticbeanstalk-ec2-role](https://console.aws.amazon.com/iam/home#roles/aws-elasticbeanstalk-ec2-role)
22
24
2. Click **Attach Policy**.
23
25
3. Select [AmazonDynamoDBFullAccess](https://console.aws.amazon.com/iam/home#policies/arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess) and click **Attach Policy**.
@@ -26,6 +28,7 @@ When the Scorekeep API runs in AWS Elastic Beanstalk, it uses the permissions of
26
28
Deploy the source code for the project to your Elastic Beanstalk environment.
27
29
28
30
*To deploy the source code*
31
+
29
32
1. Download the source bundle: [eb-java-scorekeep-v1.zip](https://github.com/awslabs/eb-java-scorekeep/releases/download/v1.1/eb-java-scorekeep-v1.zip)
30
33
2. Open the [Elastic Beanstalk Management Console](console.aws.amazon.com/elasticbeanstalk/home).
31
34
3. Click your environment's name to open the Dashboard.
@@ -83,6 +86,7 @@ Open the app in a browser: [localhost:8080](http://localhost:8080)
83
86
The app loads but can't hit the API, because it's trying to call paths relative to it's own root, `localhost:8080`, but the API is running on `localhost:5000` (or in Elastic Beanstalk). To fix this, configure the app with the full URL of the API.
84
87
85
88
*To configure the web app with an absolute path to the API*
89
+
86
90
1. Open [eb-java-scorekeep/public/app/scorekeep.js](https://github.com/awslabs/eb-java-scorekeep/blob/master/public/app/scorekeep.js).
87
91
2. Set the value of the api module to the full URL of the API.
88
92
* Use the domain name of your environment to test changes to the frontend without running the backend locally
@@ -117,6 +121,7 @@ This lets requests originating from a frontend hosted locally on port 8080 to se
117
121
When you run both the API and frontend in the same Elastic Beanstalk environment, CORS is not required because the scripts that contact the API and the API itself are hosted on the same domain. If you want to run the frontend on a different port locally, or even host it on a completely different domain, add an allowed origin to the filter to whitelist it in the API.
118
122
119
123
*To extend the CORS configuration to allow cross-origin requests from specific domains*
124
+
120
125
1. Open [src/main/java/scorekeepSimpleCORSFilter.java](https://github.com/awslabs/eb-java-scorekeep/blob/master/src/main/java/scorekeep/SimpleCORSFilter.java)
121
126
2. Add an allowed origin with the URL serving the frontend.
0 commit comments