Skip to content

Commit

Permalink
Merge pull request #2 from jsdelivr/remove-jsd
Browse files Browse the repository at this point in the history
feat: remove jsd data
  • Loading branch information
MartinKolarik authored Apr 20, 2024
2 parents 7a1bceb + 159456e commit 68c7a9e
Show file tree
Hide file tree
Showing 28 changed files with 89 additions and 6,267 deletions.
2 changes: 1 addition & 1 deletion .env.development.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AUTH_GITHUB_IDENTIFIER_KEY=id
# A classic token (not scoped), required permissions are: read:org, read:user
GITHUB_ACCESS_TOKEN=
# Generated during enabling of webhooks and passed to the app, to validate requests
# Create the webhook at https://github.com/sponsors/jsdelivr/dashboard/webhooks/441768912/edit#deliveries
# Create the webhook at https://github.com/sponsors/jsdelivr/globalping-dash-directus/webhooks/441768912/edit#deliveries
# See WEBHOOK_FLOW_ID in .env.example for the webhook URL
GITHUB_WEBHOOK_SECRET=

Expand Down
2 changes: 1 addition & 1 deletion .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AUTH_GITHUB_IDENTIFIER_KEY=id
# A classic token (not scoped), required permissions are: read:org, read:user
GITHUB_ACCESS_TOKEN=
# Generated during enabling of webhooks and passed to the app, to validate requests
# Create the webhook at https://github.com/sponsors/jsdelivr/dashboard/webhooks/441768912/edit#deliveries
# Create the webhook at https://github.com/sponsors/jsdelivr/globalping-dash-directus/webhooks/441768912/edit#deliveries
# See WEBHOOK_FLOW_ID in .env.example for the webhook URL
GITHUB_WEBHOOK_SECRET=

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: jsdelivr/dashboard/dashboard-staging
name: jsdelivr/dashboard/globalping-dash-directus
username: jsdelivr
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: jsdelivr/dashboard/dashboard
name: jsdelivr/dashboard/globalping-dash-directus
username: jsdelivr
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
Expand Down
83 changes: 37 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,69 +1,61 @@
# Build hooks/jsd-purge-tokens
FROM node:18-alpine AS builder-01
WORKDIR /builder/src/extensions/hooks/jsd-purge-tokens
ADD ./src/extensions/hooks/jsd-purge-tokens/package.json ./src/extensions/hooks/jsd-purge-tokens/package-lock.json ./
RUN npm ci
COPY ./src/extensions/hooks/jsd-purge-tokens .
RUN npm run build

# Build hooks/sign-up
FROM node:18-alpine AS builder-02
FROM node:18-alpine AS builder-01
WORKDIR /builder/src/extensions/hooks/sign-up
ADD ./src/extensions/hooks/sign-up/package.json ./src/extensions/hooks/sign-up/package-lock.json ./
RUN npm ci
COPY ./src/extensions/hooks/sign-up .
RUN npm run build

# Build interfaces/token
FROM node:18-alpine AS builder-03
FROM node:18-alpine AS builder-02
WORKDIR /builder/src/extensions/interfaces/token
ADD ./src/extensions/interfaces/token/package.json ./src/extensions/interfaces/token/package-lock.json ./
RUN npm ci
COPY ./src/extensions/interfaces/token .
RUN npm run build

# Build token-value
FROM node:18-alpine AS builder-04
FROM node:18-alpine AS builder-03
WORKDIR /builder/src/extensions/token-value
ADD ./src/extensions/token-value/package.json ./src/extensions/token-value/package-lock.json ./
RUN npm ci
COPY ./src/extensions/token-value .
RUN npm run build

# Build gh-webhook-handler
FROM node:18-alpine AS builder-05
FROM node:18-alpine AS builder-04
WORKDIR /builder/src/extensions/operations/gh-webhook-handler
ADD ./src/extensions/operations/gh-webhook-handler/package.json ./src/extensions/operations/gh-webhook-handler/package-lock.json ./
RUN npm ci
COPY ./src/extensions/operations/gh-webhook-handler .
RUN npm run build

