Skip to content

Commit b1957f5

Browse files
committed
readme
1 parent f5f9fb1 commit b1957f5

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed

README.md

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Scorekeep
22
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.
33

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.
95

106
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.
117

@@ -21,7 +17,7 @@ Other branches extend the application's functionality and show the use of other
2117
- [`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).
2218
- [`xray-worker`](https://github.com/awslabs/eb-java-scorekeep/tree/xray-worker) - Instrumented Python Lambda worker function from the `lambda-worker` branch.
2319

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.
2521

2622
**Sections**
2723
- [Prerequisites](#prerequisites)
@@ -71,42 +67,7 @@ The Java application is built using the gradle Docker container so it does not r
7167
2. Build and Publish your API container to the ECR repository created by Cloudformation executing `make publish` in the root folder
7268
3. Build and Publish your Frontend container to the ECR repository created by Cloudformation executing `make publish` in the `scorekeep-frontend/` folder
7369
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.
86-
- Launch type: **Fargate**
87-
- Task definition: **scorekeep:1**
88-
- Platform version: **latest**
89-
- Cluster: **scorekeep-cluster**
90-
- Service name: **scorekeep-service**
91-
- Number of tasks: **4**
92-
- Minimum healthy percent: **50**
93-
- Maximum percent: **200**
94-
- Cluster VPC: **scorekeep**
95-
- Subnets: both **scorekeep_Private** subnets
96-
- Security groups: click Edit > Select existing > select **default**
97-
- Auto-assign public IP: **enabled**
98-
- Load balancer type: **Application load balancer**
99-
- Load balancer name: **scorekeep-lb**
100-
- 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.
11071

11172
![Scorekeep flow](/img/scorekeep-flow.png)
11273

@@ -118,14 +79,14 @@ The API uses SNS to send a notification email when a game ends. To enable e-mail
11879
# How it works
11980

12081
## 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.
12283

12384
The Cloudformation template creates a DynamoDB table for each resource type.
12485

12586
## 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.
12788

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.
12990

13091
# Running the project locally
13192
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
156117
This sample application could be better with your help!
157118

158119
- 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).
161122
- Create your own client front end!
162123
- Web frameworks - Angular 2, React, ember, etc.
163124
- Mobile app

0 commit comments

Comments
 (0)