Merge remote-tracking branch 'origin/master' into unpin-from-dashboard

This commit is contained in:
Karol Wypchlo 2021-09-21 13:52:41 +02:00
commit 91dbd990e4
No known key found for this signature in database
GPG Key ID: C92C016317A964D0
35 changed files with 951 additions and 845 deletions

View File

@ -1,23 +0,0 @@
# PULL REQUEST
## Overview
## Example for Visual Changes
<!--
For user facing features please provide proof that the format is as expected.
Screen shots and/or asciinema recordings are very helpful.
-->
## Checklist
Review and complete the checklist to ensure that the PR is complete before assigned to an approver.
- [ ] All new methods or updated methods have clear docstrings
- [ ] Testing added or updated for new methods
- [ ] Verify if any changes impact the WebPortal Health Checks
- [ ] Approriate documentation updated
- [ ] Changelog file created
## Issues Closed
<!--
Use the `Closes` keyword to automatically close the issue on merge.
Example: Closes #XXXX
-->

View File

@ -0,0 +1 @@
- Fix extended checks error by rounding the reported datetime.

View File

@ -0,0 +1 @@
- Change skyd 307 redirect code to 308

View File

@ -0,0 +1 @@
- Set caddy dns entry ttl limit to 15 minutes to remove stranded entries.

View File

@ -0,0 +1 @@
- Update health check disable command to require reason.

View File

@ -0,0 +1 @@
- Add proper handling for options response on /skynet/tus endpoint

View File

@ -0,0 +1 @@
- Remove outdated references to NebulousLabs

View File

@ -1,4 +1,4 @@
FROM golang:1.15 FROM golang:1.16.7
LABEL maintainer="NebulousLabs <devs@nebulous.tech>" LABEL maintainer="NebulousLabs <devs@nebulous.tech>"
ENV GOOS linux ENV GOOS linux

View File

@ -25,7 +25,8 @@
"provider": { "provider": {
"name": "route53", "name": "route53",
"max_retries": 100 "max_retries": 100
} },
ttl: "15m"
} }
} }
} }

View File

@ -1,4 +1,4 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
WORKDIR /opt/hsd WORKDIR /opt/hsd

View File

@ -1,16 +1,9 @@
if ($request_method = 'OPTIONS') { if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: $http_origin'; include /etc/nginx/conf.d/include/cors-headers;
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE';
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,If-None-Match,Cache-Control,Content-Type,Range,X-HTTP-Method-Override,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,location';
more_set_headers 'Access-Control-Max-Age: 1728000'; more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain; charset=utf-8'; more_set_headers 'Content-Type: text/plain; charset=utf-8';
more_set_headers 'Content-Length: 0'; more_set_headers 'Content-Length: 0';
return 204; return 204;
} }
more_set_headers 'Access-Control-Allow-Origin: $http_origin'; include /etc/nginx/conf.d/include/cors-headers;
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE';
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,If-None-Match,Cache-Control,Content-Type,Range,X-HTTP-Method-Override,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,location';
more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,ETag,Skynet-File-Metadata,Skynet-Skylink,Skynet-Proof,Skynet-Portal-Api,Skynet-Server-Api,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,location';

View File

@ -0,0 +1,5 @@
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE';
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,If-None-Match,Cache-Control,Content-Type,Range,X-HTTP-Method-Override,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,location';
more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,ETag,Skynet-File-Metadata,Skynet-Skylink,Skynet-Proof,Skynet-Portal-Api,Skynet-Server-Api,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,location';

View File