# Build sponsors-cron-handler
FROM node:18-alpine AS builder-06
FROM node:18-alpine AS builder-05
WORKDIR /builder/src/extensions/operations/sponsors-cron-handler
ADD ./src/extensions/operations/sponsors-cron-handler/package.json ./src/extensions/operations/sponsors-cron-handler/package-lock.json ./
RUN npm ci
COPY ./src/extensions/operations/sponsors-cron-handler .
RUN npm run build

# Build modules/probes-adapter
FROM node:18-alpine AS builder-07
FROM node:18-alpine AS builder-06
WORKDIR /builder/src/extensions/modules/probes-adapter
ADD ./src/extensions/modules/probes-adapter/package.json ./src/extensions/modules/probes-adapter/package-lock.json ./
RUN npm ci
COPY ./src/extensions/modules/probes-adapter .
RUN npm run build

# Build endpoints/adoption-code
FROM node:18-alpine AS builder-08
FROM node:18-alpine AS builder-07
WORKDIR /builder/src/extensions/endpoints/adoption-code
ADD ./src/extensions/endpoints/adoption-code/package.json ./src/extensions/endpoints/adoption-code/package-lock.json ./
RUN npm ci
COPY ./src/extensions/endpoints/adoption-code .
RUN npm run build

# Build hooks/adopted-probe
FROM node:18-alpine AS builder-09
FROM node:18-alpine AS builder-08
WORKDIR /builder/src/extensions/lib
ADD ./src/extensions/lib/package.json ./src/extensions/lib/package-lock.json ./
RUN npm ci
Expand All @@ -75,79 +67,79 @@ COPY ./src/extensions/hooks/adopted-probe .
RUN npm run build

# Build hooks/sign-in
FROM node:18-alpine AS builder-10
FROM node:18-alpine AS builder-09
WORKDIR /builder/src/extensions/hooks/sign-in
ADD ./src/extensions/hooks/sign-in/package.json ./src/extensions/hooks/sign-in/package-lock.json ./
RUN npm ci
COPY ./src/extensions/hooks/sign-in .
RUN npm run build

# Build endpoints/sync-github-data
FROM node:18-alpine AS builder-11
FROM node:18-alpine AS builder-10
WORKDIR /builder/src/extensions/endpoints/sync-github-data
ADD ./src/extensions/endpoints/sync-github-data/package.json ./src/extensions/endpoints/sync-github-data/package-lock.json ./
RUN npm ci
COPY ./src/extensions/endpoints/sync-github-data .
RUN npm run build

# Build interfaces/github-username
FROM node:18-alpine AS builder-12
FROM node:18-alpine AS builder-11
WORKDIR /builder/src/extensions/interfaces/github-username
ADD ./src/extensions/interfaces/github-username/package.json ./src/extensions/interfaces/github-username/package-lock.json ./
RUN npm ci
COPY ./src/extensions/interfaces/github-username .
RUN npm run build

# Build adopted-probes-status-cron-handler
FROM node:18-alpine AS builder-13
FROM node:18-alpine AS builder-12
WORKDIR /builder/src/extensions/operations/adopted-probes-status-cron-handler
ADD ./src/extensions/operations/adopted-probes-status-cron-handler/package.json ./src/extensions/operations/adopted-probes-status-cron-handler/package-lock.json ./
RUN npm ci
COPY ./src/extensions/operations/adopted-probes-status-cron-handler .
RUN npm run build

# Build adopted-probes-credits-cron-handler
FROM node:18-alpine AS builder-14
FROM node:18-alpine AS builder-13
WORKDIR /builder/src/extensions/operations/adopted-probes-credits-cron-handler
ADD ./src/extensions/operations/adopted-probes-credits-cron-handler/package.json ./src/extensions/operations/adopted-probes-credits-cron-handler/package-lock.json ./
RUN npm ci
COPY ./src/extensions/operations/adopted-probes-credits-cron-handler .
RUN npm run build

