Skip to content

Commit

Permalink
feat: remove gp extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-yarmosh committed Apr 19, 2024
1 parent b24861b commit a1a6633
Show file tree
Hide file tree
Showing 157 changed files with 9 additions and 95,276 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ frontend gp_fe
default_backend gp_be
backend gp_be
server server1 127.0.0.1:8055
server server1 127.0.0.1:8056
EOF
sudo systemctl stop haproxy
sudo systemctl start haproxy
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ services:
- MARIADB_PASSWORD=password
- MARIADB_ROOT_PASSWORD=root
ports:
- "3306:3306"
- "3307:3306"
volumes:
- ./config/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-u", "directus", "-ppassword"]
interval: 3s
timeout: 2s
retries: 10
directus:
dash-directus:
depends_on:
mariadb:
condition: service_healthy
Expand All @@ -26,4 +26,4 @@ services:
env_file:
- .env.development
ports:
- "8055:8055"
- "8056:8055"
2 changes: 1 addition & 1 deletion knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default _.merge({}, ...[ 'development' ].map((environment) => {
user: 'directus',
password: 'password',
database: 'directus',
port: 3306,
port: 3307,
},
pool: {
min: 0,
Expand Down
6 changes: 3 additions & 3 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ 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 dash-directus

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

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

npm run seed
else
Expand Down
36 changes: 0 additions & 36 deletions seeds/development/admin-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,9 @@ export const seed = async (knex) => {
]);

await knex('directus_presets').insert([{
user: admin.id,
collection: 'gp_adopted_probes',
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',
layout_query: { tabular: { fields: [ 'id', 'user_created', 'name', 'value', 'expire', 'origins', 'date_last_used' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'gp_credits',
layout_query: { tabular: { fields: [ 'id', 'user_id.first_name', 'amount' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'gp_credits_additions',
layout_query: { tabular: { fields: [ 'id', 'github_id', 'amount', 'comment', 'adopted_probe.ip' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'gp_credits_deductions',
layout_query: { tabular: { fields: [ 'id', 'user_id.first_name', 'amount', 'date' ] } },
icon: 'bookmark',
},
{
user: admin.id,
collection: 'sponsors',
layout_query: { tabular: { fields: [ 'id', 'github_login', 'monthly_amount', 'last_earning_date' ] } },
icon: 'bookmark',
}]);
};
126 changes: 0 additions & 126 deletions seeds/development/user-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,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(),
knex('gp_credits_additions').delete(),
knex('gp_credits_deductions').delete(),
knex('gp_credits').delete(),
]);

await knex('jsd_purge_tokens').insert([{
Expand All @@ -63,124 +57,4 @@ export const seed = async (knex) => {
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
date_created: '2024-02-22 10:55:21',
date_last_used: null,
date_updated: null,
expire: null,
origins: null,
user_created: user.id,
user_updated: null,
}, {
name: 'gp-token-2',
value: 'YjVt9t1OiYEa7rHFzAvxH0bLZtd5fYtdzBSvQSyeSiY=', // token: QVJFyYWiEDKx6nGIqo7iMd47mx3yYBEX
date_created: '2024-02-22 10:57:21',
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' ]),
user_created: user.id,
user_updated: user.id,
}]);

const adoptedProbesIds = await knex('gp_adopted_probes').insert([{
asn: 3302,
city: 'Naples',
country: 'IT',
countryOfCustomCity: 'IT',
date_created: '2024-02-22 11:04:30',
date_updated: '2024-02-22 11:05:48',
ip: '213.136.174.80',
isCustomCity: 1,
lastSyncDate: new Date(),
latitude: 40.85216,
longitude: 14.26811,
name: 'adopted-probe-2',
network: 'IRIDEOS S.P.A.',
onlineTimesToday: 120,
state: null,
status: 'ready',
tags: JSON.stringify([{ value: 'tag-1', prefix: 'test-user-bdf-2' }]),
userId: user.id,
uuid: '681023cb-6aec-45a1-adde-e705c4043549',
version: '0.28.0',
hardwareDevice: null,
},
{
asn: 61493,
city: 'Buenos Aires',
country: 'AR',
countryOfCustomCity: null,
date_created: '2024-02-22 11:02:12',
date_updated: null,
ip: '131.255.7.26',
isCustomCity: 0,
lastSyncDate: new Date(),
latitude: -34.6131,
longitude: -58.3772,
name: null,
network: 'InterBS S.R.L. (BAEHOST)',
onlineTimesToday: 0,
state: null,
status: 'ready',
tags: null,
userId: user.id,
uuid: 'b42c4319-6be3-46d4-8a01-d4558f0c070c',
version: '0.28.0',
hardwareDevice: null,
}]);

await knex('sponsors').insert([{
date_created: '2024-02-22 11:48:00',
date_updated: null,
user_created: null,
user_updated: null,
github_id: user.external_identifier,
github_login: user.github_username,
last_earning_date: '2024-02-22 11:48:00',
monthly_amount: 5,
},
{
date_created: '2024-02-22 11:48:00',
date_updated: null,
user_created: null,
user_updated: null,
github_id: '6192491',
github_login: 'MartinKolarik',
last_earning_date: '2024-02-22 11:48:00',
monthly_amount: 100,
}]);

await knex('gp_credits_additions').insert([{
amount: 100000,
comment: 'For 50$ sponsorship',
consumed: 1,
date_created: '2024-02-22 11:46:22',
github_id: user.external_identifier,
user_updated: null,
adopted_probe: null,
},
{
amount: 10000,
comment: 'For $5 recurring sponsorship',
consumed: 1,
date_created: '2024-02-22 11:51:00',
github_id: user.external_identifier,
user_updated: null,
adopted_probe: null,
},
{
amount: 150,
comment: 'For the adopted probe "adopted-probe-2" (213.136.174.80)',
consumed: 1,
date_created: '2024-02-22 11:53:00',
github_id: user.external_identifier,
user_updated: null,
adopted_probe: adoptedProbesIds[0],
}]);

await knex('gp_credits').where({ user_id: user.id }).update({ amount: knex.raw('amount - ?', [ 110000 ]) });
};
30 changes: 0 additions & 30 deletions seeds/development/user-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,9 @@ export const seed = async (knex) => {
]);

await knex('directus_presets').insert([{
user: user.id,
collection: 'gp_adopted_probes',
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',
layout_query: { tabular: { fields: [ 'id', 'user_created', 'name', 'value', 'expire', 'origins', 'date_last_used' ] } },
icon: 'bookmark',
},
{
user: user.id,
collection: 'gp_credits',
layout_query: { tabular: { fields: [ 'amount' ] } },
icon: 'bookmark',
},
{
user: user.id,
collection: 'gp_credits_additions',
layout_query: { tabular: { fields: [ 'amount', 'comment', 'adopted_probe.ip' ] } },
icon: 'bookmark',
},
{
user: user.id,
collection: 'gp_credits_deductions',
layout_query: { tabular: { fields: [ 'amount', 'date' ] } },
icon: 'bookmark',
}]);
};
3 changes: 0 additions & 3 deletions src/extensions/endpoints/adoption-code/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions src/extensions/endpoints/adoption-code/.mocharc.json

This file was deleted.

Loading

0 comments on commit a1a6633

Please sign in to comment.