correction
parent
69ce4e14b2
commit
27165a91b3
|
|
@ -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!"}```
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
version: "3.3"
|
version: "3.3"
|
||||||
services:
|
services:
|
||||||
stringboot:
|
stringboot:
|
||||||
build: .
|
image: gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0
|
||||||
image: stringboot-rest:v1.0.0
|
|
||||||
networks:
|
networks:
|
||||||
- traefik-public
|
- traefik-public
|
||||||
deploy:
|
deploy:
|
||||||
|
|
@ -10,10 +9,15 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.docker.network=traefik-public"
|
- "traefik.docker.network=traefik-public"
|
||||||
- "traefik.http.routers.stringboot.rule=Host(`stringboot.msi.stef.lan`)"
|
- "traefik.http.routers.springboot.rule=Host(`springboot.msi.stef.lan`)"
|
||||||
- "traefik.http.services.stringboot.loadbalancer.server.port=8080"
|
- "traefik.http.middlewares.replacepath-greeting.replacepath.path=/greeting"
|
||||||
- "traefik.http.routers.stringboot.entrypoints=websecure"
|
- "traefik.http.routers.springboot.middlewares=replacepath-greeting@docker"
|
||||||
- "traefik.http.routers.stringboot.tls=true"
|
# - "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:
|
networks:
|
||||||
traefik-public:
|
traefik-public:
|
||||||
|
external: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue