chore: sync projects/lecoffre/lecoffre_node compose paths, add scripts/push_modules.sh, set bitcoin datadir to projects tree

This commit is contained in:
LeCoffre Deployment 2025-10-01 15:51:55 +00:00
parent dcb429e500
commit 66f1844587
42 changed files with 1485 additions and 464 deletions

97
.gitignore vendored
View File

@ -2,30 +2,30 @@
# ============================
# Dossiers de sauvegarde des scripts
*.backup/
*/backup/
*/*.backup*
**/backup/
**/*backup*
**/.cargo/
.cargo/
Cargo.lock
*/.cargo/
*/Cargo.lock
*.cargo/
*Cargo.lock
# Fichiers temporaires
*.tmp
*.temp
*.log
*.pid
**/*.tmp*
**/*.temp*
**/*.log*
**/*.pid*
# Fichiers de configuration locale
**/*.env*
**/*.conf*
**/*.yaml*
**/*.yml*
**/*.ini*
**/*.json*
**/*.toml*
**/*.lock*
# Données et logs
**/data/
**/logs/
**/*.logs*
**/*.data
*.db
@ -41,72 +41,43 @@ ssl/
certs/
# Docker
.docker/
docker-data/
docker-volumes/
**/*.docker*
# Cache et build
**/*.node_modules/
**/*.dist/
**/*.build/
**/*.target/
**/*build/
**/*target/
**/*.*.o
**/*.so
**/*.dylib
# IDE et éditeurs
.vscode/
.idea/
*.swp
*.swo
*~
**/*.vscode/
**/*.idea/
**/*.swp
**/*.swo
**/*~
# OS
.DS_Store
Thumbs.db
*.tmp
**/*.DS_Store
**/*Thumbs.db
**/*tmp*
# Git
.git/
*.orig
**/*.git/
**/*.orig*
# Backup des projets existants
*.backup/
**/*backup*
# Fichiers de configuration spécifiques au host
host-config/
local-config/
# Données sensibles
secrets/
private/
confidential/
# Monitoring et métriques
prometheus-data/
grafana-data/
loki-data/
# Bitcoin et crypto
.bitcoin/
.4nk/
wallet/
keys/
# Nginx
nginx-cache/
nginx-logs/
**/*wallet*
**/*keys*
# Supervisor
supervisor-logs/
# Scripts de déploiement temporaires
deploy-*.tmp
setup-*.tmp
.cursor-server
/home/debian/4NK_env/logs/
/home/debian/4NK_env/backups/
backups/
confs
**/*node_modules*
**/*cursor*
**/*pid*

53
.gitmodules vendored
View File

