From f1346f23ada3bce7b414e68cfb2c275112e9bdbc Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 20 Sep 2021 22:20:48 +0200 Subject: [PATCH 01/35] expose skylink endpoint over external domains --- docker/nginx/conf.d/include/location-hns | 2 +- docker/nginx/conf.d/include/location-skylink | 4 ++-- docker/nginx/conf.d/server/server.dnslink | 21 ++++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docker/nginx/conf.d/include/location-hns b/docker/nginx/conf.d/include/location-hns index bd5644fd..8cc662da 100644 --- a/docker/nginx/conf.d/include/location-hns +++ b/docker/nginx/conf.d/include/location-hns @@ -75,7 +75,7 @@ access_by_lua_block { end } -# we proxy to another nginx location rather than directly to siad because we don't want to deal with caching here +# we proxy to another nginx location rather than directly to siad because we do not want to deal with caching here proxy_pass https://127.0.0.1/$skylink$path$is_args$args; # in case siad returns location header, we need to replace the skylink with the domain name diff --git a/docker/nginx/conf.d/include/location-skylink b/docker/nginx/conf.d/include/location-skylink index 96dfacef..a3692d00 100644 --- a/docker/nginx/conf.d/include/location-skylink +++ b/docker/nginx/conf.d/include/location-skylink @@ -12,7 +12,7 @@ if ($request_method = PURGE) { limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time # $skylink_v1 and $skylink_v2 variables default to the same value but in case the requested skylink was: -# a) skylink v1 - it wouldn't matter, no additional logic is executed +# a) skylink v1 - it would not matter, no additional logic is executed # b) skylink v2 - in a lua block below we will resolve the skylink v2 into skylink v1 and update # $skylink_v1 variable so then the proxy request to skyd can be cached in nginx (proxy_cache_key # in proxy-cache-downloads includes $skylink_v1 as a part of the cache key) @@ -91,7 +91,7 @@ limit_rate $limit_rate; proxy_read_timeout 600; proxy_set_header User-Agent: Sia-Agent; -# in case the requested skylink was v2 and we already resolved it to skylink v1, we're going to pass resolved +# in case the requested skylink was v2 and we already resolved it to skylink v1, we are going to pass resolved # skylink v1 to skyd to save that extra skylink v2 lookup in skyd but in turn, in case skyd returns a redirect # we need to rewrite the skylink v1 to skylink v2 in the location header with proxy_redirect proxy_redirect $skylink_v1 $skylink_v2; diff --git a/docker/nginx/conf.d/server/server.dnslink b/docker/nginx/conf.d/server/server.dnslink index db8948e3..e04c5a7a 100644 --- a/docker/nginx/conf.d/server/server.dnslink +++ b/docker/nginx/conf.d/server/server.dnslink @@ -11,15 +11,24 @@ location / { local res, err = httpc:request_uri("http://10.10.10.55:3100/dnslink/" .. ngx.var.host) if err or (res and res.status ~= ngx.HTTP_OK) then - ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status - ngx.header["content-type"] = "text/plain" - ngx.say(err or res.body) - ngx.exit(ngx.status) + -- check whether we can fallback to regular skylink request + local match_skylink = ngx.re.match(ngx.var.uri, "^/([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?") + + if match_skylink then + ngx.var.skylink = match_skylink[1] + ngx.var.path = match_skylink[2] + else + ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status + ngx.header["content-type"] = "text/plain" + ngx.say(err or res.body) + ngx.exit(ngx.status) + end else ngx.var.skylink = res.body - ngx.var.skylink_v1 = ngx.var.skylink - ngx.var.skylink_v2 = ngx.var.skylink end + + ngx.var.skylink_v1 = ngx.var.skylink + ngx.var.skylink_v2 = ngx.var.skylink } include /etc/nginx/conf.d/include/location-skylink; From a96158d5a432e9bbee7096a706be097323ae2410 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 20 Sep 2021 22:28:38 +0200 Subject: [PATCH 02/35] add / --- docker/nginx/conf.d/server/server.dnslink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/nginx/conf.d/server/server.dnslink b/docker/nginx/conf.d/server/server.dnslink index e04c5a7a..06e3e3ca 100644 --- a/docker/nginx/conf.d/server/server.dnslink +++ b/docker/nginx/conf.d/server/server.dnslink @@ -16,7 +16,7 @@ location / { if match_skylink then ngx.var.skylink = match_skylink[1] - ngx.var.path = match_skylink[2] + ngx.var.path = match_skylink[2] or "/" else ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status ngx.header["content-type"] = "text/plain" From b6a165cb281e384f758b87119733254d8fbbff15 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Tue, 19 Oct 2021 16:10:41 +0200 Subject: [PATCH 03/35] Make sure db restore works reliably and overwrites backup collections. --- scripts/db_restore.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/db_restore.sh b/scripts/db_restore.sh index 79e6e0f7..7ae0e6b0 100755 --- a/scripts/db_restore.sh +++ b/scripts/db_restore.sh @@ -85,20 +85,22 @@ if [ "$totalFoundObjects" -eq "0" ]; then echo "This backup doesn't exist!" exit 1 fi +cd $csd/.. # Get the backup from S3: aws s3 cp $S3_BACKUP_PATH/$BACKUP/mongo.tgz mongo.tgz # Prepare a clean `to_restore` dir: -rm -rf $csd/../docker/data/mongo/db/backups/to_restore -mkdir -p $csd/../docker/data/mongo/db/backups/to_restore +rm -rf docker/data/mongo/db/backups/to_restore +mkdir -p docker/data/mongo/db/backups/to_restore # Decompress the backup: -tar -xzf mongo.tgz -C $csd/../docker/data/mongo/db/backups/to_restore +tar -xzf mongo.tgz -C docker/data/mongo/db/backups/to_restore rm mongo.tgz # Restore the backup: # The name of the backup is not `mongo` due to the way we're creating it, # it's $BACKUP. docker exec mongo \ - mongorestore \ + mongorestore --drop \ mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \ /data/db/backups/to_restore/$BACKUP # Clean up: -rm -rf $csd/../docker/data/mongo/db/backups/to_restore +rm -rf docker/data/mongo/db/backups/to_restore +cd - From 96a85e3ec47c8039c22fe5aa0d67bdf1806cba69 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Tue, 19 Oct 2021 17:10:31 +0200 Subject: [PATCH 04/35] Add an update for awscli. Restore the backtracking paths. --- scripts/db_restore.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/db_restore.sh b/scripts/db_restore.sh index 7ae0e6b0..bcd6b24c 100755 --- a/scripts/db_restore.sh +++ b/scripts/db_restore.sh @@ -1,5 +1,8 @@ #!/bin/bash +# First of all, let's pamper awscli because Python is so special: +pip3 install --upgrade awscli + BACKUP=$1 if [[ $BACKUP == "" ]]; then echo "No backup name given. It should look like '2020-01-29'." @@ -89,18 +92,17 @@ cd $csd/.. # Get the backup from S3: aws s3 cp $S3_BACKUP_PATH/$BACKUP/mongo.tgz mongo.tgz # Prepare a clean `to_restore` dir: -rm -rf docker/data/mongo/db/backups/to_restore -mkdir -p docker/data/mongo/db/backups/to_restore +rm -rf $csd/../docker/data/mongo/db/backups/to_restore +mkdir -p $csd/../docker/data/mongo/db/backups/to_restore # Decompress the backup: -tar -xzf mongo.tgz -C docker/data/mongo/db/backups/to_restore +tar -xzf mongo.tgz -C $csd/../docker/data/mongo/db/backups/to_restore rm mongo.tgz # Restore the backup: # The name of the backup is not `mongo` due to the way we're creating it, # it's $BACKUP. docker exec mongo \ - mongorestore --drop \ + mongorestore -- drop\ mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \ /data/db/backups/to_restore/$BACKUP # Clean up: -rm -rf docker/data/mongo/db/backups/to_restore -cd - +rm -rf $csd/../docker/data/mongo/db/backups/to_restore From 8bb5e24e24a364edbcb0e32cf0657063bc0b0ae4 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Tue, 19 Oct 2021 17:12:00 +0200 Subject: [PATCH 05/35] Fix fingers-faster-than-brain bug. --- scripts/db_restore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/db_restore.sh b/scripts/db_restore.sh index bcd6b24c..6e64671e 100755 --- a/scripts/db_restore.sh +++ b/scripts/db_restore.sh @@ -101,7 +101,7 @@ rm mongo.tgz # The name of the backup is not `mongo` due to the way we're creating it, # it's $BACKUP. docker exec mongo \ - mongorestore -- drop\ + mongorestore --drop \ mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \ /data/db/backups/to_restore/$BACKUP # Clean up: From e541669a652b298f62f9b47a9c14978d7291f873 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Tue, 19 Oct 2021 17:13:05 +0200 Subject: [PATCH 06/35] Remove merge leftovers. --- scripts/db_restore.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/db_restore.sh b/scripts/db_restore.sh index 6e64671e..f19def85 100755 --- a/scripts/db_restore.sh +++ b/scripts/db_restore.sh @@ -88,7 +88,6 @@ if [ "$totalFoundObjects" -eq "0" ]; then echo "This backup doesn't exist!" exit 1 fi -cd $csd/.. # Get the backup from S3: aws s3 cp $S3_BACKUP_PATH/$BACKUP/mongo.tgz mongo.tgz # Prepare a clean `to_restore` dir: From 96c634b6e776079ae692a87d0849a569c80237a8 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Thu, 21 Oct 2021 10:40:33 +0200 Subject: [PATCH 07/35] Backup MongoDB before CockroachDB because we can backfill user registrations in MongoDB but not in CockroachDB. --- scripts/db_backup.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/db_backup.sh b/scripts/db_backup.sh index 14f7abb1..32e042ce 100755 --- a/scripts/db_backup.sh +++ b/scripts/db_backup.sh @@ -27,26 +27,6 @@ fi # Take the current datetime: DT=$(date +%Y-%m-%d) -### COCKROACH DB ### -echo "Creating a backup of CockroachDB:" -# Check if a backup already exists: -totalFoundObjects=$(aws s3 ls $S3_BACKUP_PATH/$DT --recursive --summarize | grep "cockroach" | wc -l) -if [ "$totalFoundObjects" -ge "1" ]; then - echo "Backup already exists for today. Skipping." -else - # Create a cockroachdb backup: - docker exec cockroach \ - cockroach sql \ - --host cockroach:26257 \ - --certs-dir=/certs \ - --execute="BACKUP TO '$S3_BACKUP_PATH/$DT/cockroach/?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';" - if [[ $? > 0 ]]; then - echo "Creating a CockroachDB backup failed. Skipping." - else - echo "Successfully backed up CockroachDB." - fi -fi - ### MONGO DB ### echo "Creating a backup of MongoDB:" # Check if a backup already exists: @@ -73,3 +53,23 @@ else fi docker exec mongo rm -rf /data/db/backups/$DT fi + +### COCKROACH DB ### +echo "Creating a backup of CockroachDB:" +# Check if a backup already exists: +totalFoundObjects=$(aws s3 ls $S3_BACKUP_PATH/$DT --recursive --summarize | grep "cockroach" | wc -l) +if [ "$totalFoundObjects" -ge "1" ]; then + echo "Backup already exists for today. Skipping." +else + # Create a cockroachdb backup: + docker exec cockroach \ + cockroach sql \ + --host cockroach:26257 \ + --certs-dir=/certs \ + --execute="BACKUP TO '$S3_BACKUP_PATH/$DT/cockroach/?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';" + if [[ $? > 0 ]]; then + echo "Creating a CockroachDB backup failed. Skipping." + else + echo "Successfully backed up CockroachDB." + fi +fi From 9e4ac0eb38609d799e1b8cc34cf95a0eb1ddc449 Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Thu, 21 Oct 2021 14:41:24 -0400 Subject: [PATCH 08/35] add missing servers and missing blocklist command to script --- scripts/blocklist-skylink.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index 80885b14..528779ca 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -38,20 +38,30 @@ fi # iterate through all servers, block the skylinks and purge it from cache ######################################################################### declare -a servers=( "eu-ger-1.siasky.net" "eu-ger-2.siasky.net" "eu-ger-3.siasky.net" "eu-ger-4.siasky.net" "eu-ger-5.siasky.net" "eu-ger-6.siasky.net" "eu-ger-7.siasky.net" "eu-ger-8.siasky.net" - "eu-fin-1.siasky.net" "eu-fin-2.siasky.net" "eu-fin-3.siasky.net" "eu-fin-4.siasky.net" - "eu-pol-1.siasky.net" "eu-pol-2.siasky.net" "eu-pol-3.siasky.net" + "eu-ger-9.siasky.net" "eu-ger-10.siasky.net" "eu-ger-11.siasky.net" "eu-ger-12.siasky.net" + "eu-fin-1.siasky.net" "eu-fin-2.siasky.net" "eu-fin-3.siasky.net" "eu-fin-4.siasky.net" "eu-fin-5.siasky.net" "eu-fin-6.siasky.net" "eu-fin-7-siasky.net" "eu-fin-8.siasky.net" + "eu-fin-9.siasky.net" "eu-fin-10.siasky.net" "eu-fin-11.siasky.net" "eu-fin-12.siasky.net" "eu-fin-13.siasky.net" "eu-fin-14.siasky.net" "eu-fin-15.siasky.net" + "eu-pol-1.siasky.net" "eu-pol-2.siasky.net" "eu-pol-3.siasky.net" "eu-pol-4.siasky.net" "eu-pol-5.siasky.net" + "us-ny-1.siasky.net" "us-ny-2.siasky.net" "us-or-1.siasky.net" "us-or-2.siasky.net" + "us-la-1.siasky.net" "us-la-2.siasky.net" "us-la-3.siasky.net" "us-pa-1.siasky.net" "us-pa-2.siasky.net" - "us-va-1.siasky.net" "us-va-2.siasky.net" "us-va-3.siasky.net" - "as-hk-1.siasky.net" + "us-va-1.siasky.net" "us-va-2.siasky.net" "us-va-3.siasky.net" "us-va-4.siasky.net" "us-va-5.siasky.net" "us-va-6.siasky.net" + "as-hk-1.siasky.net" "as-sp-1.siasky.net" "as-sp-2.siasky.net" "siasky.xyz" "dev1.siasky.dev" "dev2.siasky.dev" "dev3.siasky.dev") for server in "${servers[@]}"; do for skylink in "${skylinks[@]}"; do echo ".. ⌁ Blocking skylink ${skylink} on ${server}" + + # Add to blocklist + ssh -q -t user@${server} "docker exec sia siac skynet blocklist add ${skylink}" + + # Remove from NGINX cache cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Elsq '^Skynet-Skylink: ${skylink}'" ssh -q -t user@${server} "docker exec -it nginx bash -c ${cached_files_command} | xargs -r rm" + echo ".. ⌁ Skylink ${skylink} Blocked on ${server}" echo "--------------------------------------------" done From bd8b2bdc0aac63b0d48b1eb1d530bdf7c5a243cd Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Thu, 21 Oct 2021 14:44:45 -0400 Subject: [PATCH 09/35] Changelog file --- changelog/items/bugs-fixed/add-missing-blocklist-cmd.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/items/bugs-fixed/add-missing-blocklist-cmd.md diff --git a/changelog/items/bugs-fixed/add-missing-blocklist-cmd.md b/changelog/items/bugs-fixed/add-missing-blocklist-cmd.md new file mode 100644 index 00000000..3d72b402 --- /dev/null +++ b/changelog/items/bugs-fixed/add-missing-blocklist-cmd.md @@ -0,0 +1 @@ +- Add missing servers and blocklist command to the manual blocklist script. From 3e8c8a5d016b381e749ab3d00a36d7e6e35137b4 Mon Sep 17 00:00:00 2001 From: Filip Rysavy <29089732+firyx@users.noreply.github.com> Date: Fri, 22 Oct 2021 10:23:06 +0200 Subject: [PATCH 10/35] Fix blocklist skylink script --- changelog/items/bugs-fixed/fix-blocklist-skylink.md | 2 ++ scripts/blocklist-skylink.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/items/bugs-fixed/fix-blocklist-skylink.md diff --git a/changelog/items/bugs-fixed/fix-blocklist-skylink.md b/changelog/items/bugs-fixed/fix-blocklist-skylink.md new file mode 100644 index 00000000..b7b6d38d --- /dev/null +++ b/changelog/items/bugs-fixed/fix-blocklist-skylink.md @@ -0,0 +1,2 @@ +- Fix `blocklist-skylink.sh` script that didn't removed blocked skylink from + nginx cache. \ No newline at end of file diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index 80885b14..25b4df29 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -50,7 +50,7 @@ do for skylink in "${skylinks[@]}"; do echo ".. ⌁ Blocking skylink ${skylink} on ${server}" - cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Elsq '^Skynet-Skylink: ${skylink}'" + cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ${skylink}'" ssh -q -t user@${server} "docker exec -it nginx bash -c ${cached_files_command} | xargs -r rm" echo ".. ⌁ Skylink ${skylink} Blocked on ${server}" echo "--------------------------------------------" From a673a7cb9a1d16bc387a5777edeb53a1dea91b9c Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Fri, 22 Oct 2021 12:06:01 -0400 Subject: [PATCH 11/35] Enabling account module --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 024300ba..3f94c3ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: restart: unless-stopped logging: *default-logging environment: - - SIA_MODULES=gctwr + - SIA_MODULES=gctwra - MONGODB_URI=mongodb://${SKYNET_DB_HOST}:${SKYNET_DB_PORT} - MONGODB_USER=${SKYNET_DB_USER} - MONGODB_PASSWORD=${SKYNET_DB_PASS} From a0077827935121860f916cad584cba7da686f1bb Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Fri, 22 Oct 2021 12:07:41 -0400 Subject: [PATCH 12/35] Add changelog file --- changelog/items/other/enable-accounting.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/items/other/enable-accounting.md diff --git a/changelog/items/other/enable-accounting.md b/changelog/items/other/enable-accounting.md new file mode 100644 index 00000000..4771bbe0 --- /dev/null +++ b/changelog/items/other/enable-accounting.md @@ -0,0 +1 @@ +- Enable the accounting module for skyd From efc70a49f018a12ec8fe64309af5bfcd387e5ffc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:06:49 +0000 Subject: [PATCH 13/35] Bump tailwindcss from 2.2.16 to 2.2.17 in /packages/dashboard Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 2.2.16 to 2.2.17. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/v2.2.17/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v2.2.16...v2.2.17) --- updated-dependencies: - dependency-name: tailwindcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/dashboard/package.json | 2 +- packages/dashboard/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json index ed4adefd..24703df8 100644 --- a/packages/dashboard/package.json +++ b/packages/dashboard/package.json @@ -34,7 +34,7 @@ "stripe": "8.183.0", "superagent": "6.1.0", "swr": "1.0.1", - "tailwindcss": "2.2.16", + "tailwindcss": "2.2.17", "yup": "0.32.11" }, "resolutions": { diff --git a/packages/dashboard/yarn.lock b/packages/dashboard/yarn.lock index 329476e4..b2c85043 100644 --- a/packages/dashboard/yarn.lock +++ b/packages/dashboard/yarn.lock @@ -2982,10 +2982,10 @@ swr@1.0.1: dependencies: dequal "2.0.2" -tailwindcss@2.2.16: - version "2.2.16" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.16.tgz#32f81bdf1758b639cb83b9d30bf7cbecdda49e5e" - integrity sha512-EireCtpQyyJ4Xz8NYzHafBoy4baCOO96flM0+HgtsFcIQ9KFy/YBK3GEtlnD+rXen0e4xm8t3WiUcKBJmN6yjg== +tailwindcss@2.2.17: + version "2.2.17" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.17.tgz#c6332731f9ff1b6628ff589c95c38685347775e3" + integrity sha512-WgRpn+Pxn7eWqlruxnxEbL9ByVRWi3iC10z4b6dW0zSdnkPVC4hPMSWLQkkW8GCyBIv/vbJ0bxIi9dVrl4CfoA== dependencies: arg "^5.0.1" bytes "^3.0.0" From 0584f45336da1f7c6f79729807bb8b01dfe92082 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:06:59 +0000 Subject: [PATCH 14/35] Bump stripe from 8.183.0 to 8.184.0 in /packages/dashboard Bumps [stripe](https://github.com/stripe/stripe-node) from 8.183.0 to 8.184.0. - [Release notes](https://github.com/stripe/stripe-node/releases) - [Changelog](https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/stripe/stripe-node/compare/v8.183.0...v8.184.0) --- updated-dependencies: - dependency-name: stripe dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/dashboard/package.json | 2 +- packages/dashboard/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json index ed4adefd..fbd5e554 100644 --- a/packages/dashboard/package.json +++ b/packages/dashboard/package.json @@ -31,7 +31,7 @@ "react-dom": "17.0.2", "react-toastify": "8.0.3", "skynet-js": "3.0.2", - "stripe": "8.183.0", + "stripe": "8.184.0", "superagent": "6.1.0", "swr": "1.0.1", "tailwindcss": "2.2.16", diff --git a/packages/dashboard/yarn.lock b/packages/dashboard/yarn.lock index 329476e4..ccaf296b 100644 --- a/packages/dashboard/yarn.lock +++ b/packages/dashboard/yarn.lock @@ -2905,10 +2905,10 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= -stripe@8.183.0: - version "8.183.0" - resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.183.0.tgz#3dc183fafff618526a576a0d9972483b08075e06" - integrity sha512-QcM3nimH1CuP49VPPRt36Wgfu4QoS+Wm0eyGMis7Ej+seWFKqMffMdx7TE2gn8dVsJIOA1kDuIbAQGqpZHozGA== +stripe@8.184.0: + version "8.184.0" + resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.184.0.tgz#ea68470ca6045bb47516c4fea3b775fd6ce15a36" + integrity sha512-ZUdvyX+sizTxXLEbUjgTShrulSWSkMIt7hIKdAkhnajYrHdzVtdmhBJl8sQbR9chMVox3Ig5ohilyeIrvcCE2g== dependencies: "@types/node" ">=8.1.0" qs "^6.6.0" From a6d6182ed28bc2ef86363a572c56ed0275505305 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:07:28 +0000 Subject: [PATCH 15/35] Bump @stripe/stripe-js from 1.20.2 to 1.20.3 in /packages/dashboard Bumps [@stripe/stripe-js](https://github.com/stripe/stripe-js) from 1.20.2 to 1.20.3. - [Release notes](https://github.com/stripe/stripe-js/releases) - [Commits](https://github.com/stripe/stripe-js/compare/v1.20.2...v1.20.3) --- updated-dependencies: - dependency-name: "@stripe/stripe-js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/dashboard/package.json | 2 +- packages/dashboard/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json index ed4adefd..5cf83767 100644 --- a/packages/dashboard/package.json +++ b/packages/dashboard/package.json @@ -11,7 +11,7 @@ "@fontsource/metropolis": "4.5.0", "@ory/kratos-client": "0.5.4-alpha.1", "@stripe/react-stripe-js": "1.6.0", - "@stripe/stripe-js": "1.20.2", + "@stripe/stripe-js": "1.20.3", "@tailwindcss/forms": "0.3.4", "autoprefixer": "10.3.7", "classnames": "2.3.1", diff --git a/packages/dashboard/yarn.lock b/packages/dashboard/yarn.lock index 329476e4..f8a54b75 100644 --- a/packages/dashboard/yarn.lock +++ b/packages/dashboard/yarn.lock @@ -188,10 +188,10 @@ dependencies: prop-types "^15.7.2" -"@stripe/stripe-js@1.20.2": - version "1.20.2" - resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.20.2.tgz#5bb8deff1ba6cdc83d0bfac58e4d61fe2e4a53e7" - integrity sha512-gTPpXQgAgKrAAvV2R5WO4NCuozALD4n3xaDLhPv+nAomIdPLtgEwI2xIGY7WMSKp9KfkKmlcjoPO4pkz8f/bpw== +"@stripe/stripe-js@1.20.3": + version "1.20.3" + resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.20.3.tgz#6f479d53ad933b8b17b6c708bbc2840b7512d80e" + integrity sha512-pFhPvajrZJUzoOZDC3/2YsOeL5VD63CVlbOXs+AriIchmy6Kb2CQqrcHPCuK72FM726lwo4neF0wPRBtsLYXuw== "@tailwindcss/forms@0.3.4": version "0.3.4" From f8736088a327907b2ee044898b98979078bcf063 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:08:35 +0000 Subject: [PATCH 16/35] Bump node in /packages/health-check Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/health-check/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index dbf0a774..db117f1b 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine RUN apk update && apk add dnsmasq From 6fbe0fff8e5dad2ac6f40e01657140a2aad2047a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:08:39 +0000 Subject: [PATCH 17/35] Bump node from 16.11.1-alpine to 16.12.0-alpine in /packages/website Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/website/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index d67627e1..ae025cb2 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine RUN apk update && apk add autoconf automake build-base libtool nasm pkgconfig From 9d773685a8d03c49b45f337779b01cca05fea0db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:12:43 +0000 Subject: [PATCH 18/35] Bump gatsby-plugin-robots-txt from 1.6.10 to 1.6.13 in /packages/website Bumps [gatsby-plugin-robots-txt](https://github.com/mdreizin/gatsby-plugin-robots-txt) from 1.6.10 to 1.6.13. - [Release notes](https://github.com/mdreizin/gatsby-plugin-robots-txt/releases) - [Commits](https://github.com/mdreizin/gatsby-plugin-robots-txt/compare/v1.6.10...v1.6.13) --- updated-dependencies: - dependency-name: gatsby-plugin-robots-txt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/website/package.json | 2 +- packages/website/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/website/package.json b/packages/website/package.json index d147dadd..5a62b9c2 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -25,7 +25,7 @@ "gatsby-plugin-postcss": "^4.14.0", "gatsby-plugin-purgecss": "^6.0.2", "gatsby-plugin-react-helmet": "^4.14.0", - "gatsby-plugin-robots-txt": "^1.6.10", + "gatsby-plugin-robots-txt": "^1.6.13", "gatsby-plugin-sharp": "^3.14.1", "gatsby-plugin-svgr": "^3.0.0-beta.0", "gatsby-remark-classes": "^1.0.2", diff --git a/packages/website/yarn.lock b/packages/website/yarn.lock index f5f36f91..d6e96200 100644 --- a/packages/website/yarn.lock +++ b/packages/website/yarn.lock @@ -6159,10 +6159,10 @@ gatsby-plugin-react-helmet@^4.14.0: dependencies: "@babel/runtime" "^7.15.4" -gatsby-plugin-robots-txt@^1.6.10: - version "1.6.10" - resolved "https://registry.yarnpkg.com/gatsby-plugin-robots-txt/-/gatsby-plugin-robots-txt-1.6.10.tgz#b178efe3da65718a39d1acd2e5768f687b205cf0" - integrity sha512-soQT765LF0J8/dfrZGFuA/ZB/JUyvt2nVyHEFLUMd/qxgiem9x0EOZquJPId78xDHYePMkxNCPk9UsLcTZdFZw== +gatsby-plugin-robots-txt@^1.6.13: + version "1.6.13" + resolved "https://registry.yarnpkg.com/gatsby-plugin-robots-txt/-/gatsby-plugin-robots-txt-1.6.13.tgz#01e1ce68e3f4e07f957ac9a20cd2a9e12fdd3f79" + integrity sha512-MUPJsvkALwSmfRb1L3IVNmzIqwV35fol1RVot425ZYXvtD+s0OtZli5VnhLNxsX0beodyavzFl0SRJCCQZz0/g== dependencies: "@babel/runtime" "^7.14.0" generate-robotstxt "^8.0.3" From 83fcea5f98bb57f74ab022751809bde3fa84dffa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:14:40 +0000 Subject: [PATCH 19/35] Bump gatsby from 3.14.3 to 3.14.4 in /packages/website Bumps [gatsby](https://github.com/gatsbyjs/gatsby) from 3.14.3 to 3.14.4. - [Release notes](https://github.com/gatsbyjs/gatsby/releases) - [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/CHANGELOG.md) - [Commits](https://github.com/gatsbyjs/gatsby/compare/gatsby@3.14.3...gatsby@3.14.4) --- updated-dependencies: - dependency-name: gatsby dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/website/package.json | 2 +- packages/website/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/website/package.json b/packages/website/package.json index d147dadd..3d5e85e3 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -15,7 +15,7 @@ "copy-text-to-clipboard": "^3.0.1", "crypto-browserify": "^3.12.0", "framer-motion": "^4.1.17", - "gatsby": "^3.14.3", + "gatsby": "^3.14.4", "gatsby-background-image": "^1.5.3", "gatsby-image": "^3.11.0", "gatsby-plugin-image": "^1.14.1", diff --git a/packages/website/yarn.lock b/packages/website/yarn.lock index f5f36f91..3786dddb 100644 --- a/packages/website/yarn.lock +++ b/packages/website/yarn.lock @@ -6464,10 +6464,10 @@ gatsby-worker@^0.5.0: "@babel/core" "^7.15.5" "@babel/runtime" "^7.15.4" -gatsby@^3.14.3: - version "3.14.3" - resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-3.14.3.tgz#62bc020d0997f4b30e419abe644f60483f99e8b5" - integrity sha512-B6NmmIvGGVNktky0YGugxMJlZAbKEzGMMBA8ojbaDhfEzfNXxsyHYd0aHKL0fNwPEqMKUsllaACdXrw6CWRk2g== +gatsby@^3.14.4: + version "3.14.4" + resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-3.14.4.tgz#e7ef5c3c1eda45ea3ad0bc1273f014fbc46b316c" + integrity sha512-cpsMhl2qkE0+TL0znwflVfycy143fFucGtFDkNxu8dbY0GRjA9MiDwlS/aSqg5U2HhhF39IcBvwuntiaP6vQ0g== dependencies: "@babel/code-frame" "^7.14.0" "@babel/core" "^7.15.5" From d0b01c8932634f779d8737602596045bba841637 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 12:15:18 +0000 Subject: [PATCH 20/35] Bump postcss from 8.3.9 to 8.3.11 in /packages/website Bumps [postcss](https://github.com/postcss/postcss) from 8.3.9 to 8.3.11. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.3.9...8.3.11) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/website/package.json | 2 +- packages/website/yarn.lock | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/website/package.json b/packages/website/package.json index d147dadd..22e20960 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -48,7 +48,7 @@ "path-browserify": "^1.0.1", "polished": "^4.1.3", "popmotion": "^10.0.1", - "postcss": "^8.3.9", + "postcss": "^8.3.11", "preact-svg-loader": "^0.2.1", "prop-types": "^15.7.2", "react": "^17.0.2", diff --git a/packages/website/yarn.lock b/packages/website/yarn.lock index f5f36f91..b32d276b 100644 --- a/packages/website/yarn.lock +++ b/packages/website/yarn.lock @@ -9405,7 +9405,7 @@ nanocolors@^0.2.2: resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.2.10.tgz#a712df4d3c1bf12d9b4fb8b5aa61b5ba31337503" integrity sha512-i+EDWGsJClQwR/bhLIG/CObZZwaYaS5qt+yjxZbfV+77QiNHNzE9nj4d9Ut1TGZ0R0eSwPcQWzReASzXuw/7oA== -nanoid@^3.1.28, nanoid@^3.1.30: +nanoid@^3.1.30: version "3.1.30" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== @@ -10203,6 +10203,11 @@ picocolors@^0.2.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f" integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA== +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" @@ -10616,13 +10621,13 @@ postcss@^7.0.27: nanocolors "^0.2.2" source-map "^0.6.1" -postcss@^8.1.6, postcss@^8.2.1, postcss@^8.2.15, postcss@^8.2.9, postcss@^8.3.5, postcss@^8.3.9: - version "8.3.9" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.9.tgz#98754caa06c4ee9eb59cc48bd073bb6bd3437c31" - integrity sha512-f/ZFyAKh9Dnqytx5X62jgjhhzttjZS7hMsohcI7HEI5tjELX/HxCy3EFhsRxyzGvrzFF+82XPvCS8T9TFleVJw== +postcss@^8.1.6, postcss@^8.2.1, postcss@^8.2.15, postcss@^8.2.9, postcss@^8.3.11, postcss@^8.3.5: + version "8.3.11" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.11.tgz#c3beca7ea811cd5e1c4a3ec6d2e7599ef1f8f858" + integrity sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA== dependencies: - nanoid "^3.1.28" - picocolors "^0.2.1" + nanoid "^3.1.30" + picocolors "^1.0.0" source-map-js "^0.6.2" potrace@^2.1.8: From 80373bb73f2543d11381df5e366582822323499d Mon Sep 17 00:00:00 2001 From: Filip Rysavy <29089732+firyx@users.noreply.github.com> Date: Mon, 25 Oct 2021 16:51:27 +0200 Subject: [PATCH 21/35] Update blocklist skylink script --- changelog/items/other/refactor-blocklist.md | 2 + scripts/blocklist-skylink.sh | 62 ++++++++------------- 2 files changed, 24 insertions(+), 40 deletions(-) create mode 100644 changelog/items/other/refactor-blocklist.md diff --git a/changelog/items/other/refactor-blocklist.md b/changelog/items/other/refactor-blocklist.md new file mode 100644 index 00000000..28629dab --- /dev/null +++ b/changelog/items/other/refactor-blocklist.md @@ -0,0 +1,2 @@ +- Remove hardcoded server list from `blocklist-skylink.sh` so it removes server + list duplication and can also be called from Ansible. \ No newline at end of file diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index e9d7f778..e5beeb3d 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -1,9 +1,10 @@ #! /usr/bin/env bash -# This script is meant to be used when manually adding a skylink to the -# blocklist on all the skynet web portals. The automatic script that is used to -# continuously sync a google sheets list with the blocklist on the web portals -# is /setup-scripts/blocklist-airtable.py +# This script adds a skylink to the sia blocklist and removes the skylink from +# nginx cache. The script should be run locally on each skynet webportal +# server. The automatic script that is used to continuously sync an Airtable +# sheet list with the blocklist on the web portals is +# /setup-scripts/blocklist-airtable.py set -e # exit on first error @@ -17,54 +18,35 @@ fi ######################################################### skylinks=() if test -f "$1"; then - OLDIFS=$IFS - IFS=',' line_number=1 - while read line + + # Read file including the last line even when it doesn't end with newline + while IFS="" read -r line || [ -n "$line" ]; do - if [[ $line =~ ([a-zA-Z0-9_-]{46}) ]]; then - skylinks+=("$BASH_REMATCH") + if [[ $line =~ (^[a-zA-Z0-9_-]{46}$) ]]; then + skylinks+=("$line") else echo "Incorrect skylink at line ${line_number}: $line" && exit 1 fi let line_number+=1 done < $1; - IFS=$OLDIFS else skylinks=("$1") # just single skylink passed as input argument fi -######################################################################### -# iterate through all servers, block the skylinks and purge it from cache -######################################################################### -declare -a servers=( "eu-ger-1.siasky.net" "eu-ger-2.siasky.net" "eu-ger-3.siasky.net" "eu-ger-4.siasky.net" "eu-ger-5.siasky.net" "eu-ger-6.siasky.net" "eu-ger-7.siasky.net" "eu-ger-8.siasky.net" - "eu-ger-9.siasky.net" "eu-ger-10.siasky.net" "eu-ger-11.siasky.net" "eu-ger-12.siasky.net" - "eu-fin-1.siasky.net" "eu-fin-2.siasky.net" "eu-fin-3.siasky.net" "eu-fin-4.siasky.net" "eu-fin-5.siasky.net" "eu-fin-6.siasky.net" "eu-fin-7-siasky.net" "eu-fin-8.siasky.net" - "eu-fin-9.siasky.net" "eu-fin-10.siasky.net" "eu-fin-11.siasky.net" "eu-fin-12.siasky.net" "eu-fin-13.siasky.net" "eu-fin-14.siasky.net" "eu-fin-15.siasky.net" - "eu-pol-1.siasky.net" "eu-pol-2.siasky.net" "eu-pol-3.siasky.net" "eu-pol-4.siasky.net" "eu-pol-5.siasky.net" - "us-ny-1.siasky.net" "us-ny-2.siasky.net" - "us-or-1.siasky.net" "us-or-2.siasky.net" - "us-la-1.siasky.net" "us-la-2.siasky.net" "us-la-3.siasky.net" - "us-pa-1.siasky.net" "us-pa-2.siasky.net" - "us-va-1.siasky.net" "us-va-2.siasky.net" "us-va-3.siasky.net" "us-va-4.siasky.net" "us-va-5.siasky.net" "us-va-6.siasky.net" - "as-hk-1.siasky.net" "as-sp-1.siasky.net" "as-sp-2.siasky.net" - "siasky.xyz" "dev1.siasky.dev" "dev2.siasky.dev" "dev3.siasky.dev") -for server in "${servers[@]}"; +for skylink in "${skylinks[@]}"; do - for skylink in "${skylinks[@]}"; - do - echo ".. ⌁ Blocking skylink ${skylink} on ${server}" - - # Add to blocklist - ssh -q -t user@${server} "docker exec sia siac skynet blocklist add ${skylink}" - - # Remove from NGINX cache - cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ${skylink}'" - ssh -q -t user@${server} "docker exec -it nginx bash -c ${cached_files_command} | xargs -r rm" - - echo ".. ⌁ Skylink ${skylink} Blocked on ${server}" - echo "--------------------------------------------" - done + echo ".. ⌁ Blocking skylink ${skylink}" + + # Add to Sia blocklist + docker exec sia siac skynet blocklist add "${skylink}" + + # Remove from NGINX cache + cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ${skylink}'" + docker exec -it nginx bash -c "${cached_files_command}" | xargs -r rm + + echo ".. ⌁ Skylink ${skylink} Blocked" + echo "--------------------------------------------" done echo "✓ All done !" From ec02e9afa2c97525338065f1532ff315d36c54c8 Mon Sep 17 00:00:00 2001 From: firyx <29089732+firyx@users.noreply.github.com> Date: Tue, 26 Oct 2021 09:43:21 +0200 Subject: [PATCH 22/35] Update scripts/blocklist-skylink.sh Co-authored-by: Matthew Sevey --- scripts/blocklist-skylink.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index e5beeb3d..8116263a 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -42,6 +42,7 @@ do docker exec sia siac skynet blocklist add "${skylink}" # Remove from NGINX cache + # NOTE: If there are changes to how the NGINX cache is being cleared, the same changes need to be applied to the /setup-scripts/blocklist-airtable.py script. cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ${skylink}'" docker exec -it nginx bash -c "${cached_files_command}" | xargs -r rm From 838c2084a936a5084daf526b089853387b1be19e Mon Sep 17 00:00:00 2001 From: Filip Rysavy <29089732+firyx@users.noreply.github.com> Date: Tue, 26 Oct 2021 09:49:03 +0200 Subject: [PATCH 23/35] Add note to sync changes in blocklist scripts --- scripts/blocklist-skylink.sh | 5 ++++- setup-scripts/blocklist-airtable.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/blocklist-skylink.sh b/scripts/blocklist-skylink.sh index 8116263a..8b81e09f 100755 --- a/scripts/blocklist-skylink.sh +++ b/scripts/blocklist-skylink.sh @@ -42,7 +42,10 @@ do docker exec sia siac skynet blocklist add "${skylink}" # Remove from NGINX cache - # NOTE: If there are changes to how the NGINX cache is being cleared, the same changes need to be applied to the /setup-scripts/blocklist-airtable.py script. + # NOTE: + # If there are changes to how the NGINX cache is being cleared, the same + # changes need to be applied to the /setup-scripts/blocklist-airtable.py + # script. cached_files_command="find /data/nginx/cache/ -type f | xargs -r grep -Els '^Skynet-Skylink: ${skylink}'" docker exec -it nginx bash -c "${cached_files_command}" | xargs -r rm diff --git a/setup-scripts/blocklist-airtable.py b/setup-scripts/blocklist-airtable.py index 1d4c28ce..3dbce3ed 100755 --- a/setup-scripts/blocklist-airtable.py +++ b/setup-scripts/blocklist-airtable.py @@ -141,6 +141,10 @@ async def block_skylinks_from_airtable(): ) return await send_msg(message, force_notify=False) + # Remove from NGINX cache + # NOTE: + # If there are changes to how the NGINX cache is being cleared, the same + # changes need to be applied to the /scripts/blocklist-skylink.sh script. print("Searching nginx cache for blocked files") cached_files_count = 0 batch_size = 1000 From 2b758df522b6bf6bdfb1519a5afdee90922f481b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:42:15 +0000 Subject: [PATCH 24/35] Bump node from 16.11.1-alpine to 16.12.0-alpine in /packages/dnslink-api Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/dnslink-api/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index 903c6757..85c00b9f 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine WORKDIR /usr/app From 9f1050fbb8fcd203f5755ac9fcff5d7fdc37e493 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:42:34 +0000 Subject: [PATCH 25/35] Bump node from 16.11.1-alpine to 16.12.0-alpine in /docker/handshake Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docker/handshake/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/handshake/Dockerfile b/docker/handshake/Dockerfile index 4a3d8bd7..ae640f1b 100644 --- a/docker/handshake/Dockerfile +++ b/docker/handshake/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine WORKDIR /opt/hsd From 05a08dccdaaca7a33ea3e312acca4f0635f142a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:42:34 +0000 Subject: [PATCH 26/35] Bump node from 16.11.1-alpine to 16.12.0-alpine in /packages/dashboard Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/dashboard/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 8b2cfc32..03cbb74f 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine WORKDIR /usr/app From 11dfe94e2c13dbcc9ded1dd8ac4c2e4d4c54151c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:43:02 +0000 Subject: [PATCH 27/35] Bump node in /packages/handshake-api Bumps node from 16.11.1-alpine to 16.12.0-alpine. --- updated-dependencies: - dependency-name: node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- packages/handshake-api/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 2ed56e43..bceb1804 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.11.1-alpine +FROM node:16.12.0-alpine WORKDIR /usr/app From 6604f9228351f93485bbbcb54e2b795997dffb7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:44:28 +0000 Subject: [PATCH 28/35] Bump postcss from 8.3.9 to 8.3.11 in /packages/dashboard Bumps [postcss](https://github.com/postcss/postcss) from 8.3.9 to 8.3.11. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.3.9...8.3.11) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/dashboard/package.json | 2 +- packages/dashboard/yarn.lock | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json index ed4adefd..f2b0991f 100644 --- a/packages/dashboard/package.json +++ b/packages/dashboard/package.json @@ -24,7 +24,7 @@ "ky": "0.25.1", "next": "11.1.2", "normalize.css": "8.0.1", - "postcss": "8.3.9", + "postcss": "8.3.11", "prettier": "2.4.1", "pretty-bytes": "5.6.0", "react": "17.0.2", diff --git a/packages/dashboard/yarn.lock b/packages/dashboard/yarn.lock index 329476e4..0a452557 100644 --- a/packages/dashboard/yarn.lock +++ b/packages/dashboard/yarn.lock @@ -1947,10 +1947,10 @@ nanoclone@^0.2.1: resolved "https://registry.yarnpkg.com/nanoclone/-/nanoclone-0.2.1.tgz#dd4090f8f1a110d26bb32c49ed2f5b9235209ed4" integrity sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA== -nanoid@^3.1.23, nanoid@^3.1.28: - version "3.1.29" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.29.tgz#214fb2d7a33e1a5bef4757b779dfaeb6a4e5aeb4" - integrity sha512-dW2pUSGZ8ZnCFIlBIA31SV8huOGCHb6OwzVCc7A69rb/a+SgPBwfmLvK5TKQ3INPbRkcI8a/Owo0XbiTNH19wg== +nanoid@^3.1.23, nanoid@^3.1.30: + version "3.1.30" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" + integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== native-url@0.3.4: version "0.3.4" @@ -2270,6 +2270,11 @@ picocolors@^0.2.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f" integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA== +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" @@ -2345,13 +2350,13 @@ postcss@8.2.15: nanoid "^3.1.23" source-map "^0.6.1" -postcss@8.3.9, postcss@^8.1.6, postcss@^8.2.1: - version "8.3.9" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.9.tgz#98754caa06c4ee9eb59cc48bd073bb6bd3437c31" - integrity sha512-f/ZFyAKh9Dnqytx5X62jgjhhzttjZS7hMsohcI7HEI5tjELX/HxCy3EFhsRxyzGvrzFF+82XPvCS8T9TFleVJw== +postcss@8.3.11, postcss@^8.1.6, postcss@^8.2.1: + version "8.3.11" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.11.tgz#c3beca7ea811cd5e1c4a3ec6d2e7599ef1f8f858" + integrity sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA== dependencies: - nanoid "^3.1.28" - picocolors "^0.2.1" + nanoid "^3.1.30" + picocolors "^1.0.0" source-map-js "^0.6.2" prettier@2.4.1: From 4d5051fdf8a438137c6a7856648b2f7b046cb0f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Oct 2021 08:45:39 +0000 Subject: [PATCH 29/35] Bump popmotion from 10.0.1 to 10.0.2 in /packages/website Bumps [popmotion](https://github.com/Popmotion/popmotion) from 10.0.1 to 10.0.2. - [Release notes](https://github.com/Popmotion/popmotion/releases) - [Commits](https://github.com/Popmotion/popmotion/commits) --- updated-dependencies: - dependency-name: popmotion dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/website/package.json | 2 +- packages/website/yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/website/package.json b/packages/website/package.json index c10aa3ca..1c053de4 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -47,7 +47,7 @@ "normalize.css": "^8.0.1", "path-browserify": "^1.0.1", "polished": "^4.1.3", - "popmotion": "^10.0.1", + "popmotion": "^10.0.2", "postcss": "^8.3.11", "preact-svg-loader": "^0.2.1", "prop-types": "^15.7.2", diff --git a/packages/website/yarn.lock b/packages/website/yarn.lock index 7f0560b2..70c96371 100644 --- a/packages/website/yarn.lock +++ b/packages/website/yarn.lock @@ -5875,10 +5875,10 @@ framesync@5.3.0: dependencies: tslib "^2.1.0" -framesync@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/framesync/-/framesync-6.0.0.tgz#e6ad8ec128d33291a03cc34e58365c41265a1dae" - integrity sha512-9iBw/uZ/5fDURdpLrgc/eoFXiX9HC3DeOSLtTL5lZSyX/vQb+kjEz9CPNTiTObfK5PKyGgIUTstU8PK9W6EvoA== +framesync@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/framesync/-/framesync-6.0.1.tgz#5e32fc01f1c42b39c654c35b16440e07a25d6f20" + integrity sha512-fUY88kXvGiIItgNC7wcTOl0SNRCVXMKSWW2Yzfmn7EKNc+MpCzcz9DhdHcdjbrtN3c6R4H5dTY2jiCpPdysEjA== dependencies: tslib "^2.1.0" @@ -10290,12 +10290,12 @@ popmotion@9.3.6: style-value-types "4.1.4" tslib "^2.1.0" -popmotion@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-10.0.1.tgz#5be5b80112a1386b7f2a11d081a1ea3ca7508d8e" - integrity sha512-jmVmbXMAl/qrrogQXCMGFR8+F290J6gl9kKHSYzAKBRTHm7B1unadmEeLSXX7rGtzPxOfKVnWHA3t3m3CVnxqw== +popmotion@^10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-10.0.2.tgz#edb87efb2ba39505d07f79d3ca8cc4b1cbe101bf" + integrity sha512-8vgx02LL7Odk/kwSGigAnlPRLJK+Dfked571ZAHGzkxPNWThkU5mQX0xPmibIMAULZehWBV7hGN7LSCpaV3cfw== dependencies: - framesync "6.0.0" + framesync "^6.0.1" hey-listen "^1.0.8" style-value-types "5.0.0" tslib "^2.1.0" From 9737f22fed079b80f6083d9e1f0196defc012c56 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 12:50:35 +0200 Subject: [PATCH 30/35] changelog --- changelog/items/key-updates/1223-wildcard-api.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/items/key-updates/1223-wildcard-api.md diff --git a/changelog/items/key-updates/1223-wildcard-api.md b/changelog/items/key-updates/1223-wildcard-api.md new file mode 100644 index 00000000..88ca91d9 --- /dev/null +++ b/changelog/items/key-updates/1223-wildcard-api.md @@ -0,0 +1 @@ +- expose generic skylink serving endpoint on domain aliases From 81a1338f00827108210eaa0a5af6a750842dabd9 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 13:01:15 +0200 Subject: [PATCH 31/35] move cache to lua to minimise number of requests --- docker/nginx/conf.d/server.dnslink.conf | 2 ++ docker/nginx/conf.d/server/server.dnslink | 40 ++++++++++++++--------- packages/dnslink-api/package.json | 3 +- packages/dnslink-api/src/index.js | 9 ----- packages/dnslink-api/yarn.lock | 12 ------- 5 files changed, 28 insertions(+), 38 deletions(-) diff --git a/docker/nginx/conf.d/server.dnslink.conf b/docker/nginx/conf.d/server.dnslink.conf index 8a051d3f..491bc389 100644 --- a/docker/nginx/conf.d/server.dnslink.conf +++ b/docker/nginx/conf.d/server.dnslink.conf @@ -1,3 +1,5 @@ +lua_shared_dict dnslink 10m; + server { listen 80 default_server; listen [::]:80 default_server; diff --git a/docker/nginx/conf.d/server/server.dnslink b/docker/nginx/conf.d/server/server.dnslink index 06e3e3ca..f8c7b49d 100644 --- a/docker/nginx/conf.d/server/server.dnslink +++ b/docker/nginx/conf.d/server/server.dnslink @@ -5,28 +5,38 @@ location / { set $path $uri; rewrite_by_lua_block { - local httpc = require("resty.http").new() + local cache = ngx.shared.dnslink + local cache_value = cache:get(ngx.var.host) - -- 10.10.10.55 points to dnslink-api service (alias not available when using resty-http) - local res, err = httpc:request_uri("http://10.10.10.55:3100/dnslink/" .. ngx.var.host) + if cache_value == nil then + local httpc = require("resty.http").new() - if err or (res and res.status ~= ngx.HTTP_OK) then - -- check whether we can fallback to regular skylink request - local match_skylink = ngx.re.match(ngx.var.uri, "^/([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?") + -- 10.10.10.55 points to dnslink-api service (alias not available when using resty-http) + local res, err = httpc:request_uri("http://10.10.10.55:3100/dnslink/" .. ngx.var.host) - if match_skylink then - ngx.var.skylink = match_skylink[1] - ngx.var.path = match_skylink[2] or "/" + if err or (res and res.status ~= ngx.HTTP_OK) then + -- check whether we can fallback to regular skylink request + local match_skylink = ngx.re.match(ngx.var.uri, "^/([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?") + + if match_skylink then + ngx.var.skylink = match_skylink[1] + ngx.var.path = match_skylink[2] or "/" + else + ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status + ngx.header["content-type"] = "text/plain" + ngx.say(err or res.body) + ngx.exit(ngx.status) + end else - ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status - ngx.header["content-type"] = "text/plain" - ngx.say(err or res.body) - ngx.exit(ngx.status) + ngx.var.skylink = res.body end + + local cache_ttl = 300 -- 5 minutes cache expire time + cache:set(ngx.var.host, ngx.var.skylink, cache_ttl) else - ngx.var.skylink = res.body + ngx.var.skylink = cache_value end - + ngx.var.skylink_v1 = ngx.var.skylink ngx.var.skylink_v2 = ngx.var.skylink } diff --git a/packages/dnslink-api/package.json b/packages/dnslink-api/package.json index a29295e1..7f833ed2 100644 --- a/packages/dnslink-api/package.json +++ b/packages/dnslink-api/package.json @@ -5,8 +5,7 @@ "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "express": "^4.17.1", - "is-valid-domain": "^0.1.2", - "node-cache": "^5.1.2" + "is-valid-domain": "^0.1.2" }, "devDependencies": { "prettier": "^2.4.1" diff --git a/packages/dnslink-api/src/index.js b/packages/dnslink-api/src/index.js index fdddf9aa..300277c2 100644 --- a/packages/dnslink-api/src/index.js +++ b/packages/dnslink-api/src/index.js @@ -1,14 +1,11 @@ const dns = require("dns"); const express = require("express"); -const NodeCache = require("node-cache"); const isValidDomain = require("is-valid-domain"); const host = process.env.DNSLINK_API_HOSTNAME || "0.0.0.0"; const port = Number(process.env.DNSLINK_API_PORT) || 3100; -const cacheTTL = Number(process.env.DNSLINK_API_CACHE_TTL) || 300; // default to 5 minutes const server = express(); -const cache = new NodeCache({ stdTTL: cacheTTL }); const dnslinkNamespace = "skynet-ns"; const dnslinkRegExp = new RegExp(`^dnslink=/${dnslinkNamespace}/.+$`); @@ -23,10 +20,6 @@ server.get("/dnslink/:name", async (req, res) => { return failure(`"${req.params.name}" is not a valid domain`); } - if (cache.has(req.params.name)) { - return success(cache.get(req.params.name)); - } - const lookup = `_dnslink.${req.params.name}`; dns.resolveTxt(lookup, (error, records) => { @@ -65,8 +58,6 @@ server.get("/dnslink/:name", async (req, res) => { const skylink = matchSkylink[1]; - cache.set(req.params.name, skylink); - console.log(`${req.params.name} => ${skylink}`); return success(skylink); diff --git a/packages/dnslink-api/yarn.lock b/packages/dnslink-api/yarn.lock index 4a359f7a..5cff1dda 100644 --- a/packages/dnslink-api/yarn.lock +++ b/packages/dnslink-api/yarn.lock @@ -36,11 +36,6 @@ bytes@3.1.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== -clone@2.x: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= - content-disposition@0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" @@ -257,13 +252,6 @@ negotiator@0.6.2: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== -node-cache@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" - integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== - dependencies: - clone "2.x" - on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" From d13a68d8254e33fb3c355e5e073ba39897b7aebe Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 16:44:06 +0200 Subject: [PATCH 32/35] fix caching --- docker/nginx/conf.d/server/server.dnslink | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/nginx/conf.d/server/server.dnslink b/docker/nginx/conf.d/server/server.dnslink index f8c7b49d..efaf314d 100644 --- a/docker/nginx/conf.d/server/server.dnslink +++ b/docker/nginx/conf.d/server/server.dnslink @@ -27,12 +27,12 @@ location / { ngx.say(err or res.body) ngx.exit(ngx.status) end + + local cache_ttl = 300 -- 5 minutes cache expire time + cache:set(ngx.var.host, ngx.var.skylink, cache_ttl) else ngx.var.skylink = res.body end - - local cache_ttl = 300 -- 5 minutes cache expire time - cache:set(ngx.var.host, ngx.var.skylink, cache_ttl) else ngx.var.skylink = cache_value end From 40d0bb0e4d7c1bb185ace227bdbe9a2d5a95439d Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 16:47:06 +0200 Subject: [PATCH 33/35] fix caching --- docker/nginx/conf.d/server/server.dnslink | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/nginx/conf.d/server/server.dnslink b/docker/nginx/conf.d/server/server.dnslink index efaf314d..1dd3a489 100644 --- a/docker/nginx/conf.d/server/server.dnslink +++ b/docker/nginx/conf.d/server/server.dnslink @@ -27,11 +27,11 @@ location / { ngx.say(err or res.body) ngx.exit(ngx.status) end + else + ngx.var.skylink = res.body local cache_ttl = 300 -- 5 minutes cache expire time cache:set(ngx.var.host, ngx.var.skylink, cache_ttl) - else - ngx.var.skylink = res.body end else ngx.var.skylink = cache_value From b52f055175c96334b6a1377a183458adef05a46a Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 16:53:42 +0200 Subject: [PATCH 34/35] fix website skylink check --- packages/health-check/src/checks/critical.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/health-check/src/checks/critical.js b/packages/health-check/src/checks/critical.js index daa261f3..471e51e3 100644 --- a/packages/health-check/src/checks/critical.js +++ b/packages/health-check/src/checks/critical.js @@ -61,8 +61,9 @@ async function handshakeSubdomainCheck(done) { // websiteSkylinkCheck returns the result of accessing siasky.net website through skylink async function websiteSkylinkCheck(done) { const websiteSkylink = "0404dsjvti046fsua4ktor9grrpe76erq9jot9cvopbhsvsu76r4r30"; + const url = await skynetClient.getSkylinkUrl(websiteSkylink, { subdomain: true }); - return done(await genericAccessCheck("website_skylink", websiteSkylink)); + return done(await genericAccessCheck("website_skylink", url)); } // accountWebsiteCheck returns the result of accessing account dashboard website From 313855a690092ea907cbd3f9bf9dad4de117be73 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 26 Oct 2021 16:56:07 +0200 Subject: [PATCH 35/35] Revert "fix website skylink check" This reverts commit b52f055175c96334b6a1377a183458adef05a46a. --- packages/health-check/src/checks/critical.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/health-check/src/checks/critical.js b/packages/health-check/src/checks/critical.js index 471e51e3..daa261f3 100644 --- a/packages/health-check/src/checks/critical.js +++ b/packages/health-check/src/checks/critical.js @@ -61,9 +61,8 @@ async function handshakeSubdomainCheck(done) { // websiteSkylinkCheck returns the result of accessing siasky.net website through skylink async function websiteSkylinkCheck(done) { const websiteSkylink = "0404dsjvti046fsua4ktor9grrpe76erq9jot9cvopbhsvsu76r4r30"; - const url = await skynetClient.getSkylinkUrl(websiteSkylink, { subdomain: true }); - return done(await genericAccessCheck("website_skylink", url)); + return done(await genericAccessCheck("website_skylink", websiteSkylink)); } // accountWebsiteCheck returns the result of accessing account dashboard website