correction

main
stef 2023-12-18 23:42:20 +01:00
parent 69ce4e14b2
commit 27165a91b3
2 changed files with 67 additions and 7 deletions

56
README.md 100644
View File

@ -0,0 +1,56 @@
# Demo Springboot
1 - Cloner ce repo
2 - Dans le répertoire springboot_demo
3 - Build de l'image
````
docker build -t <votre repo>/stringboot-rest:v1.0.0
````
Dans mon cas:
````
docker build -t gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0
````
4 - Configuration de docker-compose.yaml
Modifier le nom de l'image pour indiquer votre repo local
```
image: gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0
```
En :
```
image: <votre repo>/stringboot-rest:v1.0.0
```
Remplacer l'url stringboot.msi.stef.lan par votre url
4 - Push de l'image
```
docker push <votre repo>//stringboot-rest:v1.0.0
```
Dans mon cas:
```
docker push gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0
```
5- Deployment
```
cd ..
docker compose deploy --compose-file springboot_demo/docker-compose.yaml springboot_cemo
```
6- Vérification
```
docker stack ps springboot_demo
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
6rnc3lh552rh springboot_demo_stringboot.1 gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0 swarm-node04 Running Running 22 minutes ago
ghviv6par27y springboot_demo_stringboot.2 gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0 swarm-node03 Running Running 22 minutes ago
xm91h85odf49 springboot_demo_stringboot.3 gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0 swarm-node02 Running Running 22 minutes ago
```
Test url:
```
curl https://springboot.msi.stef.lan
{"id":32,"content":"Hello, World!"}```

View File

@ -1,8 +1,7 @@
version: "3.3"
services:
stringboot:
build: .
image: stringboot-rest:v1.0.0
image: gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0
networks:
- traefik-public
deploy:
@ -10,10 +9,15 @@ services:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
- "traefik.http.routers.stringboot.rule=Host(`stringboot.msi.stef.lan`)"
- "traefik.http.services.stringboot.loadbalancer.server.port=8080"
- "traefik.http.routers.stringboot.entrypoints=websecure"
- "traefik.http.routers.stringboot.tls=true"
- "traefik.http.routers.springboot.rule=Host(`springboot.msi.stef.lan`)"
- "traefik.http.middlewares.replacepath-greeting.replacepath.path=/greeting"
- "traefik.http.routers.springboot.middlewares=replacepath-greeting@docker"
# - "traefik.http.middlewares.add-greeting.addprefix.prefix=/greeting"
# - "traefik.http.routers.springboot.middlewares=add-greeting@docker"
- "traefik.http.services.springboot.loadbalancer.server.port=8080"
- "traefik.http.routers.springboot.entrypoints=websecure"
- "traefik.http.routers.springboot.tls=true"
networks:
traefik-public:
traefik-public:
external: true