@ -1,56 +1,69 @@
[submodule "lecoffre_node"]
path = lecoffre_node
url = git@git.4nkweb.com:4nk/lecoffre_node.git
branch = ext
[submodule "sdk_relay"]
path = sdk_relay
path = 4NK_modules/sdk_relay
url = git@git.4nkweb.com:4nk/sdk_relay.git
branch = ext
[submodule "sdk_storage"]
path = sdk_storage
path = 4NK_modules/sdk_storage
url = git@git.4nkweb.com:4nk/sdk_storage.git
branch = ext
[submodule "ihm_client"]
path = ihm_client
path = 4NK_modules/ihm_client
url = git@git.4nkweb.com:4nk/ihm_client.git
branch = ext
[submodule "lecoffre-front"]
path = lecoffre-front
url = git@git.4nkweb.com:4nk/lecoffre-front.git
branch = ext
[submodule "doc_api"]
path = doc_api
path = 4NK_modules/doc_api
url = git@git.4nkweb.com:4nk/doc_api.git
branch = ext
[submodule "sdk_signer"]
path = sdk_signer
path = 4NK_modules/sdk_signer
url = git@git.4nkweb.com:4nk/sdk_signer.git
branch = ext
[submodule "skeleton"]
path = skeleton
path = 4NK_modules/skeleton
url = git@git.4nkweb.com:4nk/skeleton.git
branch = dev
[submodule "sdk-signer-client"]
path = sdk-signer-client
path = 4NK_modules/sdk-signer-client
url = git@git.4nkweb.com:4nk/sdk-signer-client.git
branch = ext
[submodule "sdk_client"]
path = sdk_client
path = 4NK_modules/sdk_client
url = git@git.4nkweb.com:4nk/sdk_client.git
branch = ext
[submodule "sdk_common"]
path = sdk_common
path = 4NK_modules/sdk_common
url = git@git.4nkweb.com:4nk/sdk_common.git
branch = ext
[submodule "rust-silentPayments"]
path = rust-silentPayments
path = 4NK_modules/rust-silentPayments
url = git@github.com:Sosthene00/rust-silentPayments.git
branch = add-utils
[submodule "blindbit-oracle"]
path = blindbit-oracle
path = 4NK_modules/blindbit-oracle
url = https://github.com/setavenger/blindbit-oracle.git
branch = master
[submodule "4NK_vault"]
path = vault
path = 4NK_modules/4NK_vault
url = git@git.4nkweb.com:4nk/4NK_vault.git
branch = ext
[submodule "4NK_certificator"]
path = 4NK_certificator
url = git@git.4nkweb.com:4nk/4NK_certificator.git
branch = main
[submodule "4NK_miner"]
path = 4NK_miner
url = git@git.4nkweb.com:4nk/4NK_miner.git
branch = main
[submodule "4NK_web_status"]
path = 4NK_web_status
url = git@git.4nkweb.com:4nk/4NK_web_status.git
branch = main
[submodule "lecoffre-front"]
path = projects/lecoffre/lecoffre-front
url = git@git.4nkweb.com:4nk/lecoffre-front.git
branch = ext
[submodule "lecoffre_node"]
path = projects/lecoffre/lecoffre_node
url = git@git.4nkweb.com:4nk/lecoffre_node.git
branch = ext

@ -0,0 +1 @@
Subproject commit 8006ba998656a3d80dc0f9a3cdd4668cec0aadcd

1
4NK_modules/4NK_miner Submodule

@ -0,0 +1 @@
Subproject commit 5b504e2679dc695bf0fac7faeef55bacc37b824f

1
4NK_modules/4NK_vault Submodule

@ -0,0 +1 @@
Subproject commit f4a8dd2e7fc9371c3d591f0afcc09b0e54bdf872

@ -0,0 +1 @@
Subproject commit 643bda3eef1eac751b9e75f6a71b8033041a7a17

@ -0,0 +1 @@
Subproject commit 2c3deb8831ce2ed2201b386bf51cb450f26da6d8

@ -0,0 +1 @@
Subproject commit ff3e14a86da668caeaf654d94db8ad939820b0b9

@ -0,0 +1 @@
Subproject commit c09135c4eb785fa5ef242cd106bb1e628d5f68fa

@ -0,0 +1 @@
Subproject commit 72bb22282737d9140cfd2fbfc9111b9c10d7e3ff

@ -0,0 +1 @@
Subproject commit 089bf06502eef2fb49e99ba9e614ddf3cbf7c3a0

1
4NK_modules/skeleton Submodule

@ -0,0 +1 @@
Subproject commit 68f6b31a6c573fcbc4addef9f5aae2b11096b25f

View File

@ -252,3 +252,5 @@ docker logs blindbit-oracle | grep -i "error"

View File

@ -184,3 +184,5 @@ blindbit:

View File

@ -263,3 +263,5 @@ La nouvelle structure des variables d'environnement améliore la sécurité, la

View File

