4NK_env/scripts/init-4nk-env-repo.sh
LeCoffre Deployment 837701773f ci: docker_tag=ext
Initial commit - 4NK Environment
- Configuration complète LeCoffre
- Architecture autonome avec Nginx intégré
- Scripts de déploiement
- Documentation IA_agents
- Support redirections IdNot (port 3000)
- Monitoring Grafana/Loki/Promtail
2025-09-21 19:40:36 +00:00

181 lines
5.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
echo "🚀 INITIALISATION DU DÉPÔT 4NK_ENV"
echo "================================="
# Fonction de logging
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
# Configuration
REPO_NAME="4NK_env"
GIT_REMOTE="git@git.4nkweb.com:4nk/4NK_env.git"
BRANCH="ext"
log "📋 Configuration:"
echo " Dépôt: $REPO_NAME"
echo " Remote: $GIT_REMOTE"
echo " Branche: $BRANCH"
echo ""
# Vérifier si on est dans le bon répertoire
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "$REPO_NAME" ]; then
log "⚠️ Attention: Vous devez être dans le répertoire $REPO_NAME"
log " Répertoire actuel: $CURRENT_DIR"
exit 1
fi
# Vérifier la configuration SSH
log "🔧 Vérification de la configuration Git SSH..."
if ! ssh -T git@git.4nkweb.com 2>&1 | grep -q "successfully authenticated"; then
echo "❌ Erreur: Clé SSH non configurée pour git.4nkweb.com"
echo " Vérifiez votre configuration SSH et vos clés"
exit 1
fi
log "✅ Clé SSH configurée"
# Initialiser Git si ce n'est pas déjà fait
if [ ! -d ".git" ]; then
log "📦 Initialisation du dépôt Git..."
git init
log "✅ Dépôt Git initialisé"
else
log " Dépôt Git déjà initialisé"
fi
# Configuration Git
log "⚙️ Configuration Git..."
git config user.name "LeCoffre Deployment"
git config user.email "deployment@lecoffre.io"
# Ajouter le remote si il n'existe pas
if ! git remote get-url origin 2>/dev/null; then
log "🔗 Ajout du remote origin..."
git remote add origin "$GIT_REMOTE"
log "✅ Remote origin ajouté"
else
log " Remote origin déjà configuré"
fi
# Créer le fichier README.md s'il n'existe pas
if [ ! -f "README.md" ]; then
log "📝 Création du README.md..."
cat > README.md << 'EOF'
# 4NK Environment
Environnement complet pour le déploiement de LeCoffre et tous ses services.
## Structure
```
4NK_env/
├── lecoffre_node/ # Orchestrateur principal
├── sdk_relay/ # Service de relais WebSocket
├── sdk_signer/ # Service de signature
├── sdk_storage/ # Service de stockage
├── sdk_client/ # Client SDK
├── sdk_common/ # Composants communs
├── sdk-signer-client/ # Client signeur
├── ihm_client/ # Interface utilisateur
├── lecoffre-back-mini/ # API Backend
├── lecoffre-front/ # Frontend Next.js
├── doc_api/ # Documentation API
├── IA_agents/ # Agents IA et documentation
└── scripts/ # Scripts de déploiement
```
## Déploiement
### Architecture autonome
```bash
cd lecoffre_node
./scripts/deploy-autonomous.sh
```
### Clonage de tous les projets
```bash
./scripts/clone-all-repos.sh
```
## Services
- **LeCoffre Node** : Orchestrateur principal avec Nginx intégré
- **Bitcoin Signet** : Nœud Bitcoin pour tests
- **Monitoring** : Grafana, Loki, Promtail
- **Services SDK** : Relay, Signer, Storage
- **Applications** : Frontend, Backend, IHM Client
## Ports
- **80** : HTTP (redirection vers HTTPS)
- **443** : HTTPS avec certificats auto-signés
- **3000** : Redirections externes IdNot
## Documentation
Voir le dossier `IA_agents/` pour la documentation complète.
EOF
log "✅ README.md créé"
else
log " README.md existe déjà"
fi
# Ajouter tous les fichiers
log "📁 Ajout des fichiers au dépôt..."
git add .
# Vérifier s'il y a des changements
if git diff --staged --quiet; then
log " Aucun changement à committer"
else
log "💾 Commit initial..."
git commit -m "ci: docker_tag=ext
Initial commit - 4NK Environment
- Configuration complète LeCoffre
- Architecture autonome avec Nginx intégré
- Scripts de déploiement
- Documentation IA_agents
- Support redirections IdNot (port 3000)
- Monitoring Grafana/Loki/Promtail"
log "✅ Commit initial créé"
fi
# Créer et pousser la branche ext
log "🌿 Création et push de la branche '$BRANCH'..."
git checkout -b "$BRANCH" 2>/dev/null || git checkout "$BRANCH"
# Essayer de pousser, si ça échoue, créer le dépôt d'abord
log "🚀 Tentative de push vers le dépôt distant..."
if git push -u origin "$BRANCH"; then
log "✅ Push réussi"
else
log "⚠️ Le dépôt distant n'existe pas encore"
log "💡 Créez le dépôt '4NK_env' sur git.4nkweb.com d'abord"
log " Ou utilisez une URL différente"
log "🔧 Configuration actuelle: $GIT_REMOTE"
log "📝 Pour créer le dépôt, connectez-vous à git.4nkweb.com"
log " et créez un nouveau dépôt nommé '4NK_env' dans l'organisation '4nk'"
fi
log "🎉 Dépôt 4NK_env initialisé localement!"
log "🔗 URL configurée: $GIT_REMOTE"
echo ""
log "📊 Résumé:"
echo " ✅ Dépôt Git initialisé"
echo " ✅ Remote origin configuré"
echo " ✅ Branche '$BRANCH' créée et poussée"
echo " ✅ Fichiers .gitignore et .dockerignore configurés"
echo " ✅ README.md créé"
echo ""
log "🚀 Prochaines étapes:"
echo " 1. Vérifier le dépôt sur git.4nkweb.com"
echo " 2. Configurer les workflows CI/CD si nécessaire"
echo " 3. Cloner les projets avec ./scripts/clone-all-repos.sh"
echo " 4. Déployer avec ./lecoffre_node/scripts/deploy-autonomous.sh"