@ -143,7 +143,7 @@ location /skynet/skyfile {
# endpoint implementing resumable file uploads open protocol https://tus.io # endpoint implementing resumable file uploads open protocol https://tus.io
location /skynet/tus { location /skynet/tus {
include /etc/nginx/conf.d/include/cors; include /etc/nginx/conf.d/include/cors-headers; # include cors headers but do not overwrite OPTIONS response
include /etc/nginx/conf.d/include/track-upload; include /etc/nginx/conf.d/include/track-upload;
# TUS chunks size is 40M + leaving 10M of breathing room # TUS chunks size is 40M + leaving 10M of breathing room

View File

@ -1,4 +1,4 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
WORKDIR /usr/app WORKDIR /usr/app

View File

@ -16,7 +16,7 @@
"autoprefixer": "10.3.4", "autoprefixer": "10.3.4",
"classnames": "2.3.1", "classnames": "2.3.1",
"clipboardy": "2.3.0", "clipboardy": "2.3.0",
"dayjs": "1.10.6", "dayjs": "1.10.7",
"express-jwt": "6.1.0", "express-jwt": "6.1.0",
"fast-levenshtein": "3.0.0", "fast-levenshtein": "3.0.0",
"formik": "2.2.9", "formik": "2.2.9",
@ -25,15 +25,15 @@
"next": "11.1.2", "next": "11.1.2",
"normalize.css": "8.0.1", "normalize.css": "8.0.1",
"postcss": "8.3.6", "postcss": "8.3.6",
"prettier": "2.4.0", "prettier": "2.4.1",
"pretty-bytes": "5.6.0", "pretty-bytes": "5.6.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"react-toastify": "8.0.2", "react-toastify": "8.0.2",
"skynet-js": "3.0.2", "skynet-js": "3.0.2",
"stripe": "8.174.0", "stripe": "8.176.0",
"superagent": "6.1.0", "superagent": "6.1.0",
"swr": "1.0.0", "swr": "1.0.1",
"tailwindcss": "2.2.15", "tailwindcss": "2.2.15",
"yup": "0.32.9" "yup": "0.32.9"
} }

View File

@ -858,10 +858,10 @@ data-uri-to-buffer@3.0.1:
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636" resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636"
integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==
dayjs@1.10.6: dayjs@1.10.7:
version "1.10.6" version "1.10.7"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
integrity sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw== integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==
debug@2: debug@2:
version "2.6.9" version "2.6.9"
@ -2360,10 +2360,10 @@ postcss@8.3.6, postcss@^8.1.6, postcss@^8.2.1:
nanoid "^3.1.23" nanoid "^3.1.23"
source-map-js "^0.6.2" source-map-js "^0.6.2"
prettier@2.4.0: prettier@2.4.1:
version "2.4.0" version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
pretty-bytes@5.6.0: pretty-bytes@5.6.0:
version "5.6.0" version "5.6.0"
@ -2911,10 +2911,10 @@ strip-eof@^1.0.0:
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
stripe@8.174.0: stripe@8.176.0:
version "8.174.0" version "8.176.0"
resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.174.0.tgz#91d2e61b0217b1ee9fde2842582e0f1cf1dddc94" resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.176.0.tgz#2f4980ab49acbfe6d67ecaddd54c05e20de9532c"
integrity sha512-UFU5TuYH7XwUmSllUIcIKhhsvvhhjw9D6ZwVdfB74wU4VOOaWBiQqszkw6chaEFpdulUmbcAH5eZltV3HwOi7g== integrity sha512-0KCDo8TWFgeNWU7cPaqdjO2u2OSth0cmWYZmA7xsuxRCk7/lgWbJ/UbeSphx74cCIjFCmGuzDoNuNxqon9lEbg==
dependencies: dependencies:
"@types/node" ">=8.1.0" "@types/node" ">=8.1.0"
qs "^6.6.0" qs "^6.6.0"
@ -2981,10 +2981,10 @@ supports-color@^8.0.0:
dependencies: dependencies:
has-flag "^4.0.0" has-flag "^4.0.0"
swr@1.0.0: swr@1.0.1:
version "1.0.0" version "1.0.1"
resolved "https://registry.yarnpkg.com/swr/-/swr-1.0.0.tgz#d047933714d8bd16ae35af67d81149f4ae700a4d" resolved "https://registry.yarnpkg.com/swr/-/swr-1.0.1.tgz#15f62846b87ee000e52fa07812bb65eb62d79483"
integrity sha512-v55Dr+vxIFiUyGxC5W4uN5falxHxYdbpb/R3bO+bSG+svbC9bUWmupy4NM/2pER7X8OvgwJWu0AiSoGy0ND9ew== integrity sha512-EPQAxSjoD4IaM49rpRHK0q+/NzcwoT8c0/Ylu/u3/6mFj/CWnQVjNJ0MV2Iuw/U+EJSd2TX5czdAwKPYZIG0YA==
dependencies: dependencies:
dequal "2.0.2" dequal "2.0.2"

View File

@ -1,4 +1,4 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
WORKDIR /usr/app WORKDIR /usr/app

View File

@ -9,6 +9,6 @@
"node-cache": "^5.1.2" "node-cache": "^5.1.2"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^2.4.0" "prettier": "^2.4.1"
} }
} }

View File

@ -281,10 +281,10 @@ path-to-regexp@0.1.7:
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
prettier@^2.4.0: prettier@^2.4.1:
version "2.4.0" version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
proxy-addr@~2.0.5: proxy-addr@~2.0.5:
version "2.0.7" version "2.0.7"