@ -0,0 +1,153 @@
#!/usr/bin/env bash
set -euo pipefail
# Script pour remplacer les configurations nginx par des liens symboliques
# vers les fichiers centralisés dans /home/debian/4NK_env/confs/nginx
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
NGINX_CONF_DIR="/home/debian/4NK_env/confs/nginx"
NGINX_ACTIVE_DIR="/etc/nginx/sites-available"
NGINX_ENABLED_DIR="/etc/nginx/sites-enabled"
echo "=========================================="
echo " Configuration Nginx - Liens Symboliques"
echo "=========================================="
# Vérifier que le répertoire de configuration centralisé existe
if [ ! -d "$NGINX_CONF_DIR" ]; then
echo "❌ Erreur: Le répertoire $NGINX_CONF_DIR n'existe pas"
exit 1
fi
echo "📁 Répertoire de configuration centralisé: $NGINX_CONF_DIR"
echo "📁 Répertoire nginx sites-available: $NGINX_ACTIVE_DIR"
echo "📁 Répertoire nginx sites-enabled: $NGINX_ENABLED_DIR"
# Fonction pour créer un lien symbolique
create_symlink() {
local source="$1"
local target="$2"
local description="$3"
echo "🔗 Création du lien: $description"
echo " Source: $source"
echo " Cible: $target"
# Supprimer le fichier/cible existant s'il existe
if [ -e "$target" ] || [ -L "$target" ]; then
echo " Suppression de l'ancien fichier/lien: $target"
sudo rm -f "$target"
fi
# Créer le lien symbolique
sudo ln -sf "$source" "$target"
if [ -L "$target" ]; then
echo " ✅ Lien créé avec succès"
else
echo " ❌ Erreur lors de la création du lien"
return 1
fi
}
echo ""
echo "🔧 Création des liens symboliques..."
# Lister les fichiers de configuration dans le répertoire centralisé
config_files=$(find "$NGINX_CONF_DIR" -name "*.conf" -type f)
if [ -z "$config_files" ]; then
echo "❌ Aucun fichier .conf trouvé dans $NGINX_CONF_DIR"
exit 1
fi
echo "📋 Fichiers de configuration trouvés:"
echo "$config_files" | while read -r file; do
echo " - $(basename "$file")"
done
echo ""
echo "🔗 Création des liens dans sites-available..."
# Créer les liens dans sites-available
echo "$config_files" | while read -r source_file; do
filename=$(basename "$source_file")
target_file="$NGINX_ACTIVE_DIR/$filename"
create_symlink "$source_file" "$target_file" "$filename"
done
echo ""
echo "📋 Configuration actuelle de nginx..."
# Lister les configurations actives (sites-available)
echo "📁 Fichiers dans sites-available:"
if [ -d "$NGINX_ACTIVE_DIR" ]; then
ls -la "$NGINX_ACTIVE_DIR" | grep -E "\.(conf|link)$" || echo " Aucun fichier .conf trouvé"
else
echo " ❌ Répertoire $NGINX_ACTIVE_DIR n'existe pas"
fi
# Lister les configurations activées (sites-enabled)
echo ""
echo "📁 Fichiers dans sites-enabled:"
if [ -d "$NGINX_ENABLED_DIR" ]; then
ls -la "$NGINX_ENABLED_DIR" | grep -E "\.(conf|link)$" || echo " Aucun fichier .conf activé"
else
echo " ❌ Répertoire $NGINX_ENABLED_DIR n'existe pas"
fi
echo ""
echo "🧪 Test de la configuration nginx..."
# Tester la configuration nginx
if sudo nginx -t; then
echo "✅ Configuration nginx valide"
echo ""
echo "🔄 Redémarrage de nginx..."
# Redémarrer nginx
if sudo systemctl reload nginx; then
echo "✅ Nginx rechargé avec succès"
else
echo "❌ Erreur lors du rechargement de nginx"
echo "🔄 Tentative de redémarrage complet..."
if sudo systemctl restart nginx; then
echo "✅ Nginx redémarré avec succès"
else
echo "❌ Erreur lors du redémarrage de nginx"
exit 1
fi
fi
echo ""
echo "📊 Statut de nginx:"
sudo systemctl status nginx --no-pager -l
else
echo "❌ Configuration nginx invalide"
echo "🔍 Détails de l'erreur:"
sudo nginx -t 2>&1 || true
exit 1
fi
echo ""
echo "=========================================="
echo "✅ Configuration nginx terminée avec succès"
echo "=========================================="
# Afficher un résumé des liens créés
echo ""
echo "📋 Résumé des liens créés:"
echo "$config_files" | while read -r source_file; do
filename=$(basename "$source_file")
target_file="$NGINX_ACTIVE_DIR/$filename"
if [ -L "$target_file" ]; then
echo "$filename -> $(readlink "$target_file")"
else
echo "$filename -> Lien non créé"
fi
done