# Build interfaces/gp-tags
FROM node:18-alpine AS builder-15
FROM node:18-alpine AS builder-14
WORKDIR /builder/src/extensions/interfaces/gp-tags
ADD ./src/extensions/interfaces/gp-tags/package.json ./src/extensions/interfaces/gp-tags/package-lock.json ./
RUN npm ci
COPY ./src/extensions/interfaces/gp-tags .
RUN npm run build

# Build operations/remove-banned-users-cron-handler
FROM node:18-alpine AS builder-16
FROM node:18-alpine AS builder-15
WORKDIR /builder/src/extensions/operations/remove-banned-users-cron-handler
ADD ./src/extensions/operations/remove-banned-users-cron-handler/package.json ./src/extensions/operations/remove-banned-users-cron-handler/package-lock.json ./
RUN npm ci
COPY ./src/extensions/operations/remove-banned-users-cron-handler .
RUN npm run build

# Build hooks/gp-tokens
FROM node:18-alpine AS builder-17
FROM node:18-alpine AS builder-16
WORKDIR /builder/src/extensions/hooks/gp-tokens
ADD ./src/extensions/hooks/gp-tokens/package.json ./src/extensions/hooks/gp-tokens/package-lock.json ./
RUN npm ci
COPY ./src/extensions/hooks/gp-tokens .
RUN npm run build

# Build hooks/directus-users
FROM node:18-alpine AS builder-18
FROM node:18-alpine AS builder-17
WORKDIR /builder/src/extensions/hooks/directus-users
ADD ./src/extensions/hooks/directus-users/package.json ./src/extensions/hooks/directus-users/package-lock.json ./
RUN npm ci
COPY ./src/extensions/hooks/directus-users .
RUN npm run build

# Build hooks/location-verrides
FROM node:18-alpine AS builder-19
FROM node:18-alpine AS builder-18
WORKDIR /builder/src/extensions/lib
ADD ./src/extensions/lib/package.json ./src/extensions/lib/package-lock.json ./
RUN npm ci
Expand All @@ -160,23 +152,22 @@ RUN npm run build

FROM directus/directus:10.9.3