View File

@ -1,4 +1,4 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
WORKDIR /usr/app WORKDIR /usr/app

View File

@ -10,6 +10,6 @@
"punycode": "^2.1.1" "punycode": "^2.1.1"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^2.4.0" "prettier": "^2.4.1"
} }
} }

View File

@ -318,10 +318,10 @@ path-to-regexp@0.1.7:
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
prettier@^2.4.0: prettier@^2.4.1:
version "2.4.0" version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
proxy-addr@~2.0.5: proxy-addr@~2.0.5:
version "2.0.7" version "2.0.7"

View File

@ -1,14 +1,16 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
RUN apk update && apk add dnsmasq RUN apk update && apk add dnsmasq
WORKDIR /usr/app WORKDIR /usr/app
ENV PATH="/usr/app/bin:${PATH}"
# schedule critical checks to run every 5 minutes (any failures will disable server) # schedule critical checks to run every 5 minutes (any failures will disable server)
RUN echo '*/5 * * * * /usr/app/cli/run critical > /dev/stdout' >> /etc/crontabs/root RUN echo '*/5 * * * * /usr/app/bin/cli run critical > /dev/stdout' >> /etc/crontabs/root
# schedule extended checks to run on every hour (optional checks, report only) # schedule extended checks to run on every hour (optional checks, report only)
RUN echo '0 * * * * /usr/app/cli/run extended > /dev/stdout' >> /etc/crontabs/root RUN echo '0 * * * * /usr/app/bin/cli run extended > /dev/stdout' >> /etc/crontabs/root
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
@ -16,6 +18,7 @@ RUN yarn --frozen-lockfile
COPY src src COPY src src
COPY cli cli COPY cli cli
COPY bin bin
EXPOSE 3100 EXPOSE 3100
ENV NODE_ENV production ENV NODE_ENV production

83
packages/health-check/bin/cli Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env node
process.env.NODE_ENV = process.env.NODE_ENV || "production";
require("yargs/yargs")(process.argv.slice(2))
.help()
.demandCommand()
.strict(true)
.command(
"enable",
"Mark portal as enabled",
() => {},
() => {
const db = require("../src/db");
db.set("disabled", false).write();
}
)
.command(
"disable <reason>",
"Mark portal as disabled (provide meaningful reason)",
() => {},
({ reason }) => {
const db = require("../src/db");
db.set("disabled", reason).write();
}
)
.command(
"run <type>",
"Skynet portal health checks",
(yargs) => {
yargs
.positional("type", {
describe: "Type of checks to run",
type: "string",
choices: ["critical", "extended"],
})
.option("portal-url", {
describe: "Skynet portal url",
default: process.env.SKYNET_PORTAL_API || "https://siasky.net",
type: "string",
})
.option("state-dir", {
describe: "State directory",
default: process.env.STATE_DIR || "state",
type: "string",
});
},
async ({ type, portalUrl, stateDir }) => {
process.env.SKYNET_PORTAL_API = portalUrl;
process.env.STATE_DIR = stateDir;
const util = require("util");
const { getYesterdayISOString } = require("../src/utils");
const createMiddleware = require("../src/checks/middleware");
const db = require("../src/db");
const checks = require(`../src/checks/${type}`);
const middleware = await createMiddleware();
const entry = {
date: new Date().toISOString(),
checks: (await Promise.all(checks.map((check) => new Promise(check)))).map(middleware),
};
db.read() // read before writing to make sure no external changes are overwritten
.get(type) // get the list of records of given type
.push(entry) // insert new record
.remove(({ date }) => date < getYesterdayISOString()) // drop old records
.write();
// exit with code 1 if any of the checks report failure
if (entry.checks.some(({ up }) => !up)) {
console.log(
util.inspect(
entry.checks.filter(({ up }) => !up),
{ colors: true, depth: 7 } // increase depth to ensure errors are printed
)
);
process.exit(1);
}
}
).argv;

View File

@ -1,7 +1,5 @@
#!/usr/bin/env node #!/bin/ash
process.env.NODE_ENV = process.env.NODE_ENV || "production"; echo "DEPRECATED: 'cli/disable' command is deprecated, use 'cli disable' instead"
const db = require("../src/db"); /usr/app/bin/cli disable $@
db.set("disabled", true).write();

View File