View File

@ -12,3 +12,6 @@ if [ ! -x "$CHECK" ]; then
fi
exec "$CHECK"

View File

@ -1,10 +1,10 @@
## Consignes de production et de consultation des logs
### Centralisation des logs
- Dossier central: `/home/debian/4NK_env/logs/`
- Dossier central: `/home/debian/4NK_env/lecoffre_node/logs/`
- Sous-dossiers standardisés par service:
- `nginx/`, `lecoffre-front/`, `ihm_client/`, `sdk_relay/`, `sdk_storage/`, `bitcoin/`, `blindbit/`, `miner/`, `tor/`
- Docker Compose monte chaque service avec un volume: `/home/debian/4NK_env/logs/<service>:/var/log/<service>`
- Docker Compose monte chaque service avec un volume: `/home/debian/4NK_env/lecoffre_node/logs/<service>:/var/log/<service>`
### Instrumentation et propagation
- Nginx JSON logging via `lecoffre_node/conf/nginx/logging.conf` avec `log_format lecoffre_json` incluant: `time`, `request_id`, `remote_addr`, `host`, `method`, `uri`, `args`, `status`, `bytes`, `referer`, `user_agent`, `request_time`, `upstream_*`, `x_forwarded_for`.
@ -23,7 +23,7 @@
- `grep '"/api/v1/idnot/' /home/debian/4NK_env/logs/nginx/lecoffre_front_access.log | jq . | tail -n 50`
### Promtail → Loki → Grafana
- Promtail scrute: `/home/debian/4NK_env/logs/**` (jobs par service).
- Promtail scrute: `/home/debian/4NK_env/lecoffre_node/logs/**` (jobs par service).
- Loki reçoit sur `http://loki:3100`.
- Grafana (local): `https://dev4.4nkweb.com/grafana/` → Explore → Datasource Loki.
- Requêtes utiles: `{job="lecoffre-front"}`, `{job="nginx"}`, `{job="sdk_relay"}`.

View File

@ -1,45 +0,0 @@
# Configuration globale
signet=1
server=1
datadir=/home/debian/4NK_env/logs/bitcoin
[signet]
daemon=0
txindex=1
upnp=1
#debug=1
#loglevel=debug
logthreadnames=1
onion=tor:9050
listenonion=1
onlynet=onion
# Paramètres RPC
rpcauth=bitcoin:c8ea921c7357bd6a5a8a7c43a12350a7$955e25b17672987b17c5a12f12cd8b9c1d38f0f86201c8cd47fc431f2e1c7956
rpcallowip=0.0.0.0/0
rpcworkqueue=32
rpcthreads=4
rpcdoccheck=1
# Paramètres ZMQ
zmqpubhashblock=tcp://:29000
zmqpubrawtx=tcp://:29001
listen=1
bind=:38333
rpcbind=:38332
rpcport=38332
fallbackfee=0.0001
blockfilterindex=1
datacarriersize=205
acceptnonstdtxn=1
dustrelayfee=0.00000001
minrelaytxfee=0.00000001
prune=0
signetchallenge=0020341c43803863c252df326e73574a27d7e19322992061017b0dc893e2eab90821
wallet=mining
wallet=watchonly
maxtxfee=1
addnode=tlv2yqamflv22vfdzy2hha2nwmt6zrwrhjjzz4lx7qyq7lyc6wfhabyd.onion
addnode=6xi33lwwslsx3yi3f7c56wnqtdx4v73vj2up3prrwebpwbz6qisnqbyd.onion
addnode=id7e3r3d2epen2v65jebjhmx77aimu7oyhcg45zadafypr4crqsytfid.onion

