Awesome
Elide Spring Boot Example
An archetype Elide project using Spring Boot.
Background
This project is the sample code for Elide's Getting Started documentation.
Install
To build and run:
- mvn clean install
- java -jar target/elide-spring-boot-1.0.0.jar
- Browse http://localhost:8080/
For API Versioning
Springdoc is accessible at http://localhost:8080/swagger-ui/index.html.
Docker and Containerize
To containerize and run elide project locally
-
Build Docker Image from Root of the project
docker build -t elide/elide-spring-boot-example .
-
Run docker container locally
docker run -p 8081:8080 -d elide/elide-spring-boot-example
-
Application should be running in
http://localhost:8081/
-
Check Docker containers running
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 99998a35d377 elide/elide-spring-boot-example "java -cp app:app/li…" 6 seconds ago Up 5 seconds 0.0.0.0:8089->8080/tcp upbeat_lehmann
-
Check logs of the container
docker logs -f 99998a35d377
-
If you want to ssh to your docker container for more troubleshooting
docker exec -it 99998a35d377 /bin/sh
Run from cloud (AWS)
- ECR
- Create a repository in Elastic Container Registry with name elide-spring-boot-example
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin xxx.dkr.ecr.us-east-1.amazonaws.com
- docker tag elide-spring-boot-example:latest xxx.dkr.ecr.us-east-1.amazonaws.com/elide-spring-boot-example:latest
- docker push xxx.dkr.ecr.us-east-1.amazonaws.com/elide-spring-boot-example
- Fargate
- With the image on AWS ECR, you can now define your deployment on AWS ECS/Fargate.
- Make sure to mention ECR details
- Port mapping is needed in the task definition. If you open the json definition of the task, you can edit to add this. "portMappings": [ { "hostPort": 8080, "protocol": "tcp", "containerPort": 8080 } ],
- The security group created or used for the task , needs to have inbound rule for TCP custom port 8080 , CIDR block 0.0.0.0/0(open to everyone, or you can add your company's CIDR block if its an internal service)
Usage
See Elide's Getting Started documentation.
Contribute
Please refer to the CONTRIBUTING.md file for information about how to get involved. We welcome issues, questions, and pull requests.
License
This project is licensed under the terms of the Apache 2.0 open source license. Please refer to LICENSE for the full terms.