Skip to content

Instantly share code, notes, and snippets.

@stephdl
Created December 15, 2025 14:30
Show Gist options
  • Select an option

  • Save stephdl/62e015a762b91c95b6c4a394d8b9fd42 to your computer and use it in GitHub Desktop.

Select an option

Save stephdl/62e015a762b91c95b6c4a394d8b9fd42 to your computer and use it in GitHub Desktop.
scrip to start rustfs with podman in a pod
╰─➤ cat rustfs.sh
#!/bin/bash
set -e
# Configuration
POD_NAME="rustfs-pod"
RUSTFS_CONTAINER="rustfs-server"
VOLUME_FIXER_CONTAINER="volume-permission-helper"
RUSTFS_VOLUME="rustfs_data"
LOGS_VOLUME="logs"
# Couleurs pour l'output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}🚀 Démarrage du setup RustFS avec Podman${NC}"
# 1. Créer les volumes nommés
echo -e "${BLUE}📦 Création des volumes${NC}"
podman volume create $RUSTFS_VOLUME 2>/dev/null || echo "Volume $RUSTFS_VOLUME existe déjà"
podman volume create $LOGS_VOLUME 2>/dev/null || echo "Volume $LOGS_VOLUME existe déjà"
# 2. Supprimer le pod et les containers s'il existe
echo -e "${BLUE}🗑️ Nettoyage des anciens containers${NC}"
podman pod rm -f $POD_NAME 2>/dev/null || true
# 3. Créer le pod
echo -e "${BLUE}🐳 Création du pod: $POD_NAME${NC}"
podman pod create \
--name $POD_NAME \
-p 9000:9000 \
-p 9001:9001
# 4. Lancer le service de correction des permissions (volume-permission-helper)
echo -e "${BLUE}🔧 Lancement du service de correction des permissions${NC}"
podman run -d \
--pod $POD_NAME \
--name $VOLUME_FIXER_CONTAINER \
-v $RUSTFS_VOLUME:/data:Z \
-v $LOGS_VOLUME:/logs:Z \
alpine:latest \
sh -c "chown -R 10001:10001 /data /logs && echo 'Volume Permissions fixed'"
# Attendre que le service de permission soit terminé
sleep 3
# 5. Lancer le service RustFS principal
echo -e "${BLUE}🚀 Lancement du service RustFS${NC}"
podman run -d \
--pod $POD_NAME \
--name $RUSTFS_CONTAINER \
--security-opt=no-new-privileges:true \
-v $RUSTFS_VOLUME:/data/rustfs:Z \
-v $LOGS_VOLUME:/app/logs:Z \
-e RUSTFS_VOLUMES=/data/rustfs \
-e RUSTFS_ADDRESS=0.0.0.0:9000 \
-e RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9001 \
-e RUSTFS_CONSOLE_ENABLE=true \
-e RUSTFS_EXTERNAL_ADDRESS=:9000 \
-e RUSTFS_CORS_ALLOWED_ORIGINS='*' \
-e RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS='*' \
-e RUSTFS_ACCESS_KEY=rustfsadmin \
-e RUSTFS_SECRET_KEY=rustfsadmin \
-e RUSTFS_OBS_LOGGER_LEVEL=info \
-e RUSTFS_TLS_PATH=/opt/tls \
-e RUSTFS_OBJECT_CACHE_ENABLE=true \
-e RUSTFS_OBJECT_CACHE_TTL_SECS=300 \
--health-cmd='sh -c "curl -f http://localhost:9000/health && curl -f http://localhost:9001/rustfs/console/health"' \
--health-interval=30s \
--health-timeout=10s \
--health-retries=3 \
--health-start-period=40s \
--restart=unless-stopped \
rustfs/rustfs:latest
echo -e "${GREEN}✅ Pod RustFS créé et lancé avec succès ! ${NC}"
echo ""
echo -e "${BLUE}📊 Informations du pod:${NC}"
podman pod ls --filter "name=$POD_NAME"
echo ""
echo -e "${BLUE}🐳 Containers du pod:${NC}"
podman ps -a --filter "pod=$POD_NAME"
echo ""
echo -e "${GREEN}🌐 Accès: ${NC}"
echo " - S3 API: http://localhost:9000"
echo " - Console: http://localhost:9001"
echo ""
echo -e "${BLUE}📋 Commandes utiles:${NC}"
echo " - Logs RustFS: podman logs -f $RUSTFS_CONTAINER"
echo " - Status pod: podman pod stats $POD_NAME"
echo " - Arrêter: podman pod stop $POD_NAME"
echo " - Supprimer: podman pod rm -f $POD_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment