From a360dce5674ecc4941f9697a0ef74cd99211e7ea Mon Sep 17 00:00:00 2001 From: Nicolas Cantu Date: Tue, 16 Sep 2025 15:38:01 +0000 Subject: [PATCH] feat(nginx): proxy WS + Next assets; chore: favicon; infra: signer/storage latest; conf: relay ws/storage; ops: certbot + nodesource; fix: basePath via Nginx sub_filter --- .env.exemple | 12 ++- conf/nginx/assets/favicon.ico | Bin 0 -> 590 bytes conf/nginx/dev4.4nkweb.com-https.conf | 128 ++++++++++++++++++++++++++ conf/nginx/dev4.4nkweb.com.conf | 125 +++++++++++++++++++++++++ docker-compose.yml | 28 +++++- docker.gpg | 62 +++++++++++++ docs/setup_outils.md | 7 ++ nodesource_setup.sh | 113 +++++++++++++++++++++++ relay/sdk_relay.conf | 2 +- 9 files changed, 470 insertions(+), 7 deletions(-) create mode 100644 conf/nginx/assets/favicon.ico create mode 100644 conf/nginx/dev4.4nkweb.com-https.conf create mode 100644 conf/nginx/dev4.4nkweb.com.conf create mode 100644 docker.gpg create mode 100644 docs/setup_outils.md create mode 100644 nodesource_setup.sh diff --git a/.env.exemple b/.env.exemple index 621c09d..075b62e 100644 --- a/.env.exemple +++ b/.env.exemple @@ -44,15 +44,17 @@ NEXT_PUBLIC_IDNOT_BASE_URL= NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT= NEXT_PUBLIC_IDNOT_CLIENT_ID= NEXT_PUBLIC_BACK_API_PROTOCOL= -NEXT_PUBLIC_BACK_API_HOST= -NEXT_PUBLIC_BACK_API_PORT= -NEXT_PUBLIC_BACK_API_ROOT_URL= -NEXT_PUBLIC_BACK_API_VERSION= NEXT_PUBLIC_ANK_BASE_REDIRECT_URI= +NEXT_PUBLIC_BACK_API_PROTOCOL=http +NEXT_PUBLIC_BACK_API_HOST=localhost +NEXT_PUBLIC_BACK_API_PORT=8080 +NEXT_PUBLIC_BACK_API_ROOT_URL=/api +NEXT_PUBLIC_BACK_API_VERSION=/v1 + #WS RELAY_URLS=ws://sdk_relay:8090 SIGNER_WS_URL=https://demo.4nkweb.com/signer/ #IHM URLS -VITE_BOOTSTRAPURL=http://sdk_relay:8090/ \ No newline at end of file +VITE_BOOTSTRAPURL=https://dev4.4nkweb.com/relay \ No newline at end of file diff --git a/conf/nginx/assets/favicon.ico b/conf/nginx/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..1ddbac54665b3988e49822c3b7e993956100c69d GIT binary patch literal 590 zcmeH_y$XX+428c!hmKC2JN9K<1i4PST|25M>f-weK7fn6qk@BqKfPY@6*`r0PQpn7 zAqm`+83u}9eD3fB-U>=m%Ar3L>)`Yk+qTUCAp~ifvhTabwrw;`LtWP-NrLBj2*<&7 zU9v3W$gk_lJkKo4Lf`k4Wl2?4n5KzkSx6}ff`B~F>AH@hD0JU6O^oBnFbuS9OB~1e XzE2p2L{X&cuQ~qyyvMKhp#I_u(Nbj` literal 0 HcmV?d00001 diff --git a/conf/nginx/dev4.4nkweb.com-https.conf b/conf/nginx/dev4.4nkweb.com-https.conf new file mode 100644 index 0000000..709b129 --- /dev/null +++ b/conf/nginx/dev4.4nkweb.com-https.conf @@ -0,0 +1,128 @@ +server { + listen 80; + server_name dev4.4nkweb.com; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl http2; + server_name dev4.4nkweb.com; + + ssl_certificate /etc/letsencrypt/live/dev4.4nkweb.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/dev4.4nkweb.com/privkey.pem; + + # ihm_client (root) + location / { + proxy_pass http://127.0.0.1:3003; + include /etc/nginx/proxy_params; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300; + } + + # Favicon (global) + location = /favicon.ico { + root /home/debian/lecoffre_node/conf/nginx/assets; + try_files /favicon.ico =404; + access_log off; + expires 30d; + } + + # lecoffre-front + location /lecoffre/ { + proxy_pass http://127.0.0.1:3000/; + include /etc/nginx/proxy_params; + # Sub-filter to ensure assets/links are prefixed with /lecoffre + proxy_set_header Accept-Encoding ""; + sub_filter_types text/html application/javascript text/css; + sub_filter_once off; + sub_filter 'href="/' 'href="/lecoffre/'; + sub_filter 'src="/' 'src="/lecoffre/'; + sub_filter 'content="/' 'content="/lecoffre/'; + proxy_read_timeout 300; + } + + # Favicon sous /lecoffre + location = /lecoffre/favicon.ico { + root /home/debian/lecoffre_node/conf/nginx/assets; + try_files /favicon.ico =404; + access_log off; + expires 30d; + } + + # Next.js assets (served at root by the app) + location /_next/ { + proxy_pass http://127.0.0.1:3000/_next/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # lecoffre-back + location /back/ { + proxy_pass http://127.0.0.1:8080/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # blindbit + location /blindbit/ { + proxy_pass http://127.0.0.1:8000/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # signer (sdk_signer) + location /signer/ { + proxy_pass http://127.0.0.1:3001/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # storage (sdk_storage) + location /storage/ { + proxy_pass http://127.0.0.1:8081/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # WebSocket relay on /ws → 8090 + location = /ws { + 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-Forwarded-Proto https; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + proxy_pass http://127.0.0.1:8090/; + proxy_read_timeout 600s; + } + + location /ws/ { + 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-Forwarded-Proto https; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + # Strip /ws prefix when proxying to backend root + proxy_pass http://127.0.0.1:8090/; + proxy_read_timeout 600s; + } + + # Next.js HMR websocket for lecoffre-front + location /_next/webpack-hmr { + 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-Forwarded-Proto https; + proxy_buffering off; + proxy_pass http://127.0.0.1:3000/_next/webpack-hmr; + proxy_read_timeout 300; + } +} diff --git a/conf/nginx/dev4.4nkweb.com.conf b/conf/nginx/dev4.4nkweb.com.conf new file mode 100644 index 0000000..e8ca0fb --- /dev/null +++ b/conf/nginx/dev4.4nkweb.com.conf @@ -0,0 +1,125 @@ +# HTTP server for ACME and initial proxying +server { + listen 80; + server_name dev4.4nkweb.com; + + # ACME HTTP-01 challenges + location /.well-known/acme-challenge/ { + root /var/www/letsencrypt; + } + + # ihm_client (root) + location / { + proxy_pass http://127.0.0.1:3003; + include /etc/nginx/proxy_params; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 300; + } + + # Favicon (global) + location = /favicon.ico { + root /home/debian/lecoffre_node/conf/nginx/assets; + try_files /favicon.ico =404; + access_log off; + expires 30d; + } + + # lecoffre-front + location /lecoffre/ { + proxy_pass http://127.0.0.1:3000/; + include /etc/nginx/proxy_params; + # Sub-filter to ensure assets/links are prefixed with /lecoffre + proxy_set_header Accept-Encoding ""; + sub_filter_types text/html application/javascript text/css; + sub_filter_once off; + sub_filter 'href="/' 'href="/lecoffre/'; + sub_filter 'src="/' 'src="/lecoffre/'; + sub_filter 'content="/' 'content="/lecoffre/'; + proxy_read_timeout 300; + } + + # Favicon sous /lecoffre + location = /lecoffre/favicon.ico { + root /home/debian/lecoffre_node/conf/nginx/assets; + try_files /favicon.ico =404; + access_log off; + expires 30d; + } + + # Next.js assets (served at root by the app) + location /_next/ { + proxy_pass http://127.0.0.1:3000/_next/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # lecoffre-back + location /back/ { + proxy_pass http://127.0.0.1:8080/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # blindbit + location /blindbit/ { + proxy_pass http://127.0.0.1:8000/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # signer (sdk_signer) + location /signer/ { + proxy_pass http://127.0.0.1:3001/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # storage (sdk_storage) + location /storage/ { + proxy_pass http://127.0.0.1:8081/; + include /etc/nginx/proxy_params; + proxy_read_timeout 300; + } + + # WebSocket relay on /ws → 8090 + location = /ws { + 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-Forwarded-Proto http; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + proxy_pass http://127.0.0.1:8090/; + proxy_read_timeout 600s; + } + + location /ws/ { + 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-Forwarded-Proto http; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + # Strip /ws prefix when proxying to backend root + proxy_pass http://127.0.0.1:8090/; + proxy_read_timeout 600s; + } + + # Next.js HMR websocket for lecoffre-front + location /_next/webpack-hmr { + 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-Forwarded-Proto http; + proxy_buffering off; + proxy_pass http://127.0.0.1:3000/_next/webpack-hmr; + proxy_read_timeout 300; + } +} diff --git a/docker-compose.yml b/docker-compose.yml index d725e40..5dd0992 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: restart: unless-stopped bitcoin: - image: git.4nkweb.com/4nk/bitcoin:latest + image: git.4nkweb.com/4nk/bitcoin:latest container_name: bitcoin-signet depends_on: - tor @@ -137,6 +137,32 @@ services: - "com.centurylinklabs.watchtower.enable=true" restart: unless-stopped + sdk_signer: + image: git.4nkweb.com/4nk/sdk_signer:latest + container_name: sdk_signer + ports: + - "3001:3001" + networks: + btcnet: + aliases: + - sdk_signer + labels: + - "com.centurylinklabs.watchtower.enable=true" + restart: unless-stopped + + sdk_storage: + image: git.4nkweb.com/4nk/sdk_storage:latest + container_name: sdk_storage + ports: + - "8081:8081" + networks: + btcnet: + aliases: + - sdk_storage + labels: + - "com.centurylinklabs.watchtower.enable=true" + restart: unless-stopped + watchtower: image: containrrr/watchtower container_name: watchtower diff --git a/docker.gpg b/docker.gpg new file mode 100644 index 0000000..ee7872e --- /dev/null +++ b/docker.gpg @@ -0,0 +1,62 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFit2ioBEADhWpZ8/wvZ6hUTiXOwQHXMAlaFHcPH9hAtr4F1y2+OYdbtMuth +lqqwp028AqyY+PRfVMtSYMbjuQuu5byyKR01BbqYhuS3jtqQmljZ/bJvXqnmiVXh +38UuLa+z077PxyxQhu5BbqntTPQMfiyqEiU+BKbq2WmANUKQf+1AmZY/IruOXbnq +L4C1+gJ8vfmXQt99npCaxEjaNRVYfOS8QcixNzHUYnb6emjlANyEVlZzeqo7XKl7 +UrwV5inawTSzWNvtjEjj4nJL8NsLwscpLPQUhTQ+7BbQXAwAmeHCUTQIvvWXqw0N +cmhh4HgeQscQHYgOJjjDVfoY5MucvglbIgCqfzAHW9jxmRL4qbMZj+b1XoePEtht +ku4bIQN1X5P07fNWzlgaRL5Z4POXDDZTlIQ/El58j9kp4bnWRCJW0lya+f8ocodo +vZZ+Doi+fy4D5ZGrL4XEcIQP/Lv5uFyf+kQtl/94VFYVJOleAv8W92KdgDkhTcTD +G7c0tIkVEKNUq48b3aQ64NOZQW7fVjfoKwEZdOqPE72Pa45jrZzvUFxSpdiNk2tZ +XYukHjlxxEgBdC/J3cMMNRE1F4NCA3ApfV1Y7/hTeOnmDuDYwr9/obA8t016Yljj +q5rdkywPf4JF8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0+ADFdgLX9K2zrDVYUG1vo8CX0vzxFBaHwN6Px26fhIT1/hYUHQR1z +VfNDcyQmXqkOnZvvoMfz/Q0s9BhFJ/zU6AgQbIZE/hm1spsfgvtsD1frZfygXJ9f +irP+MSAI80xHSf91qSRZOj4Pl3ZJNbq4yYxv0b1pkMqeGdjdCYhLU+LZ4wbQmpCk +SVe2prlLureigXtmZfkqevRz7FrIZiu9ky8wnCAPwC7/zmS18rgP/17bOtL4/iIz +QhxAAoAMWVrGyJivSkjhSGx1uCojsWfsTAm11P7jsruIL61ZzMUVE2aM3Pmj5G+W +9AcZ58Em+1WsVnAXdUR//bMmhyr8wL/G1YO1V3JEJTRdxsSxdYa4deGBBY/Adpsw +24jxhOJR+lsJpqIUeb999+R8euDhRHG9eFO7DRu6weatUJ6suupoDTRWtr/4yGqe +dKxV3qQhNLSnaAzqW/1nA3iUB4k7kCaKZxhdhDbClf9P37qaRW467BLCVO/coL3y +Vm50dwdrNtKpMBh3ZpbB1uJvgi9mXtyBOMJ3v8RZeDzFiG8HdCtg9RvIt/AIFoHR +H3S+U79NT6i0KPzLImDfs8T7RlpyuMc4Ufs8ggyg9v3Ae6cN3eQyxcK3w0cbBwsh +/nQNfsA6uu+9H7NhbehBMhYnpNZyrHzCmzyXkauwRAqoCbGCNykTRwsur9gS41TQ +M8ssD1jFheOJf3hODnkKU+HKjvMROl1DK7zdmLdNzA1cvtZH/nCC9KPj1z8QC47S +xx+dTZSx4ONAhwbS/LN3PoKtn8LPjY9NP9uDWI+TWYquS2U+KHDrBDlsgozDbs/O +jCxcpDzNmXpWQHEtHU7649OXHP7UeNST1mCUCH5qdank0V1iejF6/CfTFU4MfcrG +YT90qFF93M3v01BbxP+EIY2/9tiIPbrd +=0YYh +-----END PGP PUBLIC KEY BLOCK----- diff --git a/docs/setup_outils.md b/docs/setup_outils.md new file mode 100644 index 0000000..6b4695a --- /dev/null +++ b/docs/setup_outils.md @@ -0,0 +1,7 @@ +# Outils installés + +Date: 2025-09-16T14:01:39+00:00 + +## Versions +### Node.js + diff --git a/nodesource_setup.sh b/nodesource_setup.sh new file mode 100644 index 0000000..82155c8 --- /dev/null +++ b/nodesource_setup.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + if ! mkdir -p /usr/share/keyrings; then + handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo" + fi + + rm -f /usr/share/keyrings/nodesource.gpg || true + rm -f /etc/apt/sources.list.d/nodesource.list || true + + # Run 'curl' and 'gpg' to download and import the NodeSource signing key + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi + + # Explicitly set the permissions to ensure the file is readable by all + if ! chmod 644 /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to set correct permissions on /usr/share/keyrings/nodesource.gpg" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully." + log "To install Node.js, run: apt-get install nodejs -y" "info" + log "You can use N|solid Runtime as a node.js alternative" "info" + log "To install N|solid Runtime, run: apt-get install nsolid -y \n" "success" + fi +} + +# Define Node.js version +NODE_VERSION="22.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/relay/sdk_relay.conf b/relay/sdk_relay.conf index 5b12aef..5af5657 100644 --- a/relay/sdk_relay.conf +++ b/relay/sdk_relay.conf @@ -4,6 +4,6 @@ wallet_name="default" network="signet" blindbit_url="http://blindbit:8000" zmq_url="tcp://bitcoin:29000" -storage="https://demo.4nkweb.com/storage" +storage="https://dev4.4nkweb.com/storage" data_dir="/home/bitcoin/.4nk" bitcoin_data_dir="/home/bitcoin/.bitcoin" \ No newline at end of file