@ -1,7 +1,5 @@
#!/usr/bin/env node #!/bin/ash
process.env.NODE_ENV = process.env.NODE_ENV || "production"; echo "DEPRECATED: 'cli/enable' command is deprecated, use 'cli enable' instead"
const db = require("../src/db"); /usr/app/bin/cli enable $@
db.set("disabled", false).write();

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node #!/bin/ash
process.env.NODE_ENV = process.env.NODE_ENV || "production"; echo "DEPRECATED: 'cli/run' command is deprecated, use 'cli run' instead"
require("../src/run.js"); /usr/app/bin/cli run $@

View File

@ -18,6 +18,6 @@
"yargs": "^17.1.1" "yargs": "^17.1.1"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^2.4.0" "prettier": "^2.4.1"
} }
} }

View File

@ -1,56 +0,0 @@
const util = require("util");
const { getYesterdayISOString } = require("./utils");
const createMiddleware = require("./checks/middleware");
require("yargs/yargs")(process.argv.slice(2)).command(
"$0 <type>",
"Skynet portal health checks",
(yargs) => {
yargs
.positional("type", {
describe: "Type of checks to run",
type: "string",
choices: ["critical", "extended"],
})
.option("portal-url", {
describe: "Skynet portal url",
default: process.env.SKYNET_PORTAL_API || "https://siasky.net",
type: "string",
})
.option("state-dir", {
describe: "State directory",
default: process.env.STATE_DIR || "state",
type: "string",
});
},
async ({ type, portalUrl, stateDir }) => {
process.env.SKYNET_PORTAL_API = portalUrl;
process.env.STATE_DIR = stateDir;
const db = require("../src/db");
const checks = require(`../src/checks/${type}`);
const middleware = await createMiddleware();
const entry = {
date: new Date().toISOString(),
checks: (await Promise.all(checks.map((check) => new Promise(check)))).map(middleware),
};
db.read() // read before writing to make sure no external changes are overwritten
.get(type) // get the list of records of given type
.push(entry) // insert new record
.remove(({ date }) => date < getYesterdayISOString()) // drop old records
.write();
// exit with code 1 if any of the checks report failure
if (entry.checks.some(({ up }) => !up)) {
console.log(
util.inspect(
entry.checks.filter(({ up }) => !up),
{ colors: true, depth: 7 } // increase depth to ensure errors are printed
)
);
process.exit(1);
}
}
).argv;

View File

@ -635,10 +635,10 @@ pify@^3.0.0:
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=
prettier@^2.4.0: prettier@^2.4.1:
version "2.4.0" version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ== integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
proxy-addr@~2.0.5: proxy-addr@~2.0.5:
version "2.0.7" version "2.0.7"

View File

@ -1,4 +1,4 @@
FROM node:16.9.0-alpine FROM node:16.9.1-alpine
RUN apk update && apk add autoconf automake build-base libtool nasm pkgconfig RUN apk update && apk add autoconf automake build-base libtool nasm pkgconfig

View File

