forked from jchomaz/Vulture
feat: Introduce Quadlet units for dev/prod VApp containers and a custom network, update existing container configurations, and enhance documentation.
This commit is contained in:
@@ -1,40 +1,101 @@
|
|||||||
# VContainer - Vulture build script
|
# VContainer - Vulture build script
|
||||||
|
|
||||||
Construction et lancements des containers.
|
Construction et lancements des containers.
|
||||||
Toutes les commandes sont a tapper depuis la racine du dépot.
|
Toutes les commandes sont à taper depuis la racine du dépôt.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./VContainers/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Ou manuellement :
|
||||||
|
```bash
|
||||||
podman build . -f ./VContainers/VNode/Containerfile -t vnode
|
podman build . -f ./VContainers/VNode/Containerfile -t vnode
|
||||||
podman build . -f ./VContainers/VApp/Containerfile -t vapp
|
podman build . -f ./VContainers/VApp/Containerfile -t vapp
|
||||||
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
Lancement des trois containers dans le même pod, ils partagent le réseau, les différents services sont disponibles sur localhost.
|
### Mode Manuel avec Scripts
|
||||||
|
|
||||||
podman pod create --name vulture -p 8080:80 -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 9001:9001
|
**Développement (localhost):**
|
||||||
podman run -dt --rm --pod vulture --name nanomq -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf docker.io/emqx/nanomq:latest --conf /etc/nanomq.conf
|
```bash
|
||||||
podman run -dt --rm --pod vulture --name vnode vnode:latest
|
./VContainers/run_dev.sh
|
||||||
podman run -dt --rm --pod vulture --name vapp vapp:latest
|
```
|
||||||
|
|
||||||
|
**Production (IP 192.168.73.252):**
|
||||||
|
```bash
|
||||||
|
./VContainers/run_prod.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Les containers sont lancés sur le réseau bridge `vulture-net` :
|
||||||
|
- **nanomq** : Broker MQTT (ports 1883, 9001, 8081, 8083, 8883)
|
||||||
|
- **vnode** : Services Node.js backend
|
||||||
|
- **vapp** : Frontend Vue.js (port 8080)
|
||||||
|
|
||||||
## Stop
|
## Stop
|
||||||
|
|
||||||
podman stop vapp
|
```bash
|
||||||
podman stop vnode
|
./VContainers/stop.sh
|
||||||
podman stop nanomq
|
```
|
||||||
podman pod rm vulture
|
|
||||||
|
Ou manuellement :
|
||||||
|
```bash
|
||||||
|
podman stop vapp vnode nanomq
|
||||||
|
podman network rm vulture-net
|
||||||
|
```
|
||||||
|
|
||||||
## Lancement automatique avec Quadlet
|
## Lancement automatique avec Quadlet
|
||||||
|
|
||||||
Copier les fichiers du repertoire quadlet vers ~/.config/containers/systemd/
|
Copier les fichiers du répertoire `quadlet` vers `~/.config/containers/systemd/`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ./VContainers/quadlet/*.network ~/.config/containers/systemd/
|
||||||
|
cp ./VContainers/quadlet/*.container ~/.config/containers/systemd/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Pour l'environnement de développement :**
|
||||||
|
```bash
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
systemctl --user enable --now vulture.pod
|
systemctl --user enable --now nanomq.service
|
||||||
|
systemctl --user enable --now vnode.service
|
||||||
|
systemctl --user enable --now vapp_dev.service
|
||||||
|
```
|
||||||
|
|
||||||
|
**Pour l'environnement de production :**
|
||||||
|
```bash
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user enable --now nanomq.service
|
||||||
|
systemctl --user enable --now vnode.service
|
||||||
|
systemctl --user enable --now vapp_prod.service
|
||||||
|
```
|
||||||
|
|
||||||
|
**Vérifier le statut :**
|
||||||
|
```bash
|
||||||
|
systemctl --user status nanomq.service vnode.service vapp_dev.service
|
||||||
|
```
|
||||||
|
|
||||||
|
**Arrêter les services :**
|
||||||
|
```bash
|
||||||
|
systemctl --user stop vapp_dev.service vnode.service nanomq.service
|
||||||
|
systemctl --user disable vapp_dev.service vnode.service nanomq.service
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Les fichiers de configuration se trouvent dans `VContainers/VApp/config/` :
|
||||||
|
- `config_dev.js` : Configuration développement (MQTT sur localhost)
|
||||||
|
- `config_prod.js` : Configuration production (MQTT sur 192.168.73.252)
|
||||||
|
|
||||||
|
Vous pouvez modifier ces fichiers selon vos besoins. En mode manuel, redémarrez les containers. Avec Quadlet, redémarrez le service correspondant :
|
||||||
|
```bash
|
||||||
|
systemctl --user restart vapp_dev.service
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tip
|
## Tip
|
||||||
|
|
||||||
|
Pour permettre à Podman d'utiliser les ports privilégiés (<1024) :
|
||||||
|
```bash
|
||||||
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
|
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
|
||||||
|
```
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Broker MQTT NanoMQ
|
Description=Broker MQTT NanoMQ
|
||||||
Requires=vulture.pod
|
Wants=network-online.target
|
||||||
After=vulture.pod
|
After=network-online.target
|
||||||
|
|
||||||
[Container]
|
[Container]
|
||||||
Image=docker.io/emqx/nanomq:latest
|
Image=docker.io/emqx/nanomq:latest
|
||||||
ContainerName=nanomq
|
ContainerName=nanomq
|
||||||
Pod=vulture
|
Network=vulture-net.network
|
||||||
# Correspond à -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf
|
PublishPort=1883:1883
|
||||||
Volume=./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf
|
PublishPort=9001:9001
|
||||||
|
PublishPort=8081:8081
|
||||||
|
PublishPort=8083:8083
|
||||||
|
PublishPort=8883:8883
|
||||||
|
Volume=%h/Src/Fablab/Vulture/VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf:Z
|
||||||
|
Exec=--conf /etc/nanomq.conf
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=vulture.pod
|
WantedBy=default.target
|
||||||
|
|||||||
16
VContainers/quadlet/vapp_dev.container
Normal file
16
VContainers/quadlet/vapp_dev.container
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Application Vue.js VApp (DEV)
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Requires=nanomq.service
|
||||||
|
After=nanomq.service
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/vapp:latest
|
||||||
|
ContainerName=vapp
|
||||||
|
Network=vulture-net.network
|
||||||
|
PublishPort=8080:80
|
||||||
|
Volume=%h/Src/Fablab/Vulture/VContainers/VApp/config/config_dev.js:/usr/share/nginx/html/config.js:Z
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
16
VContainers/quadlet/vapp_prod.container
Normal file
16
VContainers/quadlet/vapp_prod.container
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Application Vue.js VApp (PROD)
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Requires=nanomq.service
|
||||||
|
After=nanomq.service
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/vapp:latest
|
||||||
|
ContainerName=vapp
|
||||||
|
Network=vulture-net.network
|
||||||
|
PublishPort=8080:80
|
||||||
|
Volume=%h/Src/Fablab/Vulture/VContainers/VApp/config/config_prod.js:/usr/share/nginx/html/config.js:Z
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Application Node.js VNode
|
Description=Application Node.js VNode
|
||||||
Requires=vulture.pod
|
Wants=network-online.target
|
||||||
After=vulture.pod
|
After=network-online.target
|
||||||
|
Requires=nanomq.service
|
||||||
|
After=nanomq.service
|
||||||
|
|
||||||
[Container]
|
[Container]
|
||||||
Image=localhost/vnode:latest
|
Image=localhost/vnode:latest
|
||||||
ContainerName=vnode
|
ContainerName=vnode
|
||||||
Pod=vulture
|
Network=vulture-net.network
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=vulture.pod
|
WantedBy=default.target
|
||||||
|
|||||||
6
VContainers/quadlet/vulture-net.network
Normal file
6
VContainers/quadlet/vulture-net.network
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Reseau Bridge pour Vulture
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
NetworkName=vulture-net
|
||||||
|
Driver=bridge
|
||||||
Reference in New Issue
Block a user