From 765c52a4443d264cf5a9ecad6ee4bbf42876d761 Mon Sep 17 00:00:00 2001 From: rixcian Date: Thu, 14 Sep 2023 10:18:52 +0200 Subject: [PATCH 1/7] docs: add .env.example --- .env.example | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..8c506ced --- /dev/null +++ b/.env.example @@ -0,0 +1,50 @@ +# Blockchain height to start from (0 = genesis block) +# START_HEIGHT=0 + +# Blockchain height to stop at (Infinity = keep syncing until stopped) +# STOP_HEIGHT="Infinity" + +# Arweave node to use for fetching data +# TRUSTED_NODE_URL="https://arweave.net" + +# Arweave node to use for proxying requests +# TRUSTED_GATEWAY_URL="https://arweave.net" + +# ArNS gateway +# TRUSTED_ARNS_GATEWAY_URL="https://__NAME__.arweave.dev" + +# If true, use indexed data as a cache and skip fetching data from the node +# SKIP_CACHE=false + +# AR.IO node exposed port number +# PORT=4000 + +# Number from 0 to Infinity, representing the probability of a request failing +# SIMULATED_REQUEST_FAILURE_RATE=0 + +# Arweave wallet address used for staking and rewards +# AR_IO_WALLET="" + +# Admin key used for accessing the admin API +# ADMIN_API_KEY="secret" + +# If true, ar.io node will start indexing missing bundles +# BACKFILL_BUNDLE_RECORDS="false" + +# If true, all indexed bundles will be reprocessed with the new filters (you can use this when you change the filters) +# FILTER_CHANGE_REPROCESS="false" + +# Only bundles compliant with this filter will be unbundled +# ANS104_UNBUNDLE_FILTER='{"never": true}' + +# Only bundles compliant with this filter will be indexed +# ANS104_INDEX_FILTER='{"never": true}' + +# Root host for ArNS +# ARNS_ROOT_HOST="" + +# Protocol setting in process of creating sandbox domain in ArNS (ARNS_ROOT_HOST needs to be set for this env to have any effect) +# SANDBOX_PROTOCOL="" + +# If true, start indexing blocks, tx, ANS104 bundles +# START_WRITERS="true" From cbe3bd1c5f32257a86b19f5f7982a8df0ee5a8d8 Mon Sep 17 00:00:00 2001 From: rixcian Date: Thu, 14 Sep 2023 10:19:50 +0200 Subject: [PATCH 2/7] chore: add jetbrains ide cache files to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6e897ae4..4255f5a2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,8 @@ test-results.json /.vscode .DS_Store +# JetBrains +/.idea + # Exceptions !/data/.gitkeep From 81e10b4296eda8167eed147ade1a93681ad52124 Mon Sep 17 00:00:00 2001 From: David Whittington Date: Thu, 7 Sep 2023 12:14:58 -0500 Subject: [PATCH 3/7] fix(envoy): use 30 second cache control header for proxied requests PE-4552 When using a CDN we want to make sure that we do not use a long cache duration for endpoints like `/current_block` and `/height` where the response changes as each new block is produced. This change adds a Cache-Control max-age of 30 seconds for all proxied requests. In the future we will adjust this to be route specific (responses for block and TX by ID can be cached longer). --- envoy/envoy.template.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/envoy/envoy.template.yaml b/envoy/envoy.template.yaml index 8968d2b6..c95fb9a6 100644 --- a/envoy/envoy.template.yaml +++ b/envoy/envoy.template.yaml @@ -97,6 +97,10 @@ static_resources: retry_on: '5xx,reset' num_retries: 5 - match: { prefix: '/' } + response_headers_to_add: + - header: + key: 'Cache-Control' + value: 'public, max-age=30' route: cluster: legacy_gateways retry_policy: From 6bfae9358408693de036585595c343aea4f4d31f Mon Sep 17 00:00:00 2001 From: rixcian Date: Fri, 15 Sep 2023 16:28:23 +0200 Subject: [PATCH 4/7] docs: describe envs in a clear table --- docs/envs.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/envs.md diff --git a/docs/envs.md b/docs/envs.md new file mode 100644 index 00000000..907c3f3b --- /dev/null +++ b/docs/envs.md @@ -0,0 +1,22 @@ +# ENVs +This document describes the environment variables that can be used to configure the `ar.io` node. + +| ENV_NAME | TYPE | DEFAULT_VALUE | DESCRIPTION | +|--------------------------------|----------------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------| +| START_HEIGHT | Number or "Infinity" | 0 | Starting block height for node synchronization (0 = start from the beginning) | +| STOP_HEIGHT | Number or "Infinity" | "Infinity" | Stop block height for node synchronization (Infinity = keep syncing until stopped) | +| TRUSTED_NODE_URL | String | "https://arweave.net" | Arweave node to use for fetching data | +| TRUSTED_GATEWAY_URL | String | "https://arweave.net" | Arweave node to use for proxying requests | +| TRUSTED_ARNS_GATEWAY_URL | String | "https://__NAME__.arweave.dev" | ArNS gateway | +| SKIP_CACHE | Boolean | false | If true, use indexed data as a cache and skip fetching data from the node | +| PORT | Number | 4000 | AR.IO node exposed port number | +| SIMULATED_REQUEST_FAILURE_RATE | Number | 0 | Number from 0 to Infinity, representing the probability of a request failing | +| AR_IO_WALLET | String | "" | Arweave wallet address used for staking and rewards | +| ADMIN_API_KEY | String | Generated | API key used for admin API requests (if not set, it's generated and logged into the console) | +| BACKFILL_BUNDLE_RECORDS | Boolean | false | If true, ar.io node will start indexing missing bundles | +| FILTER_CHANGE_REPROCESS | Boolean | false | If true, all indexed bundles will be reprocessed with the new filters (you can use this when you change the filters) | +| ANS104_UNBUNDLE_FILTER | String | '{"never": true}' | Only bundles compliant with this filter will be unbundled | +| ANS104_INDEX_FILTER | String | '{"never": true}' | Only bundles compliant with this filter will be indexed | +| ARNS_ROOT_HOST | String | undefined | Domain name for ArNS host | +| SANDBOX_PROTOCOL | String | undefined | Protocol setting in process of creating sandbox domain in ArNS (ARNS_ROOT_HOST needs to be set for this env to have any effect) | +| START_WRITERS | Boolean | true | If true, start indexing blocks, tx, ANS104 bundles | From ad51cfed51e2cc7c4f70d74ecafb3ad20cfa3a3d Mon Sep 17 00:00:00 2001 From: rixcian Date: Fri, 15 Sep 2023 16:28:42 +0200 Subject: [PATCH 5/7] docs: update description of some envs --- .env.example | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 8c506ced..42a1bd6d 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ -# Blockchain height to start from (0 = genesis block) +# Starting block height for node synchronization (0 = start from the beginning) # START_HEIGHT=0 -# Blockchain height to stop at (Infinity = keep syncing until stopped) +# Stop block height for node synchronization (Infinity = keep syncing until stopped) # STOP_HEIGHT="Infinity" # Arweave node to use for fetching data @@ -29,10 +29,10 @@ # ADMIN_API_KEY="secret" # If true, ar.io node will start indexing missing bundles -# BACKFILL_BUNDLE_RECORDS="false" +# BACKFILL_BUNDLE_RECORDS=false # If true, all indexed bundles will be reprocessed with the new filters (you can use this when you change the filters) -# FILTER_CHANGE_REPROCESS="false" +# FILTER_CHANGE_REPROCESS=false # Only bundles compliant with this filter will be unbundled # ANS104_UNBUNDLE_FILTER='{"never": true}' @@ -47,4 +47,4 @@ # SANDBOX_PROTOCOL="" # If true, start indexing blocks, tx, ANS104 bundles -# START_WRITERS="true" +# START_WRITERS=true From 1b02cb1f04a6288e5965f3a7c109d30010350c0b Mon Sep 17 00:00:00 2001 From: rixcian Date: Sat, 23 Sep 2023 09:16:44 +0200 Subject: [PATCH 6/7] docs: add missing envs --- .env.example | 6 ++++++ docs/envs.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.env.example b/.env.example index 42a1bd6d..2704c0c5 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,12 @@ # If true, use indexed data as a cache and skip fetching data from the node # SKIP_CACHE=false +# Adds an "INSTANCE_ID" field to output logs +# INSTANCE_ID="" + +# Sets the format of output logs, accepts "simple" and "json" +# LOG_FORMAT="simple" + # AR.IO node exposed port number # PORT=4000 diff --git a/docs/envs.md b/docs/envs.md index 907c3f3b..d1e0d320 100644 --- a/docs/envs.md +++ b/docs/envs.md @@ -8,6 +8,8 @@ This document describes the environment variables that can be used to configure | TRUSTED_NODE_URL | String | "https://arweave.net" | Arweave node to use for fetching data | | TRUSTED_GATEWAY_URL | String | "https://arweave.net" | Arweave node to use for proxying requests | | TRUSTED_ARNS_GATEWAY_URL | String | "https://__NAME__.arweave.dev" | ArNS gateway | +| INSTANCE_ID | String | "" | Adds an "INSTACE_ID" field to output logs | +| LOG_FORMAT | String | "simple" | Sets the format of output logs, accepts "simple" and "json" | | SKIP_CACHE | Boolean | false | If true, use indexed data as a cache and skip fetching data from the node | | PORT | Number | 4000 | AR.IO node exposed port number | | SIMULATED_REQUEST_FAILURE_RATE | Number | 0 | Number from 0 to Infinity, representing the probability of a request failing | From d4ab33e7d361b2dbd10667652fc569b890bc57ed Mon Sep 17 00:00:00 2001 From: rixcian Date: Sat, 23 Sep 2023 09:19:55 +0200 Subject: [PATCH 7/7] docs: remove single quotes from envs --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 2704c0c5..4fbcf2d2 100644 --- a/.env.example +++ b/.env.example @@ -41,10 +41,10 @@ # FILTER_CHANGE_REPROCESS=false # Only bundles compliant with this filter will be unbundled -# ANS104_UNBUNDLE_FILTER='{"never": true}' +# ANS104_UNBUNDLE_FILTER={"never": true} # Only bundles compliant with this filter will be indexed -# ANS104_INDEX_FILTER='{"never": true}' +# ANS104_INDEX_FILTER={"never": true} # Root host for ArNS # ARNS_ROOT_HOST=""