@ -15,30 +15,30 @@
"copy-text-to-clipboard": "^3.0.1", "copy-text-to-clipboard": "^3.0.1",
"crypto-browserify": "^3.12.0", "crypto-browserify": "^3.12.0",
"framer-motion": "^4.1.17", "framer-motion": "^4.1.17",
"gatsby": "^3.13.0", "gatsby": "^3.14.0",
"gatsby-background-image": "^1.5.3", "gatsby-background-image": "^1.5.3",
"gatsby-image": "^3.11.0", "gatsby-image": "^3.11.0",
"gatsby-plugin-image": "^1.13.0", "gatsby-plugin-image": "^1.14.0",
"gatsby-plugin-manifest": "^3.13.0", "gatsby-plugin-manifest": "^3.14.0",
"gatsby-plugin-matomo": "^0.10.0", "gatsby-plugin-matomo": "^0.10.0",
"gatsby-plugin-offline": "^4.13.0", "gatsby-plugin-offline": "^4.14.0",
"gatsby-plugin-postcss": "^4.13.0", "gatsby-plugin-postcss": "^4.14.0",
"gatsby-plugin-purgecss": "^6.0.2", "gatsby-plugin-purgecss": "^6.0.2",
"gatsby-plugin-react-helmet": "^4.13.0", "gatsby-plugin-react-helmet": "^4.14.0",
"gatsby-plugin-robots-txt": "^1.6.10", "gatsby-plugin-robots-txt": "^1.6.10",
"gatsby-plugin-sharp": "^3.13.0", "gatsby-plugin-sharp": "^3.14.0",
"gatsby-plugin-svgr": "^3.0.0-beta.0", "gatsby-plugin-svgr": "^3.0.0-beta.0",
"gatsby-remark-classes": "^1.0.0", "gatsby-remark-classes": "^1.0.0",
"gatsby-remark-copy-linked-files": "^4.10.0", "gatsby-remark-copy-linked-files": "^4.11.0",
"gatsby-remark-images": "^5.10.0", "gatsby-remark-images": "^5.11.0",
"gatsby-remark-prismjs": "^5.10.0", "gatsby-remark-prismjs": "^5.11.0",
"gatsby-remark-responsive-iframe": "^4.10.0", "gatsby-remark-responsive-iframe": "^4.11.0",
"gatsby-remark-smartypants": "^4.10.0", "gatsby-remark-smartypants": "^4.11.0",
"gatsby-source-filesystem": "^3.13.0", "gatsby-source-filesystem": "^3.14.0",
"gatsby-transformer-json": "^3.13.0", "gatsby-transformer-json": "^3.14.0",
"gatsby-transformer-remark": "^4.10.0", "gatsby-transformer-remark": "^4.11.0",
"gatsby-transformer-sharp": "^3.13.0", "gatsby-transformer-sharp": "^3.14.0",
"gatsby-transformer-yaml": "^3.13.0", "gatsby-transformer-yaml": "^3.14.0",
"gbimage-bridge": "^0.1.4", "gbimage-bridge": "^0.1.4",
"http-status-codes": "^2.1.4", "http-status-codes": "^2.1.4",
"jsonp": "^0.2.1", "jsonp": "^0.2.1",
@ -53,7 +53,7 @@
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-dropzone": "^11.3.4", "react-dropzone": "^11.4.0",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-share": "^4.4.0", "react-share": "^4.4.0",
"react-svg-loader": "^3.0.3", "react-svg-loader": "^3.0.3",
@ -61,14 +61,14 @@
"react-use": "^17.3.1", "react-use": "^17.3.1",
"skynet-js": "^4.0.11-beta", "skynet-js": "^4.0.11-beta",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"swr": "^1.0.0", "swr": "^1.0.1",
"tailwindcss": "^2.2.15" "tailwindcss": "^2.2.15"
}, },
"devDependencies": { "devDependencies": {
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cypress": "^8.3.1", "cypress": "^8.4.1",
"cypress-file-upload": "^5.0.8", "cypress-file-upload": "^5.0.8",
"prettier": "^2.4.0" "prettier": "^2.4.1"
}, },
"keywords": [ "keywords": [
"gatsby" "gatsby"

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ async def check_health():
res = requests.get(endpoint + "/health-check", verify=False) res = requests.get(endpoint + "/health-check", verify=False)
json_check = res.json() json_check = res.json()
server_down = res.status_code is not requests.codes["ok"] server_failure = res.status_code is not requests.codes["ok"] and json_check["disabled"] == False:
res = requests.get(endpoint + "/health-check/critical", verify=False) res = requests.get(endpoint + "/health-check/critical", verify=False)
json_critical = res.json() json_critical = res.json()
@ -160,7 +160,9 @@ async def check_health():
failed_records = [] failed_records = []
failed_records_file = None failed_records_file = None
time_limit = datetime.utcnow() - timedelta(hours=CHECK_HOURS) time_limit = datetime.utcnow().replace(
minute=0, second=0, microsecond=0
) - timedelta(hours=CHECK_HOURS)
for critical in json_critical: for critical in json_critical:
time = datetime.strptime(critical["date"], "%Y-%m-%dT%H:%M:%S.%fZ") time = datetime.strptime(critical["date"], "%Y-%m-%dT%H:%M:%S.%fZ")
@ -201,10 +203,8 @@ async def check_health():
message = "" message = ""
force_notify = False force_notify = False
if json_check["disabled"]: if server_failure:
message += "__Portal manually disabled!__ " message += "__Server down!!!__ "
elif server_down:
message += "__Portal down!!!__ "
force_notify = True force_notify = True
if critical_checks_failed: if critical_checks_failed:
@ -229,7 +229,6 @@ async def check_health():
# send a message if we force notification, there is a failures dump or just once daily (heartbeat) on 1 AM # send a message if we force notification, there is a failures dump or just once daily (heartbeat) on 1 AM
if ( if (
force_notify force_notify
or json_check["disabled"]
or failed_records_file or failed_records_file
or datetime.utcnow().hour == 1 or datetime.utcnow().hour == 1
): ):

View File

@ -16,7 +16,7 @@ docker --version # sanity check
sudo usermod -aG docker user sudo usermod -aG docker user
# Install docker-compose # Install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # sanity check docker-compose --version # sanity check