View File

@ -1,18 +0,0 @@
# Configuration Blindbit Oracle
host = "0.0.0.0:8000"
chain = "signet"
rpc_endpoint = "http://bitcoin:38332"
cookie_path = "/home/debian/4NK_env/data/bitcoin/signet/.cookie"
rpc_user = ""
rpc_pass = ""
sync_start_height = 1
# Performance
max_parallel_tweak_computations = 4
max_parallel_requests = 4
# Index
tweaks_only = 0
tweaks_full_basic = 1
tweaks_full_with_dust_filter = 1
tweaks_cut_through_with_dust_filter = 1

View File

@ -1,57 +0,0 @@
# Configuration Grafana avancée pour LeCoffre Node
[server]
# URL publique de Grafana
root_url = https://dev4.4nkweb.com/grafana
# Configuration de sécurité
enable_gzip = true
cert_file =
cert_key =
enforce_domain = false
[security]
# Configuration de sécurité
admin_user = admin
admin_password = admin123
secret_key = lecoffre_grafana_secret_key_2025
# Configuration des sessions
cookie_secure = true
cookie_samesite = strict
[users]
# Configuration des utilisateurs
allow_sign_up = false
allow_org_create = false
auto_assign_org = true
auto_assign_org_id = 1
auto_assign_org_role = Viewer
[auth.anonymous]
# Accès anonyme désactivé pour la sécurité
enabled = false
[dashboards]
# Configuration des dashboards
default_home_dashboard_path = /home/debian/4NK_env/confs/grafana/dashboards/lecoffre-overview.json
[unified_alerting]
# Configuration des alertes unifiées
enabled = true
[log]
# Configuration des logs Grafana
mode = console
level = info
format = json
[metrics]
# Métriques Prometheus
enabled = true
basic_auth_username =
basic_auth_password =
[feature_toggles]
# Fonctionnalités activées
enable = traceqlEditor

View File

@ -1,76 +0,0 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
http_listen_address: 0.0.0.0
grpc_listen_address: 0.0.0.0
common:
instance_addr: 0.0.0.0
path_prefix: /loki
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093
# Configuration de l'ingester - SEULEMENT le paramètre crucial
ingester:
lifecycler:
min_ready_duration: 5s # Réduit le délai de 15s à 5s
# Configuration des limites
limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h
max_cache_freshness_per_query: 10m
split_queries_by_interval: 15m
max_query_parallelism: 32
max_streams_per_user: 0
max_line_size: 256000
ingestion_rate_mb: 16
ingestion_burst_size_mb: 32
per_stream_rate_limit: 3MB
per_stream_rate_limit_burst: 15MB
max_entries_limit_per_query: 5000
max_query_series: 500
max_query_length: 721h
cardinality_limit: 100000
max_streams_matchers_per_query: 1000
max_concurrent_tail_requests: 10
# Configuration du storage
storage_config:
tsdb_shipper:
active_index_directory: /loki/tsdb-index
cache_location: /loki/tsdb-cache
filesystem:
directory: /loki/chunks
# Configuration du compactor
compactor:
working_directory: /loki/compactor
compaction_interval: 10m
retention_enabled: false
delete_request_store: filesystem
# Analytics désactivés
analytics:
reporting_enabled: false

View File

