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
+8-47Lines changed: 8 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,7 @@
1
1
# Scorekeep
2
2
Scorekeep is a RESTful web API implemented in Java that uses Spring to provide an HTTP interface for creating and managing game sessions and users. This project includes the Scorekeep API and a front-end web app that consumes it. The front end and API can run on the same server and domain or separately, with the API running in Elastic Beanstalk and the front end served statically by a CDN.
3
3
4
-
The `fargate` branch shows the use of Spring, Angular, nginx, the [AWS SDK for Java](http://aws.amazon.com/sdkforjava), [Amazon DynamoDB](http://aws.amazon.com/dynamodb), Gradle, and [AWS ECS Fargate](http://aws.amazon.com/ecs) features that enable you to:
5
-
6
-
- Run both components in the same [Amazon ECS](http://aws.amazon.com/ecs) task definition behind an [Amazon Application Load Balancer](https://aws.amazon.com/elasticloadbalancing/)
7
-
- Create required DynamoDB and [Amazon SNS](http://aws.amazon.com/sns) resources through Cloudformation
8
-
- Publishes container logs to [Amazon Cloudwatch Logs](https://aws.amazon.com/cloudwatch)
4
+
The `ecs` branch shows how to deploy the application to Amazon Elastic Container Service (ECS) using AWS Elastic Beanstalk. It includes scripts for making Docker images of the frontend and API components, uploading the images to Amazon Elastic Container Registry (ECR), and generating a task definition.
9
5
10
6
Other branches extend the application's functionality and show the use of other AWS services. See the readme in each branch for details about the integration and instructions for use.
11
7
@@ -21,7 +17,7 @@ Other branches extend the application's functionality and show the use of other
21
17
-[`xray-gettingstarted`](https://github.com/awslabs/eb-java-scorekeep/tree/xray-gettingstarted) ([tutorial](https://docs.aws.amazon.com/xray/latest/devguide/xray-gettingstarted.html)) - Use the AWS X-Ray SDK for Java to instrument incoming requests and SDK clients (no additional configuration required).
22
18
-[`xray-worker`](https://github.com/awslabs/eb-java-scorekeep/tree/xray-worker) - Instrumented Python Lambda worker function from the `lambda-worker` branch.
23
19
24
-
Use the procedures in the following sections to run the project on Fargate and configure it for local testing and development.
20
+
Use the procedures in the following sections to run the project on ECS and configure it for local testing and development.
25
21
26
22
**Sections**
27
23
-[Prerequisites](#prerequisites)
@@ -71,42 +67,7 @@ The Java application is built using the gradle Docker container so it does not r
71
67
2. Build and Publish your API container to the ECR repository created by Cloudformation executing `make publish` in the root folder
72
68
3. Build and Publish your Frontend container to the ECR repository created by Cloudformation executing `make publish` in the `scorekeep-frontend/` folder
73
69
4. Populate your Task Definition with the correct region and account id using the `generate-task-definition` script in the `task-definition` folder
74
-
5. Register your Task Definition to ECS with `aws ecs register-task-definition --cli-input-json file://scorekeep-task-definition.json`
75
-
6. Launch your Service or Task using the AWS CLI, ECS CLI, or AWS Management Console
76
-
77
-
To create a Fargate Service for Scorekeep with the ECS console
78
-
79
-
1. Open [the ECS console](https://console.aws.amazon.com/ecs/home).
80
-
2. Click **Create cluster**.
81
-
3. Select **Networking only** and click **Next step**.
82
-
4. Enter *scorekeep-cluster* for the cluster name and click **Create**.
83
-
5. Choose **View cluster**.
84
-
6. Under **Services**, click **Create**.
85
-
7. Create a service with the following settings. Click **Next Step** to proceed through each page as necessary.
- Container name: **scorekeep-frontend** (click **Add to load balancer**)
101
-
- Listener port: **80:HTTP**
102
-
- Target group name: **Create new**
103
-
- Path pattern: /*
104
-
- Health check pattern: /
105
-
- Service auto scaling: **Do not adjust**
106
-
8. Choose **View service**.
107
-
9. Open the [load balancers screen](https://console.aws.amazon.com/ec2/v2/home#LoadBalancers:) in the EC2 console.
108
-
10. Choose **scorekeep-lb**.
109
-
11. Under **Description**, copy the **DNS name** and open it.
70
+
5. Deploy the `Dockerrun.aws.json` file to a Multicontainer Docker Elastic Beanstalk Environment.
110
71
111
72

112
73
@@ -118,14 +79,14 @@ The API uses SNS to send a notification email when a game ends. To enable e-mail
118
79
# How it works
119
80
120
81
## Backend
121
-
The API runs at paths under /api that provide access to user, session, game, state, and move resources stored as JSON documents in DynamoDB. The API is RESTful, so you can create resources by sending HTTP POST requests to the resource path, for example /api/session. See the [test script](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/bin/test-api.sh) for example requests with cURL.
82
+
The API runs at paths under /api that provide access to user, session, game, state, and move resources stored as JSON documents in DynamoDB. The API is RESTful, so you can create resources by sending HTTP POST requests to the resource path, for example /api/session. See the [test script](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/bin/test-api.sh) for example requests with cURL.
122
83
123
84
The Cloudformation template creates a DynamoDB table for each resource type.
124
85
125
86
## Front end
126
-
The front end is an Angular 1.5 web app that uses `$resource` objects to perform CRUD operations on resources defined by the API. Users first encounter the [main view](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/scorekeep-frontend/public/main.html) and [controller](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/scorekeep-frontend/public/app/mainController.js) and progress through session and game views at routes that include the IDs of resources that the user creates.
87
+
The front end is an Angular 1.5 web app that uses `$resource` objects to perform CRUD operations on resources defined by the API. Users first encounter the [main view](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/scorekeep-frontend/public/main.html) and [controller](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/scorekeep-frontend/public/app/mainController.js) and progress through session and game views at routes that include the IDs of resources that the user creates.
127
88
128
-
The front end is served statically by an Nginx container. The [nginx.conf](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/scorekeep-frontend/nginx.conf) file in the source code sets up Nginx to serve the frontend html pages from root, and forward requests starting with /api to the API backend running on port 5000.
89
+
The front end is served statically by an Nginx container. The [nginx.conf](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/scorekeep-frontend/nginx.conf) file in the source code sets up Nginx to serve the frontend html pages from root, and forward requests starting with /api to the API backend running on port 5000.
129
90
130
91
# Running the project locally
131
92
You can run both the API and front-end locally with Docker
@@ -156,8 +117,8 @@ You can run the frontend container locally by executing `make run-local` from th
156
117
This sample application could be better with your help!
157
118
158
119
- Add a new game!
159
-
- Implement game logic in the game class. See [TicTacToe.java](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/src/main/java/scorekeep/TicTacToe.java).
160
-
- Add the class to [RulesFactory.java](https://github.com/awslabs/eb-java-scorekeep/blob/fargate/src/main/java/scorekeep/RulesFactory.java).
120
+
- Implement game logic in the game class. See [TicTacToe.java](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/src/main/java/scorekeep/TicTacToe.java).
121
+
- Add the class to [RulesFactory.java](https://github.com/awslabs/eb-java-scorekeep/blob/ecs/src/main/java/scorekeep/RulesFactory.java).
0 commit comments