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
|
||||
|
||||
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
|
||||
|
||||
```bash
|
||||
./VContainers/build.sh
|
||||
```
|
||||
|
||||
Ou manuellement :
|
||||
```bash
|
||||
podman build . -f ./VContainers/VNode/Containerfile -t vnode
|
||||
podman build . -f ./VContainers/VApp/Containerfile -t vapp
|
||||
|
||||
```
|
||||
|
||||
## 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
|
||||
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
|
||||
podman run -dt --rm --pod vulture --name vnode vnode:latest
|
||||
podman run -dt --rm --pod vulture --name vapp vapp:latest
|
||||
**Développement (localhost):**
|
||||
```bash
|
||||
./VContainers/run_dev.sh
|
||||
```
|
||||
|
||||
**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
|
||||
|
||||
podman stop vapp
|
||||
podman stop vnode
|
||||
podman stop nanomq
|
||||
podman pod rm vulture
|
||||
```bash
|
||||
./VContainers/stop.sh
|
||||
```
|
||||
|
||||
Ou manuellement :
|
||||
```bash
|
||||
podman stop vapp vnode nanomq
|
||||
podman network rm vulture-net
|
||||
```
|
||||
|
||||
## 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 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
|
||||
|
||||
Pour permettre à Podman d'utiliser les ports privilégiés (<1024) :
|
||||
```bash
|
||||
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
|
||||
```
|
||||
@@ -1,14 +1,19 @@
|
||||
[Unit]
|
||||
Description=Broker MQTT NanoMQ
|
||||
Requires=vulture.pod
|
||||
After=vulture.pod
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Container]
|
||||
Image=docker.io/emqx/nanomq:latest
|
||||
ContainerName=nanomq
|
||||
Pod=vulture
|
||||
# Correspond à -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf
|
||||
Volume=./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf
|
||||
Network=vulture-net.network
|
||||
PublishPort=1883:1883
|
||||
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]
|
||||
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]
|
||||
Description=Application Node.js VNode
|
||||
Requires=vulture.pod
|
||||
After=vulture.pod
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
Requires=nanomq.service
|
||||
After=nanomq.service
|
||||
|
||||
[Container]
|
||||
Image=localhost/vnode:latest
|
||||
ContainerName=vnode
|
||||
Pod=vulture
|
||||
Network=vulture-net.network
|
||||
|
||||
[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