From ea393c523dcc30d3a6e8dc562c966a882294ad89 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Sun, 16 Jul 2023 14:55:02 -0700 Subject: [PATCH] Fix nginx_conf example. --- README.md | 1 + defaults/main.yml | 4 +-- docs/examples/nginx_conf.yml | 49 +++++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 98417fe..ef78149 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ See [dojo-exporter](https://github.com/bleetube/dojo_exporter) ```bash podman logs --follow dojo podman inspect dojo | jq .[].Config.Env +ngrep -d lo port 80 -W byline ``` ## Resources diff --git a/defaults/main.yml b/defaults/main.yml index a577302..a1230b6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -25,8 +25,8 @@ samourai_dojo_config: # ~/src/samourai-dojo/docker/my-dojo/conf/docker-common.conf.tpl COMMON_BTC_NETWORK: mainnet # ~/src/samourai-dojo/docker/my-dojo/conf/docker-node.conf.tpl - NODE_API_KEY: "{{ lookup('ansible.builtin.env', 'SAMOURAI_DOJO_API') }}" - NODE_ADMIN_KEY: "{{ lookup('ansible.builtin.env', 'SAMOURAI_DOJO_ADMIN') }}" + NODE_API_KEY: "{{ lookup('ansible.builtin.env', 'SAMOURAI_DOJO_API') }}" # wallet + NODE_ADMIN_KEY: "{{ lookup('ansible.builtin.env', 'SAMOURAI_DOJO_ADMIN') }}" # admin and dojo_exporter NODE_JWT_SECRET: "{{ lookup('ansible.builtin.env', 'SAMOURAI_DOJO_JWT') }}" NODE_ACTIVE_INDEXER: local_indexer NODE_FEE_TYPE: ECONOMICAL diff --git a/docs/examples/nginx_conf.yml b/docs/examples/nginx_conf.yml index 791b9ce..4f1efd8 100644 --- a/docs/examples/nginx_conf.yml +++ b/docs/examples/nginx_conf.yml @@ -20,16 +20,53 @@ access: - off locations: + # Proxy WebSocket connections first + - location: /v2/inv + proxy: + pass: "http://127.0.0.1:{{ samourai_dojo_ws_http_port|default(8080)}}" + http_version: '1.1' + set_header: + - field: Host + value: $http_host + - field: Connection + value: $connection_upgrade + - field: Upgrade + value: $http_upgrade + # PushTX server is separate, so proxy first + - location: /v2/pushtx/ + proxy: + pass: "http://127.0.0.1:{{ samourai_dojo_pushtx_http_port|default(8081)}}/" + # Tracker server is separate, so proxy first + - location: /v2/tracker/ + proxy: + pass: "http://127.0.0.1:{{ samourai_dojo_tracker_http_port|default(8082)}}/" + # Proxy requests to maintenance tool + - location: /admin/ + proxy: + pass: "http://127.0.0.1:{{ samourai_dojo_ws_http_port|default(8080)}}/static/admin/" + # Proxy all other v2 requests to the accounts server + - location: /v2/ + proxy: + pass: "http://127.0.0.1:{{ samourai_dojo_ws_http_port|default(8080)}}/" + # Redirect onion address to maintenance tool - location: = / rewrite: return: url: /admin code: 301 - - location: /admin/ - proxy: - pass: "http://127.0.0.1:{{ samourai_dojo_ws_http_port|default(8080)}}/static/admin/" + # Serve remaining requests + - location: / + rewrite: + return: + code: 200 + text: > + '{"status":"ok"}' + headers: + add_headers: + - name: Content-Type + value: application/json - core: - server_name: "{{ samourai_dojo_onion }}" + server_name: "{{ samourai_dojo_onion_address|default('_') }}" listen: - address: "127.0.0.1:{{ samourai_dojo_onion_port|default(80) }}" send_timeout: 600s @@ -37,7 +74,7 @@ access: - off locations: - # Proxy WebSocket connections first + # Proxy WebSocket connections first - location: /v2/inv proxy: pass: "http://127.0.0.1:{{ samourai_dojo_ws_http_port|default(8080)}}" @@ -96,4 +133,4 @@ headers: add_headers: - name: Content-Type - value: application/json + value: application/json \ No newline at end of file