COPY --from=builder-01 /builder/src/extensions/hooks/jsd-purge-tokens/dist/* /directus/extensions/hooks/jsd-purge-tokens/
COPY --from=builder-02 /builder/src/extensions/hooks/sign-up/dist/* /directus/extensions/hooks/sign-up/
COPY --from=builder-03 /builder/src/extensions/interfaces/token/dist/* /directus/extensions/interfaces/token/
COPY --from=builder-04 /builder/src/extensions/token-value/dist/* /directus/extensions/directus-extension-token-value/dist/
COPY --from=builder-04 /builder/src/extensions/token-value/package.json /directus/extensions/directus-extension-token-value/
COPY --from=builder-05 /builder/src/extensions/operations/gh-webhook-handler/dist/* /directus/extensions/operations/gh-webhook-handler/
COPY --from=builder-06 /builder/src/extensions/operations/sponsors-cron-handler/dist/* /directus/extensions/operations/sponsors-cron-handler/
COPY --from=builder-07 /builder/src/extensions/modules/probes-adapter/dist/* /directus/extensions/modules/probes-adapter/
COPY --from=builder-08 /builder/src/extensions/endpoints/adoption-code/dist/* /directus/extensions/endpoints/adoption-code/
COPY --from=builder-09 /builder/src/extensions/hooks/adopted-probe/dist/* /directus/extensions/hooks/adopted-probe/
COPY --from=builder-10 /builder/src/extensions/hooks/sign-in/dist/* /directus/extensions/hooks/sign-in/
COPY --from=builder-11 /builder/src/extensions/endpoints/sync-github-data/dist/* /directus/extensions/endpoints/sync-github-data/
COPY --from=builder-12 /builder/src/extensions/interfaces/github-username/dist/* /directus/extensions/interfaces/github-username/
COPY --from=builder-13 /builder/src/extensions/operations/adopted-probes-status-cron-handler/dist/* /directus/extensions/operations/adopted-probes-status-cron-handler/
COPY --from=builder-14 /builder/src/extensions/operations/adopted-probes-credits-cron-handler/dist/* /directus/extensions/operations/adopted-probes-credits-cron-handler/
COPY --from=builder-15 /builder/src/extensions/interfaces/gp-tags/dist/* /directus/extensions/interfaces/gp-tags/
COPY --from=builder-16 /builder/src/extensions/operations/remove-banned-users-cron-handler/dist/* /directus/extensions/operations/remove-banned-users-cron-handler/
COPY --from=builder-17 /builder/src/extensions/hooks/gp-tokens/dist/* /directus/extensions/hooks/gp-tokens/
COPY --from=builder-18 /builder/src/extensions/hooks/directus-users/dist/* /directus/extensions/hooks/directus-users/
COPY --from=builder-19 /builder/src/extensions/hooks/location-overrides/dist/* /directus/extensions/hooks/location-overrides/
COPY --from=builder-01 /builder/src/extensions/hooks/sign-up/dist/* /directus/extensions/hooks/sign-up/
COPY --from=builder-02 /builder/src/extensions/interfaces/token/dist/* /directus/extensions/interfaces/token/
COPY --from=builder-03 /builder/src/extensions/token-value/dist/* /directus/extensions/directus-extension-token-value/dist/
COPY --from=builder-03 /builder/src/extensions/token-value/package.json /directus/extensions/directus-extension-token-value/
COPY --from=builder-04 /builder/src/extensions/operations/gh-webhook-handler/dist/* /directus/extensions/operations/gh-webhook-handler/
COPY --from=builder-05 /builder/src/extensions/operations/sponsors-cron-handler/dist/* /directus/extensions/operations/sponsors-cron-handler/
COPY --from=builder-06 /builder/src/extensions/modules/probes-adapter/dist/* /directus/extensions/modules/probes-adapter/
COPY --from=builder-07 /builder/src/extensions/endpoints/adoption-code/dist/* /directus/extensions/endpoints/adoption-code/
COPY --from=builder-08 /builder/src/extensions/hooks/adopted-probe/dist/* /directus/extensions/hooks/adopted-probe/
COPY --from=builder-09 /builder/src/extensions/hooks/sign-in/dist/* /directus/extensions/hooks/sign-in/
COPY --from=builder-10 /builder/src/extensions/endpoints/sync-github-data/dist/* /directus/extensions/endpoints/sync-github-data/
COPY --from=builder-11 /builder/src/extensions/interfaces/github-username/dist/* /directus/extensions/interfaces/github-username/
COPY --from=builder-12 /builder/src/extensions/operations/adopted-probes-status-cron-handler/dist/* /directus/extensions/operations/adopted-probes-status-cron-handler/
COPY --from=builder-13 /builder/src/extensions/operations/adopted-probes-credits-cron-handler/dist/* /directus/extensions/operations/adopted-probes-credits-cron-handler/
COPY --from=builder-14 /builder/src/extensions/interfaces/gp-tags/dist/* /directus/extensions/interfaces/gp-tags/
COPY --from=builder-15 /builder/src/extensions/operations/remove-banned-users-cron-handler/dist/* /directus/extensions/operations/remove-banned-users-cron-handler/
COPY --from=builder-16 /builder/src/extensions/hooks/gp-tokens/dist/* /directus/extensions/hooks/gp-tokens/
COPY --from=builder-17 /builder/src/extensions/hooks/directus-users/dist/* /directus/extensions/hooks/directus-users/
COPY --from=builder-18 /builder/src/extensions/hooks/location-overrides/dist/* /directus/extensions/hooks/location-overrides/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dashboard
# Globalping dashboard directus

## Prod first deploy

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
interval: 3s
timeout: 2s
retries: 10
directus:
globalping-dash-directus:
depends_on:
mariadb:
condition: service_healthy
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "dashboard",
"name": "globalping-dash-directus",
"version": "1.0.0",
"license": "OSL-3.0",
"description": "jsDelivr dashboard",
"description": "Globalping dashboard directus",
"private": true,
"type": "module",
"dependencies": {
Expand Down Expand Up @@ -41,10 +41,10 @@
},
"repository": {
"type": "git",
"url": "git@github.com:jsdelivr/dashboard.git"
"url": "git@github.com:jsdelivr/globalping-dash-directus.git"
},
"bugs": {
"url": "https://github.com/jsdelivr/dashboard/issues"
"url": "https://github.com/jsdelivr/globalping-dash-directus/issues"
},
"engines": {
"node": "^18.15.0"
Expand Down
4 changes: 2 additions & 2 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ if [ "$is_dev_mode" = true ]; then

perl -pi -e "s/AUTH_GITHUB_DEFAULT_ROLE_ID=.*/AUTH_GITHUB_DEFAULT_ROLE_ID=$user_role_id/" .env.development

