|
| 1 | +# CodePipeline Sample Source — Message Utility Java App |
| 2 | + |
| 3 | +This repository is a sample source application used to demonstrate [LocalStack's AWS CodePipeline](https://docs.localstack.cloud/aws/services/codepipeline/) emulation. It showcases a full CI/CD workflow with CodeBuild (Maven build + JUnit tests), CodeDeploy (ECS blue/green deployment), and CloudFormation stack provisioning. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The application is a simple Java utility (`MessageUtil`) built with Maven and packaged as a JAR. The pipeline: |
| 8 | + |
| 9 | +1. **Source** — pulls this repository as the pipeline source. |
| 10 | +2. **Build** — uses CodeBuild with Amazon Corretto 11 to compile the Maven project and run JUnit tests, producing `target/messageUtil-1.0.jar`. |
| 11 | +3. **Deploy** — deploys an nginx-based Docker image (serving `index.html`) to an ECS service via CodeDeploy blue/green deployment. |
| 12 | +4. **Provision** — optionally creates an SQS queue via the included CloudFormation template. |
| 13 | + |
| 14 | +## Repository Structure |
| 15 | + |
| 16 | +```bash |
| 17 | +. |
| 18 | +├── Dockerfile # nginx image serving index.html |
| 19 | +├── appspec.yml # CodeDeploy AppSpec for ECS blue/green deployment |
| 20 | +├── buildspec.yml # CodeBuild build specification (Java/Maven) |
| 21 | +├── cfn_stack.yaml # CloudFormation template — creates an SQS queue |
| 22 | +├── index.html # Static HTML page served by nginx |
| 23 | +├── pom.xml # Maven project descriptor for Message Utility |
| 24 | +└── src/ |
| 25 | + ├── main/java/MessageUtil.java # Java utility class |
| 26 | + └── test/java/TestMessageUtil.java # JUnit tests |
| 27 | +``` |
| 28 | + |
| 29 | +## Prerequisites |
| 30 | + |
| 31 | +- A valid [LocalStack for AWS license](https://localstack.cloud/pricing), which provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/getting-started/auth-token/) required to run these samples. |
| 32 | +- [Docker](https://docs.docker.com/get-docker/) with access to the Docker socket. |
| 33 | +- - AWS CLI and [`awslocal`](https://github.com/localstack/awscli-local) |
| 34 | + |
| 35 | +```bash |
| 36 | +export LOCALSTACK_AUTH_TOKEN=<your-auth-token> |
| 37 | +``` |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +This repository is intended to be used as the **source stage** of a LocalStack CodePipeline sample. Refer to the parent pipeline repository for end-to-end setup instructions. |
| 42 | + |
| 43 | +When used standalone, you can build the Maven project locally: |
| 44 | + |
| 45 | +```bash |
| 46 | +mvn install |
| 47 | +``` |
| 48 | + |
| 49 | +This compiles `MessageUtil.java`, runs the JUnit tests, and produces `target/messageUtil-1.0.jar`. |
| 50 | + |
| 51 | +## License |
| 52 | + |
| 53 | +Licensed under the Apache License 2.0. See [LICENSE](LICENSE). |
0 commit comments