Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caiquecoelho/spring-course-java-1-and-pact
https://github.com/caiquecoelho/spring-course-java-1-and-pact
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/caiquecoelho/spring-course-java-1-and-pact
- Owner: CaiqueCoelho
- Created: 2024-10-17T19:03:13.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-22T21:25:39.000Z (6 days ago)
- Last Synced: 2025-01-22T22:26:06.750Z (6 days ago)
- Language: Java
- Size: 151 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Running migration in the terminal skipping the tests
```
mvn clean package spring-boot:run -DskipTests
```Running the application should be fine to run migrations, but we can do this in the therminal or we can use the flyway-maven-plugin
```
mvn flyway:migrate
```## Running tests
mvn clean test
allure serve## Open API Docs
http://localhost:8081/v3/api-docs## Open Swagger UI
http://localhost:8081/swagger-ui/index.html# Troubleshooting
Test Container test cases are failing due to "Could not find a valid Docker environment"
## To run SwaggerIntegarionTests in MAC, run the following command
```
sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock
```## To create jar file
This will take too long because will run all tests
```
mvn clean package
```To skip the tests
```
mvn clean package -DskipTests
```## To build docker image
docker build -t spring-boot-docker .## To run docker compose with forced rebuild
docker-compose up -d --build## To see the containers
docker compose ls
docker ps
docker logs
To show the logs in realtime
docker logs -f
docker images### Kubernetes
To create kubectl deployment
kubectl create deployment spring-course-1-kubernetes --image=caiquecoelho/spring-course-1
To expose the service
kubectl expose deployment spring-course-1-kubernetes --type=LoadBalancer --port=8080
To get the public ip
kubectl get svc
To scale
kubectl scale deployment spring-course-1-kubernetes --replicas=3
To see the number of pods
kubectl get pods -o wide
To delete one replica to test the auto-scaling
kubectl delete pod spring-course-1-kubernetes-
Auto-scaling
kubectl autoscale deployment spring-course-1-kubernetes --cpu-percent=70 --min=3 --max=5
Changing versions without downstream edit the deployment file
kubectl edit deployment spring-course-1-kubernetes
In the file below the repicas number, add a new line called minReadySeconds: 15 and save the file and run
kubectl set image deployment spring-course-1-kubernetes spring-course-1-kubernetes=caiquecoelho/spring-course:1.2.0
See the changes of replicas with kubectl get pods -o wide
To see if the cluster was created
kubectl config current-context
kubectl config view
kubectl get nodes
kubectl version
To see the available clusters
kubectl config get-contexts
To change
kubectl config use-context