docker compose stop directus
docker compose stop globalping-dash-directus

docker compose up -d directus
docker compose up -d globalping-dash-directus

./scripts/wait-for.sh -t 60 http://localhost:8055/admin/login

Expand Down
6 changes: 0 additions & 6 deletions seeds/development/admin-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export const seed = async (knex) => {
layout_query: { tabular: { fields: [ 'id', 'userId.first_name', 'ip', 'city', 'country', 'name', 'status', 'onlineTimesToday' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'jsd_purge_tokens',
layout_query: { tabular: { fields: [ 'id', 'user_created', 'name', 'value', 'expire', 'origins', 'date_last_used' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'gp_tokens',
Expand Down
18 changes: 0 additions & 18 deletions seeds/development/user-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const seed = async (knex) => {
}

await Promise.all([
knex('jsd_purge_tokens').delete(),
knex('gp_tokens').delete(),
knex('gp_adopted_probes').delete(),
knex('sponsors').delete(),
Expand All @@ -47,23 +46,6 @@ export const seed = async (knex) => {
knex('gp_credits').delete(),
]);

await knex('jsd_purge_tokens').insert([{
name: 'jsd-token-1',
value: 'W4jbiJLf7Lq96/Y8BDFa+rR1BLg+40OzRSEW861mzrk=', // token: 46YlMw6l2o0RvWmhuQECmbSps6Zi4kpz
user_created: user.id,
date_created: '2024-02-22 10:46:15',
}, {
name: 'jsd-token-2',
value: 'bnIf3K5QY1nNVhEXPlZci8cc8d3fXA8V6tAa2NdoVCA=', // token: 8yMyVzixoKKw3uMu19cNdZRgxT9qojhK
user_created: user.id,
user_updated: user.id,
date_created: '2024-02-22 10:49:06',
date_last_used: '2024-02-21',
date_updated: '2024-02-22 10:49:45',
expire: '2027-02-01',
origins: JSON.stringify([ 'https://www.jsdelivr.com', 'https://www.jsdelivr.com:10000' ]),
}]);

await knex('gp_tokens').insert([{
name: 'gp-token-1',
value: '0gW0wltTSo1g0WOVYxBrxGZM0ifmRH9TFiIG9GWOo8s=', // token: YmCn0sLiTmdjPmR/KQjyl9tdlpirtQKB
Expand Down
6 changes: 0 additions & 6 deletions seeds/development/user-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export const seed = async (knex) => {
layout_query: { tabular: { fields: [ 'id', 'userId.first_name', 'ip', 'city', 'country', 'name', 'status' ] } },
icon: 'bookmark',
},
{
user: user.id,
collection: 'jsd_purge_tokens',
layout_query: { tabular: { fields: [ 'id', 'user_created', 'name', 'value', 'expire', 'origins', 'date_last_used' ] } },
icon: 'bookmark',
},
{
user: user.id,
collection: 'gp_tokens',
Expand Down
Loading

0 comments on commit 68c7a9e

Please sign in to comment.