chore: appliquer changements utilisateur (suppression fichiers obsolètes, renommage SSH_USAGE.md)
This commit is contained in:
parent
5791d960c4
commit
647a3311eb
67
Dockerfile
67
Dockerfile
@ -1,67 +0,0 @@
|
|||||||
# Dockerfile optimisé pour l'intégration dans 4NK_node
|
|
||||||
FROM node:20-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Installation des dépendances système
|
|
||||||
RUN apk update && apk add --no-cache \
|
|
||||||
git \
|
|
||||||
build-base \
|
|
||||||
python3 \
|
|
||||||
make \
|
|
||||||
g++ \
|
|
||||||
curl \
|
|
||||||
ca-certificates
|
|
||||||
|
|
||||||
# Copie des fichiers de dépendances
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# Installation des dépendances (inclut les devDependencies nécessaires au build)
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# Copie du code source
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Préparation des dépendances wasm (pkg/sdk_client)
|
|
||||||
ARG SDK_CLIENT_PKG_URL=""
|
|
||||||
ARG SDK_CLIENT_PKG_TARBALL=""
|
|
||||||
ARG SDK_CLIENT_PKG_BASE="https://git.4nkweb.com/4nk/ihm_client/raw/branch/docker-support/pkg"
|
|
||||||
ENV SDK_CLIENT_PKG_URL=${SDK_CLIENT_PKG_URL}
|
|
||||||
ENV SDK_CLIENT_PKG_TARBALL=${SDK_CLIENT_PKG_TARBALL}
|
|
||||||
ENV SDK_CLIENT_PKG_BASE=${SDK_CLIENT_PKG_BASE}
|
|
||||||
RUN chmod +x ./scripts/setup-remote-deps.sh && npm run build_wasm
|
|
||||||
|
|
||||||
# Build de l'application
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Image de production
|
|
||||||
FROM nginx:alpine
|
|
||||||
|
|
||||||
# Installation de Node.js pour les scripts de démarrage
|
|
||||||
RUN apk update && apk add --no-cache nodejs npm wget
|
|
||||||
|
|
||||||
# Copie des fichiers buildés
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
||||||
COPY --from=builder /app/package*.json /app/
|
|
||||||
|
|
||||||
# Index HTML minimal chargeant le bundle
|
|
||||||
RUN printf '<!doctype html>\n<html lang="fr">\n<head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>4NK UI</title>\n</head>\n<body>\n <div id="app"></div>\n <script type="module" src="/index.js"></script>\n</body>\n</html>\n' > /usr/share/nginx/html/index.html
|
|
||||||
|
|
||||||
# Copie de la configuration nginx optimisée pour 4NK_node
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
# Script de démarrage
|
|
||||||
COPY start.sh /start-4nk-node.sh
|
|
||||||
RUN chmod +x /start-4nk-node.sh
|
|
||||||
|
|
||||||
# Exposition des ports
|
|
||||||
EXPOSE 80 3003
|
|
||||||
|
|
||||||
# Variables d'environnement pour 4NK_node
|
|
||||||
ENV SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
|
||||||
ENV SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
|
||||||
ENV BITCOIN_RPC_URL=http://bitcoin:18443
|
|
||||||
ENV BLINDBIT_URL=http://blindbit:8000
|
|
||||||
|
|
||||||
# Point d'entrée
|
|
||||||
CMD ["/start-4nk-node.sh"]
|
|
@ -1,43 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
ihm_client:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile.4nk-node
|
|
||||||
container_name: 4nk-ihm-client
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
- "3003:3003"
|
|
||||||
environment:
|
|
||||||
- SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
|
||||||
- SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
|
||||||
- BITCOIN_RPC_URL=http://bitcoin:18443
|
|
||||||
- BLINDBIT_URL=http://blindbit:8000
|
|
||||||
- NODE_ENV=production
|
|
||||||
volumes:
|
|
||||||
- ihm_client_logs:/var/log/nginx
|
|
||||||
- ihm_client_data:/usr/share/nginx/html/data
|
|
||||||
networks:
|
|
||||||
- btcnet
|
|
||||||
depends_on:
|
|
||||||
- sdk_relay_1
|
|
||||||
- sdk_relay_2
|
|
||||||
- sdk_relay_3
|
|
||||||
restart: unless-stopped
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--timeout=5", "--spider", "http://localhost"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
start_period: 40s
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
ihm_client_logs:
|
|
||||||
driver: local
|
|
||||||
ihm_client_data:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
networks:
|
|
||||||
btcnet:
|
|
||||||
external: true
|
|
@ -1,223 +0,0 @@
|
|||||||
# Intégration avec 4NK_node
|
|
||||||
|
|
||||||
## Vue d'ensemble
|
|
||||||
|
|
||||||
Ce document décrit l'intégration de `ihm_client` dans l'infrastructure `4NK_node` et les modifications apportées pour assurer une connectivité optimale avec les services backend.
|
|
||||||
|
|
||||||
## Architecture d'intégration
|
|
||||||
|
|
||||||
### Services connectés
|
|
||||||
- **SDK Relays** : Connexion WebSocket pour la synchronisation
|
|
||||||
- **Bitcoin Core** : API RPC pour les opérations blockchain
|
|
||||||
- **Blindbit Oracle** : API pour les oracles
|
|
||||||
- **Tor Proxy** : Proxy pour la confidentialité
|
|
||||||
|
|
||||||
### Ports et URLs
|
|
||||||
- Interface utilisateur : `http://localhost:8080`
|
|
||||||
- SDK Relay 1 : `ws://localhost:8090` (WebSocket)
|
|
||||||
- SDK Relay 2 : `ws://localhost:8092` (WebSocket)
|
|
||||||
- SDK Relay 3 : `ws://localhost:8094` (WebSocket)
|
|
||||||
- Bitcoin Core RPC : `http://localhost:18443`
|
|
||||||
- Blindbit Oracle : `http://localhost:8000`
|
|
||||||
|
|
||||||
## Modifications du script de démarrage
|
|
||||||
|
|
||||||
### Changements principaux
|
|
||||||
|
|
||||||
Le script `start.sh` a été modifié pour améliorer la robustesse et la connectivité :
|
|
||||||
|
|
||||||
#### 1. Vérification WebSocket des relays
|
|
||||||
```bash
|
|
||||||
# Vérification WebSocket des relays (optionnel)
|
|
||||||
check_websocket "sdk_relay WebSocket" "$SDK_RELAY_WS_URL"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Suppression des dépendances critiques
|
|
||||||
- Les vérifications HTTP des relays ont été supprimées
|
|
||||||
- Les attentes critiques de Bitcoin Core et Blindbit ont été remplacées par des vérifications informatives
|
|
||||||
- L'interface utilisateur démarre maintenant même si certains services ne sont pas encore prêts
|
|
||||||
|
|
||||||
#### 3. Configuration dynamique
|
|
||||||
```bash
|
|
||||||
# Génération de la configuration dynamique
|
|
||||||
cat > /usr/share/nginx/html/config.js << EOF
|
|
||||||
window.ENV_CONFIG = {
|
|
||||||
SDK_RELAY_WS_URL: '$SDK_RELAY_WS_URL',
|
|
||||||
SDK_RELAY_HTTP_URL: '$SDK_RELAY_HTTP_URL',
|
|
||||||
BITCOIN_RPC_URL: '$BITCOIN_RPC_URL',
|
|
||||||
BLINDBIT_URL: '$BLINDBIT_URL',
|
|
||||||
ENVIRONMENT: '4nk-node'
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
## Fonctionnalités de connectivité
|
|
||||||
|
|
||||||
### Reconnexion automatique
|
|
||||||
L'interface utilisateur gère automatiquement :
|
|
||||||
- La reconnexion aux WebSockets des relays
|
|
||||||
- La gestion des déconnexions temporaires
|
|
||||||
- La récupération après panne de service
|
|
||||||
|
|
||||||
### Gestion des erreurs
|
|
||||||
- Tentatives de reconnexion avec backoff exponentiel
|
|
||||||
- Logs détaillés pour le diagnostic
|
|
||||||
- Dégradation gracieuse en cas d'indisponibilité de service
|
|
||||||
|
|
||||||
## Tests de connectivité
|
|
||||||
|
|
||||||
### Test manuel des WebSockets
|
|
||||||
```bash
|
|
||||||
# Depuis le conteneur ihm_client
|
|
||||||
nc -z sdk_relay_1 8090
|
|
||||||
nc -z sdk_relay_2 8090
|
|
||||||
nc -z sdk_relay_3 8090
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test de l'interface utilisateur
|
|
||||||
```bash
|
|
||||||
# Test HTTP
|
|
||||||
curl -s http://localhost:8080 | head -10
|
|
||||||
|
|
||||||
# Test de santé
|
|
||||||
curl -s http://localhost:8080/health
|
|
||||||
```
|
|
||||||
|
|
||||||
## Monitoring et logs
|
|
||||||
|
|
||||||
### Logs du conteneur
|
|
||||||
```bash
|
|
||||||
# Voir les logs de démarrage
|
|
||||||
docker logs 4nk-ihm-client
|
|
||||||
|
|
||||||
# Suivre les logs en temps réel
|
|
||||||
docker logs -f 4nk-ihm-client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Métriques de santé
|
|
||||||
- Vérification périodique de nginx
|
|
||||||
- Statut des connexions WebSocket
|
|
||||||
- Disponibilité des services backend
|
|
||||||
|
|
||||||
## Dépannage
|
|
||||||
|
|
||||||
### Problèmes courants
|
|
||||||
|
|
||||||
#### 1. Interface utilisateur non accessible
|
|
||||||
```bash
|
|
||||||
# Vérifier le statut du conteneur
|
|
||||||
docker ps | grep ihm_client
|
|
||||||
|
|
||||||
# Vérifier les logs
|
|
||||||
docker logs 4nk-ihm-client --tail=20
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Connexion WebSocket échouée
|
|
||||||
```bash
|
|
||||||
# Vérifier la connectivité réseau
|
|
||||||
docker exec 4nk-ihm-client nc -z sdk_relay_1 8090
|
|
||||||
|
|
||||||
# Vérifier les logs des relays
|
|
||||||
docker logs sdk_relay_1 --tail=10
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. Services backend indisponibles
|
|
||||||
```bash
|
|
||||||
# Vérifier Bitcoin Core
|
|
||||||
curl -s --user bitcoin:bitcoin http://localhost:18443
|
|
||||||
|
|
||||||
# Vérifier Blindbit
|
|
||||||
curl -s http://localhost:8000/health
|
|
||||||
```
|
|
||||||
|
|
||||||
### Solutions
|
|
||||||
|
|
||||||
#### Redémarrage du service
|
|
||||||
```bash
|
|
||||||
# Redémarrer ihm_client
|
|
||||||
docker-compose restart ihm_client
|
|
||||||
|
|
||||||
# Reconstruire et redémarrer
|
|
||||||
docker-compose build ihm_client
|
|
||||||
docker-compose up -d ihm_client
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Nettoyage complet
|
|
||||||
```bash
|
|
||||||
# Arrêter tous les services
|
|
||||||
docker-compose down
|
|
||||||
|
|
||||||
# Nettoyer les volumes (optionnel)
|
|
||||||
docker-compose down -v
|
|
||||||
|
|
||||||
# Redémarrer
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration avancée
|
|
||||||
|
|
||||||
### Variables d'environnement
|
|
||||||
```bash
|
|
||||||
SDK_RELAY_WS_URL=ws://sdk_relay_1:8090
|
|
||||||
SDK_RELAY_HTTP_URL=http://sdk_relay_1:8091
|
|
||||||
BITCOIN_RPC_URL=http://bitcoin:18443
|
|
||||||
BLINDBIT_URL=http://blindbit:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
### Personnalisation du script
|
|
||||||
Le script `start.sh` peut être modifié pour :
|
|
||||||
- Ajouter des vérifications de santé personnalisées
|
|
||||||
- Modifier les timeouts de connexion
|
|
||||||
- Ajouter des métriques de performance
|
|
||||||
|
|
||||||
## Sécurité
|
|
||||||
|
|
||||||
### Isolation réseau
|
|
||||||
- L'interface utilisateur est isolée dans le réseau Docker `btcnet`
|
|
||||||
- Communication sécurisée entre conteneurs
|
|
||||||
- Pas d'exposition directe des services backend
|
|
||||||
|
|
||||||
### Authentification
|
|
||||||
- Bitcoin Core utilise l'authentification par cookie
|
|
||||||
- Les WebSockets des relays sont sécurisés
|
|
||||||
- L'interface utilisateur gère l'authentification côté client
|
|
||||||
|
|
||||||
## Performance
|
|
||||||
|
|
||||||
### Optimisations
|
|
||||||
- Connexions WebSocket persistantes
|
|
||||||
- Mise en cache des données fréquemment utilisées
|
|
||||||
- Compression des données transmises
|
|
||||||
|
|
||||||
### Métriques
|
|
||||||
- Temps de réponse de l'interface
|
|
||||||
- Latence des WebSockets
|
|
||||||
- Utilisation des ressources
|
|
||||||
|
|
||||||
## Maintenance
|
|
||||||
|
|
||||||
### Mises à jour
|
|
||||||
```bash
|
|
||||||
# Mettre à jour l'image
|
|
||||||
docker-compose pull ihm_client
|
|
||||||
|
|
||||||
# Reconstruire avec les dernières modifications
|
|
||||||
docker-compose build ihm_client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Sauvegarde
|
|
||||||
```bash
|
|
||||||
# Sauvegarder la configuration
|
|
||||||
docker cp 4nk-ihm-client:/usr/share/nginx/html/config.js ./backup/
|
|
||||||
|
|
||||||
# Sauvegarder les logs
|
|
||||||
docker logs 4nk-ihm-client > ./backup/ihm_client.log
|
|
||||||
```
|
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
Pour toute question ou problème lié à l'intégration :
|
|
||||||
1. Consulter les logs du conteneur
|
|
||||||
2. Vérifier la connectivité réseau
|
|
||||||
3. Tester les services backend individuellement
|
|
||||||
4. Consulter la documentation de `4NK_node`
|
|
@ -1,96 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Gestion des fichiers statiques
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
|
|
||||||
# Headers de sécurité
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
add_header X-XSS-Protection "1; mode=block" always;
|
|
||||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers sdk_relay WebSocket
|
|
||||||
location /ws/ {
|
|
||||||
proxy_pass http://sdk_relay_1:8090;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_read_timeout 86400;
|
|
||||||
proxy_send_timeout 86400;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers sdk_relay HTTP API
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://sdk_relay_1:8091/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# CORS headers
|
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" always;
|
|
||||||
add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With" always;
|
|
||||||
|
|
||||||
# Gestion des requêtes OPTIONS
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header Access-Control-Allow-Origin "*";
|
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE";
|
|
||||||
add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With";
|
|
||||||
add_header Content-Length 0;
|
|
||||||
add_header Content-Type text/plain;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers Bitcoin Core RPC (si nécessaire)
|
|
||||||
location /bitcoin/ {
|
|
||||||
proxy_pass http://bitcoin:18443/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# Authentification basique pour Bitcoin RPC
|
|
||||||
auth_basic "Bitcoin RPC";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers Blindbit (si nécessaire)
|
|
||||||
location /blindbit/ {
|
|
||||||
proxy_pass http://blindbit:8000/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cache pour les assets statiques
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
try_files $uri =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Gestion des erreurs
|
|
||||||
error_page 404 /index.html;
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
|
|
||||||
location = /50x.html {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
access_log /var/log/nginx/ihm_client_access.log;
|
|
||||||
error_log /var/log/nginx/ihm_client_error.log;
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
# Redirection des requêtes HTTP vers Vite
|
|
||||||
location / {
|
|
||||||
proxy_pass http://localhost:3003;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ws/ {
|
|
||||||
proxy_pass http://localhost:8090;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header X-NginX-Proxy true;
|
|
||||||
proxy_read_timeout 86400;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /storage/ {
|
|
||||||
rewrite ^/storage(/.*)$ $1 break;
|
|
||||||
proxy_pass http://localhost:8080;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://localhost:8091;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# CORS headers
|
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" always;
|
|
||||||
add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With" always;
|
|
||||||
}
|
|
||||||
}
|
|
103
ngnix.conf
103
ngnix.conf
@ -1,103 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Types MIME explicites pour ES Modules et WASM
|
|
||||||
types {
|
|
||||||
application/javascript js mjs;
|
|
||||||
text/css css;
|
|
||||||
application/wasm wasm;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Gestion des fichiers statiques
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
|
|
||||||
# Headers de sécurité
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
add_header X-XSS-Protection "1; mode=block" always;
|
|
||||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers sdk_relay WebSocket
|
|
||||||
location /ws/ {
|
|
||||||
proxy_pass http://sdk_relay_1:8090;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_read_timeout 86400;
|
|
||||||
proxy_send_timeout 86400;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers sdk_relay HTTP API
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://sdk_relay_1:8091/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# CORS headers
|
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" always;
|
|
||||||
add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With" always;
|
|
||||||
|
|
||||||
# Gestion des requêtes OPTIONS
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header Access-Control-Allow-Origin "*";
|
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE";
|
|
||||||
add_header Access-Control-Allow-Headers "Authorization,Content-Type,Accept,X-Requested-With";
|
|
||||||
add_header Content-Length 0;
|
|
||||||
add_header Content-Type text/plain;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers Bitcoin Core RPC (si nécessaire)
|
|
||||||
location /bitcoin/ {
|
|
||||||
proxy_pass http://bitcoin:18443/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# Authentification basique pour Bitcoin RPC
|
|
||||||
auth_basic "Bitcoin RPC";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Proxy vers Blindbit (si nécessaire)
|
|
||||||
location /blindbit/ {
|
|
||||||
proxy_pass http://blindbit:8000/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Cache pour les assets statiques
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
try_files $uri =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Gestion des erreurs
|
|
||||||
error_page 404 /index.html;
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
|
|
||||||
location = /50x.html {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
access_log /var/log/nginx/ihm_client_access.log;
|
|
||||||
error_log /var/log/nginx/ihm_client_error.log;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user