@ -1,107 +0,0 @@
server:
http_listen_port: 8090
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
# Bitcoin Signet Logs
- job_name: bitcoin
static_configs:
- targets:
- localhost
labels:
job: bitcoin
service: bitcoin-signet
__path__: /home/debian/4NK_env/lecoffre_node/logs/bitcoin/*.log
# Blindbit Oracle Logs
- job_name: blindbit
static_configs:
- targets:
- localhost
labels:
job: blindbit
service: blindbit-oracle
__path__: /home/debian/4NK_env/lecoffre_node/logs/blindbit-oracle/*.log
# SDK Relay Logs
- job_name: sdk_relay
static_configs:
- targets:
- localhost
labels:
job: sdk_relay
service: sdk_relay
__path__: /home/debian/4NK_env/lecoffre_node/logs/sdk_relay/*.log
# SDK Storage Logs
- job_name: sdk_storage
static_configs:
- targets:
- localhost
labels:
job: sdk_storage
service: sdk_storage
__path__: /home/debian/4NK_env/lecoffre_node/logs/sdk_storage/*.log
# LeCoffre Frontend Logs
- job_name: lecoffre-front
static_configs:
- targets:
- localhost
labels:
job: lecoffre-front
service: lecoffre-front
__path__: /home/debian/4NK_env/lecoffre_node/logs/lecoffre-front/*.log
# IHM Client Logs
- job_name: ihm_client
static_configs:
- targets:
- localhost
labels:
job: ihm_client
service: ihm_client
__path__: /home/debian/4NK_env/lecoffre_node/logs/ihm_client/*.log
# Miner Logs
- job_name: miner
static_configs:
- targets:
- localhost
labels:
job: miner
service: signet_miner
__path__: /home/debian/4NK_env/lecoffre_node/logs/miner/*.log
# Tor Logs
- job_name: tor
static_configs:
- targets:
- localhost
labels:
job: tor
service: tor-proxy
__path__: /home/debian/4NK_env/lecoffre_node/logs/tor/*.log
# Docker Container Logs
- job_name: docker
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 5s
filters:
- name: label
values: ["com.centurylinklabs.watchtower.enable=true"]
relabel_configs:
- source_labels: ['__meta_docker_container_name']
regex: '/?(.*)'
target_label: 'container_name'
- source_labels: ['__meta_docker_container_log_stream']
target_label: 'logstream'
- source_labels: ['__meta_docker_container_label_logging_job_name']
target_label: 'job'

View File

@ -1,51 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/nginx.err.log
stdout_logfile=/var/log/supervisor/nginx.out.log
user=root
[program:docker-compose]
command=/app/scripts/startup.sh
directory=/app
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/docker-compose.err.log
stdout_logfile=/var/log/supervisor/docker-compose.out.log
user=appuser
environment=HOME="/app"
[program:cron]
command=/usr/sbin/cron -f
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/cron.err.log
stdout_logfile=/var/log/supervisor/cron.out.log
user=root
[program:logrotate]
command=/usr/sbin/logrotate /etc/logrotate.d/lecoffre
autostart=true
autorestart=false
startsecs=0
exitcodes=0
user=root

View File

@ -1,21 +0,0 @@
# Configuration Tor pour LeCoffre Node
# Écoute sur 127.0.0.1 pour la sécurité
# Port SOCKS pour les connexions sortantes
SOCKSPort 127.0.0.1:9050
# Port de contrôle (désactivé pour la sécurité)
# ControlPort 127.0.0.1:9050
# Configuration de base
Log notice file /home/debian/4NK_env/logs/tor/tor.log
DataDirectory /home/debian/4NK_env/data/tor
# Configuration réseau
ClientOnly 1
SafeLogging 1
WarnUnsafeSocks 1
# Désactiver les services cachés
HiddenServiceDir /home/debian/4NK_env/data/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80

File diff suppressed because it is too large Load Diff

View File

@ -189,3 +189,5 @@ Les scripts ont été mis à jour pour utiliser la nouvelle structure :

@ -1 +0,0 @@
Subproject commit 041ff5e98f1236b4e5189f878e957274b383c3e7

@ -1 +0,0 @@
Subproject commit 67a1a48fb63cb4d35d61489cf3c341a27a3c94fb

@ -0,0 +1 @@
Subproject commit 0bed1cecc91505adb5e30bde48e5ff189b078731

@ -0,0 +1 @@
Subproject commit 35a209ce8b9109830b4b24e89285f25c0320b9af

View File

@ -229,3 +229,5 @@ done

View File

@ -112,3 +112,5 @@ echo "Test API: api_test_${TIMESTAMP}.txt"

View File

@ -90,3 +90,5 @@ echo -e "${CYAN}========================================${NC}"

View File

@ -28,3 +28,5 @@ exit 1

View File

@ -28,3 +28,5 @@ exit 1

89
scripts/push_modules.sh Normal file
View File

@ -0,0 +1,89 @@
#!/usr/bin/env sh
set -euo pipefail
# This script prepares and pushes local module sources to their Gitea remotes.
# It is idempotent and safe to re-run.
ROOT="/home/debian/4NK_env"
MOD_ROOT="$ROOT/4NK_modules"
GIT="/usr/bin/git"
log() { printf "%s\n" "$*"; }
ensure_dir() {
[ -d "$1" ] || mkdir -p "$1"
}
copy_if_exists() {
src="$1"; dst="$2"
if [ -d "$src" ]; then
log "[copy] $src -> $dst"
ensure_dir "$dst"
# Copy all contents (including dotfiles) without nuking existing .git
(cd "$src" && tar cf - .) | (cd "$dst" && tar xpf -)
else
log "[skip] source not found: $src"
fi
}
git_init_and_push() {
module_dir="$1" # e.g. /home/debian/4NK_env/4NK_modules/4NK_miner
remote_url="$2" # e.g. git@git.4nkweb.com:4nk/4NK_miner.git
commit_msg="$3" # commit message
ensure_dir "$module_dir"
cd "$module_dir"
if [ ! -d .git ]; then
$GIT init
fi
# Configure default branch ext
$GIT checkout -B ext
# Set remote
$GIT remote remove origin 2>/dev/null || true
$GIT remote add origin "$remote_url"
# Stage changes
$GIT add -A
# Commit if there are changes
if ! $GIT diff --cached --quiet; then
$GIT commit -m "$commit_msg"
else
log "[info] no changes to commit in $(basename "$module_dir")"
fi
# Push ext
$GIT push -u origin ext
}
main() {
# 1) Prepare module roots
ensure_dir "$MOD_ROOT/4NK_miner"
ensure_dir "$MOD_ROOT/4NK_web_status"
# 2) Copy sources from projects if present
copy_if_exists "$ROOT/projects/lecoffre/lecoffre_node/miner" "$MOD_ROOT/4NK_miner"
copy_if_exists "$ROOT/projects/lecoffre/lecoffre_node/web" "$MOD_ROOT/4NK_web_status"
# 3) Push 4NK_miner
git_init_and_push \
"$MOD_ROOT/4NK_miner" \
"git@git.4nkweb.com:4nk/4NK_miner.git" \
"chore: initial import from lecoffre_node/miner"
# 4) Push 4NK_web_status
git_init_and_push \
"$MOD_ROOT/4NK_web_status" \
"git@git.4nkweb.com:4nk/4NK_web_status.git" \
"chore: initial import from lecoffre_node/web"
log "[OK] Modules pushed. Optionally register as submodules in the root repo:"
log " cd $ROOT && git submodule add -f git@git.4nkweb.com:4nk/4NK_miner.git 4NK_modules/4NK_miner"
log " cd $ROOT && git submodule add -f git@git.4nkweb.com:4nk/4NK_web_status.git 4NK_modules/4NK_web_status"
}
main "$@"

1
vault

@ -1 +0,0 @@
Subproject commit 4d314db8898c66f25420824a65b7a71e4fa6e823