diff --git a/.github/actions/js-lint/action.yml b/.github/actions/js-lint/action.yml deleted file mode 100644 index 29715886..00000000 --- a/.github/actions/js-lint/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Define action name, description, and inputs -name: "JS Lint" -description: "Lint code with Prettier and eslint" -inputs: - working-directory: - required: false - description: "Working directory" - default: "." - -# Define action steps -runs: - using: "composite" - steps: - - uses: actions/setup-node@v3 - with: - node-version: 16.x - - run: | - yarn - shell: bash - working-directory: ${{ inputs.working-directory }} - - run: | - yarn prettier --check . - shell: bash - working-directory: ${{ inputs.working-directory }} - - if: inputs.working-directory == 'packages/dashboard' - run: yarn next lint - shell: bash - working-directory: ${{ inputs.working-directory }} - - if: inputs.working-directory == 'packages/dashboard-v2' - run: yarn lint - shell: bash - working-directory: ${{ inputs.working-directory }} diff --git a/.github/actions/node-action/action.yml b/.github/actions/node-action/action.yml new file mode 100644 index 00000000..5dfb2d68 --- /dev/null +++ b/.github/actions/node-action/action.yml @@ -0,0 +1,22 @@ +# Define action name, description, and inputs +name: "Node Action" +description: "Execute a node action" +inputs: + working-directory: + required: false + description: "Working directory" + default: "." + node-action: + required: true + description: "The action to be run" + +# Define action steps +runs: + using: "composite" + steps: + - uses: actions/setup-node@v3 + with: + node-version: 16.x + - run: $inputs.node-action + shell: bash + working-directory: ${{ inputs.working-directory }} diff --git a/.github/actions/python-black-lint/action.yml b/.github/actions/python-black-lint/action.yml deleted file mode 100644 index db3533f7..00000000 --- a/.github/actions/python-black-lint/action.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Define action name, description, and inputs -name: "Python Black Lint" -description: "Lint python code with black" - -# Define action steps -runs: - using: "composite" - steps: - - uses: actions/setup-python@v2 - with: - python-version: "3.x" - architecture: x64 - - - run: pip install black - shell: bash - - run: black --check . - shell: bash diff --git a/.github/actions/python-flake8-lint/action.yml b/.github/actions/python-flake8-lint/action.yml deleted file mode 100644 index a6ac969b..00000000 --- a/.github/actions/python-flake8-lint/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Define action name, description, and inputs -name: "Python Flake8 Lint" -description: "Lint python code with flake8" - -# Define action steps -runs: - using: "composite" - steps: - - uses: actions/setup-python@v2 - with: - python-version: "3.x" - architecture: x64 - - - run: pip install flake8 - shell: bash - # E203: https://www.flake8rules.com/rules/E203.html - Whitespace before ':' - # E501: https://www.flake8rules.com/rules/E501.html - Line too long - # W503: https://www.flake8rules.com/rules/W503.html - Line break occurred before a binary operator - # W605: https://www.flake8rules.com/rules/W605.html - Invalid escape sequence - # E722: https://www.flake8rules.com/rules/E722.html - Do not use bare except, specify exception instead - - run: flake8 --max-line-length 88 --ignore E203,E501,W503,W605,E722 - shell: bash diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 984c2dd9..de674705 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -47,8 +47,8 @@ jobs: packages/health-check/Dockerfile: packages/health-check/Dockerfile packages/website/Dockerfile: packages/website/Dockerfile - # Run the js lint if there are changes to any of the js packages - js-lint: + # Run the prettier lint if there are changes to any of the js packages + prettier: needs: js-changes runs-on: ubuntu-latest strategy: @@ -58,10 +58,33 @@ jobs: steps: - uses: actions/checkout@v3 - name: Run JS-Lint Action - uses: ./.github/actions/js-lint + uses: SkynetLabs/.github/.github/actions/prettier@master with: working-directory: ${{ matrix.working-directory }} + # Run the eslint if there were changes to the dashboard packages + eslint: + needs: js-changes + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + working-directory: ${{ fromJSON(needs.js-changes.outputs.packages) }} + steps: + - uses: actions/checkout@v3 + - name: Run yarn next lint on packages/dashboard + uses: ./.github/actions/node-action + if: ${{ matrix.working-directory == packages/dashboard }} + with: + working-directory: ${{ matrix.working-directory }} + node-action: yarn next lint + - name: Run yarn lint on packages/dashboard-v2 + uses: ./.github/actions/node-action + if: ${{ matrix.working-directory == packages/dashboard-v2 }} + with: + working-directory: ${{ matrix.working-directory }} + node-action: yarn lint + # Run the hadolint dockefile lint if there are changes to any of the # dockerfiles hadolint: diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 5d9d345c..73953a57 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -75,3 +75,25 @@ services: - 3000 depends_on: - mongo + + dashboard-v2: + build: + context: ./packages/dashboard-v2 + dockerfile: Dockerfile + container_name: dashboard-v2 + restart: unless-stopped + logging: *default-logging + env_file: + - .env + environment: + - GATSBY_PORTAL_DOMAIN=${PORTAL_DOMAIN} + volumes: + - ./docker/data/dashboard-v2/.cache:/usr/app/.cache + - ./docker/data/dashboard-v2/public:/usr/app/public + networks: + shared: + ipv4_address: 10.10.10.90 + expose: + - 9000 + depends_on: + - mongo diff --git a/docker-compose.yml b/docker-compose.yml index 2879b8b6..5838f136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,9 +82,11 @@ services: - website website: - build: - context: ./packages/website - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/website/Dockerfile + image: skynetlabs/website container_name: website restart: unless-stopped logging: *default-logging @@ -118,9 +120,11 @@ services: - 12037 handshake-api: - build: - context: ./packages/handshake-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/handshake-api/Dockerfile + image: skynetlabs/handshake-api container_name: handshake-api restart: unless-stopped logging: *default-logging @@ -140,9 +144,11 @@ services: - handshake dnslink-api: - build: - context: ./packages/dnslink-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dnslink-api/Dockerfile + image: skynetlabs/dnslink-api container_name: dnslink-api restart: unless-stopped logging: *default-logging @@ -153,9 +159,11 @@ services: - 3100 health-check: - build: - context: ./packages/health-check - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/health-check/Dockerfile + image: skynetlabs/health-check container_name: health-check restart: unless-stopped logging: *default-logging diff --git a/docker/nginx/conf.d/server/server.api b/docker/nginx/conf.d/server/server.api index f681cca8..5bd1aa61 100644 --- a/docker/nginx/conf.d/server/server.api +++ b/docker/nginx/conf.d/server/server.api @@ -241,8 +241,8 @@ location /skynet/tus { limit_conn upload_conn 5; limit_conn upload_conn_rl 1; - # TUS chunks size is 40M + leaving 10M of breathing room - client_max_body_size 50M; + # Do not limit body size in nginx, skyd will reject early on too large upload + client_max_body_size 0; # Those timeouts need to be elevated since skyd can stall reading # data for a while when overloaded which would terminate connection diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile new file mode 100644 index 00000000..70790cfa --- /dev/null +++ b/packages/dashboard-v2/Dockerfile @@ -0,0 +1,14 @@ +FROM node:16.14.2-alpine + +WORKDIR /usr/app + +COPY package.json yarn.lock ./ + +RUN yarn --frozen-lockfile + +COPY static ./static +COPY src ./src +COPY gatsby*.js ./ +COPY postcss.config.js tailwind.config.js ./ + +CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard-v2/gatsby-config.js b/packages/dashboard-v2/gatsby-config.js index c6096a98..2280f99b 100644 --- a/packages/dashboard-v2/gatsby-config.js +++ b/packages/dashboard-v2/gatsby-config.js @@ -18,7 +18,7 @@ module.exports = { resolve: "gatsby-source-filesystem", options: { name: "images", - path: "./src/images/", + path: "./static/images/", }, __key: "images", }, diff --git a/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js b/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js index 5529c152..54efd956 100644 --- a/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js +++ b/packages/dashboard-v2/src/hooks/useUpgradeRedirect.js @@ -17,7 +17,6 @@ export default function useUpgradeRedirect() { if (isDataLoaded) { if (settings.isSubscriptionRequired && !hasPaidSubscription) { - console.log("redirecting", user, settings); navigate("/upgrade"); } else { setVerifyingSubscription(false); diff --git a/packages/dashboard-v2/src/layouts/DashboardLayout.js b/packages/dashboard-v2/src/layouts/DashboardLayout.js index 76af9218..fe4c5385 100644 --- a/packages/dashboard-v2/src/layouts/DashboardLayout.js +++ b/packages/dashboard-v2/src/layouts/DashboardLayout.js @@ -5,7 +5,7 @@ import { SWRConfig } from "swr"; import { authenticatedOnly } from "../lib/swrConfig"; import { PageContainer } from "../components/PageContainer"; -import { NavBar } from "../components/Navbar"; +import { NavBar } from "../components/NavBar"; import { Footer } from "../components/Footer"; import { UserProvider, useUser } from "../contexts/user"; import { FullScreenLoadingIndicator } from "../components/LoadingIndicator"; diff --git a/packages/dashboard-v2/src/layouts/UserSettingsLayout.js b/packages/dashboard-v2/src/layouts/UserSettingsLayout.js index 2ca769bc..d7b9b7d4 100644 --- a/packages/dashboard-v2/src/layouts/UserSettingsLayout.js +++ b/packages/dashboard-v2/src/layouts/UserSettingsLayout.js @@ -6,7 +6,7 @@ import { SWRConfig } from "swr"; import { authenticatedOnly } from "../lib/swrConfig"; import { PageContainer } from "../components/PageContainer"; -import { NavBar } from "../components/Navbar"; +import { NavBar } from "../components/NavBar"; import { Footer } from "../components/Footer"; import { UserProvider, useUser } from "../contexts/user"; import { ContainerLoadingIndicator } from "../components/LoadingIndicator"; diff --git a/packages/dashboard-v2/src/pages/auth/signup.js b/packages/dashboard-v2/src/pages/auth/signup.js index b6f0e0ac..4da915f1 100644 --- a/packages/dashboard-v2/src/pages/auth/signup.js +++ b/packages/dashboard-v2/src/pages/auth/signup.js @@ -15,7 +15,7 @@ const FreePortalHeader = () => { const { plans } = usePlans(); const freePlan = plans.find(({ price }) => price === 0); - const freeStorage = freePlan ? bytes(freePlan.limits?.storageLimit, { binary: true }) : null; + const freeStorage = freePlan?.limits ? bytes(freePlan.limits?.storageLimit, { binary: true }) : null; return (
diff --git a/packages/dashboard-v2/yarn.lock b/packages/dashboard-v2/yarn.lock index 30d4e8e8..c3de4379 100644 --- a/packages/dashboard-v2/yarn.lock +++ b/packages/dashboard-v2/yarn.lock @@ -14090,7 +14090,7 @@ sjcl@^1.0.8: resolved "https://registry.yarnpkg.com/sjcl/-/sjcl-1.0.8.tgz#f2ec8d7dc1f0f21b069b8914a41a8f236b0e252a" integrity sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ== -skynet-js@^4.0.27-beta: +skynet-js@4.0.27-beta: version "4.0.27-beta" resolved "https://registry.yarnpkg.com/skynet-js/-/skynet-js-4.0.27-beta.tgz#4257bffda8757830656e0beb89d0d2e44da17e2f" integrity sha512-JV+QE/2l2YwVN1jQHVMFXgggwtBrPAnuyXySbLgafEJAde5dUwSEr5YRMV+3LvEgYkGhxSb74pyq0u0wrF2sUg== diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index be1f9452..9ded8cbf 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -2,11 +2,13 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dnslink-api/package.json \ + packages/dnslink-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/dnslink-api/src/* src/ EXPOSE 3100 CMD ["node", "src/index.js"] diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 92f30b36..211044c1 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -2,11 +2,13 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/handshake-api/package.json \ + packages/handshake-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/handshake-api/src/* src/ ENV HSD_NETWORK="main" ENV HSD_HOST="0.0.0.0" diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index e9d15a77..15ef0086 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -11,13 +11,15 @@ ENV PATH="/usr/app/bin:${PATH}" RUN echo '*/5 * * * * source /etc/environment ; /usr/app/bin/cli run critical >> /proc/1/fd/1' >> /etc/crontabs/root && \ echo '0 * * * * source /etc/environment ; /usr/app/bin/cli run extended >> /proc/1/fd/1' >> /etc/crontabs/root -COPY package.json yarn.lock ./ +COPY packages/health-check/package.json \ + packages/health-check/yarn.lock \ + ./ RUN yarn --frozen-lockfile -COPY src src -COPY cli cli -COPY bin bin +COPY packages/health-check/src src +COPY packages/health-check/cli cli +COPY packages/health-check/bin bin EXPOSE 3100 ENV NODE_ENV production diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index 3a9fa9a1..dad0e393 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -4,16 +4,21 @@ RUN apk add --no-cache autoconf=2.71-r0 automake=1.16.4-r1 build-base=0.5-r2 lib WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/website/package.json \ + packages/website/yarn.lock \ + ./ ENV GATSBY_TELEMETRY_DISABLED 1 ENV CYPRESS_INSTALL_BINARY 0 RUN yarn --frozen-lockfile -COPY data ./data -COPY src ./src -COPY static ./static -COPY gatsby-browser.js gatsby-config.js gatsby-node.js gatsby-ssr.js postcss.config.js tailwind.config.js ./ +COPY packages/website/data ./data +COPY packages/website/src ./src +COPY packages/website/static ./static +COPY packages/website/gatsby-*.js \ + packages/website/postcss.config.js \ + packages/website/tailwind.config.js \ + ./ RUN yarn build