|
| 1 | +Welcome to the AWS CodeStar sample web application |
| 2 | +================================================== |
| 3 | + |
| 4 | +This sample code helps get you started with a simple Java web application |
| 5 | +deployed by AWS CodeDeploy to an Amazon EC2 server. |
| 6 | + |
| 7 | +What's Here |
| 8 | +----------- |
| 9 | + |
| 10 | +This sample includes: |
| 11 | + |
| 12 | +* README.md - this file |
| 13 | +* appspec.yml - this file is used by AWS CodeDeploy when deploying the web |
| 14 | + application to EC2 |
| 15 | +* buildspec.yml - this file is used by AWS CodeBuild to build the web |
| 16 | + application |
| 17 | +* pom.xml - this file is the Maven Project Object Model for the web application |
| 18 | +* src/main - this directory contains your Java service source files |
| 19 | +* src/test - this directory contains your Java service unit test files |
| 20 | +* scripts/ - this directory contains scripts used by AWS CodeDeploy when |
| 21 | + installing and deploying your application on the Amazon EC2 instance |
| 22 | + |
| 23 | + |
| 24 | +Getting Started |
| 25 | +--------------- |
| 26 | + |
| 27 | +These directions assume you want to develop on your local computer, and not |
| 28 | +from the Amazon EC2 instance itself. If you're on the Amazon EC2 instance, the |
| 29 | +virtual environment is already set up for you, and you can start working on the |
| 30 | +code. |
| 31 | + |
| 32 | +To work on the sample code, you'll need to clone your project's repository to your |
| 33 | +local computer. If you haven't, do that first. You can find instructions in the |
| 34 | +AWS CodeStar user guide. |
| 35 | + |
| 36 | +1. Install maven. See https://maven.apache.org/install.html for details. |
| 37 | + |
| 38 | +2. Install tomcat. See https://tomcat.apache.org/tomcat-7.0-doc/setup.html for |
| 39 | + details. |
| 40 | + |
| 41 | +3. Build the application. |
| 42 | + |
| 43 | + $ mvn -f pom.xml compile |
| 44 | + $ mvn -f pom.xml package |
| 45 | + |
| 46 | +4. Copy the built application to the Tomcat webapp directory. The actual |
| 47 | + location of that directory will vary depending on your platform and |
| 48 | + installation. |
| 49 | + |
| 50 | + $ cp target/ROOT.war <tomcat webapp directory> |
| 51 | + |
| 52 | +4. Restart your tomcat server |
| 53 | + |
| 54 | +5. Open http://127.0.0.1:8080/ in a web browser to view your application. |
| 55 | + |
| 56 | +What Do I Do Next? |
| 57 | +------------------ |
| 58 | + |
| 59 | +Once you have a virtual environment running, you can start making changes to |
| 60 | +the sample Java web application. We suggest making a small change to |
| 61 | +/src/main/webapp/WEB-INF/views/index.jsp first, so you can see how changes |
| 62 | +pushed to your project's repository are automatically picked up by your project |
| 63 | +pipeline and deployed to the Amazon EC2 instance. (You can watch the pipeline |
| 64 | +progress on your project dashboard.) Once you've seen how that works, start |
| 65 | +developing your own code, and have fun! |
| 66 | + |
| 67 | +To run your tests locally, go to the root directory of the sample code and run the |
| 68 | +`mvn clean compile test` command, which AWS CodeBuild also runs through your `buildspec.yml` file. |
| 69 | + |
| 70 | +To test your new code during the release process, modify the existing tests or add tests |
| 71 | +to the tests directory. AWS CodeBuild will run the tests during the build stage of your |
| 72 | +project pipeline. You can find the test results in the AWS CodeBuild console. |
| 73 | + |
| 74 | +Learn more about Maven's [Standard Directory Layout](https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html). |
| 75 | + |
| 76 | +Learn more about AWS CodeBuild and how it builds and tests your application here: |
| 77 | +https://docs.aws.amazon.com/codebuild/latest/userguide/concepts.html |
| 78 | + |
| 79 | +Learn more about AWS CodeStar by reading the user guide. Ask questions or make |
| 80 | +suggestions on our forum. |
| 81 | + |
| 82 | +User Guide: http://docs.aws.amazon.com/codestar/latest/userguide/welcome.html |
| 83 | + |
| 84 | +Forum: https://forums.aws.amazon.com/forum.jspa?forumID=248 |
| 85 | + |
| 86 | +What Should I Do Before Running My Project in Production? |
| 87 | +------------------ |
| 88 | + |
| 89 | +AWS recommends you review the security best practices recommended by the framework |
| 90 | +author of your selected sample application before running it in production. You |
| 91 | +should also regularly review and apply any available patches or associated security |
| 92 | +advisories for dependencies used within your application. |
| 93 | + |
| 94 | +Best Practices: https://docs.aws.amazon.com/codestar/latest/userguide/best-practices.html?icmpid=docs_acs_rm_sec |
0 commit comments