You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Function(s) and scripts for PurlDB to subscribe to Package updates over AP #47
Go to http://127.0.0.1:8000/admin/fedcode/person/add/ to add purldb. For now put any thing in summary and public key, leave user empty and in Remote actor select the one created in step 11.
Go to go to http://127.0.0.1:8000/create-repo and add the url of your clone created in step 13 https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385
Run python3 manage.py sync sync_scancode_scans to sync scan
Demo
Once the inital setup is done follow these steps
From Purldb subscribe to package update using this command python manage_purldb.py subscribe_package "pkg:npm/atlasboard"
Go to your fork (created in step 14) https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385/blob/main/npm/atlasboard/1.1.10/scancodeio.json and make any change in scan and commit the change.
In FederatedCode run python3 manage.py sync sync_scancode_scans and python3 manage.py federate
changed the title [-]Function(s) and scripts for VulnerableCode and/or PurlDB to subscribe to Package updates over AP[/-][+]Function(s) and scripts for PurlDB to subscribe to Package updates over AP[/+]on Dec 18, 2024
This is designed to be used on linux 64-bits amd with python 3.11 or 3.12
Prerequisites
Obtain the IPv4 address of your machine (you can use ip addr show).
Both federatedcode and purldb need to communicate with each other. They cannot reach each other using the host's loopback address because the host's loopback is not accessible from inside the Docker containers.
Create superuser docker compose -f docker-compose.yml run --rm web python manage.py createsuperuser
Login to federatedcode admin panel http://Your-IPv4-address:81/admin/
Go to http://Your-IPv4-address:81/admin/fedcode/service/add/ and create service select newly created superuser as user, and leave remote-actor empty.
Go to http://Your-IPv4-address:81/admin/fedcode/remoteactor/add/ and add purldb remote actor. Populate url with http://Your-IPv4-address/api/users/@purldb/ and put username as purldb
Go to http://Your-IPv4-address:81/admin/fedcode/person/add/ to add purldb. For now put any thing in summary and public key, leave user empty and in Remote actor select the one created in step 16.
Run docker compose -f docker-compose.yml run --rm web python3 manage.py sync sync_scancode_scans to sync scan
Demo
Once the initial setup is done follow these steps
cd into purldb clone and subscribe to package update using this command docker compose -f docker-compose.yml run --rm web python manage_purldb.py subscribe_package "pkg:npm/atlasboard" . On successful subscribe you will get this response {"status": "success", "message": "Successfully subscribed to package pkg:npm/atlasboard"}
Go to your fork (created in step 18) https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385/blob/main/npm/atlasboard/1.1.10/scancodeio.json and make any change in scan and commit the change.
In FederatedCode run docker compose -f docker-compose.yml run --rm web python3 manage.py sync sync_scancode_scans and docker compose -f docker-compose.yml run --rm web python3 manage.py federate
Visit PurlDB http://Your-IPv4-address/api/package_activity/ and you will find the update for pkg:npm/atlasboard in package_activity.
Important
Replace YOUR-GITHUB-USERNAME with your GitHub user/org name.
Activity
keshav-space commentedon Dec 17, 2024
Completed in: #49, #50 and aboutcode-org/purldb#557
To test Package subscription over ActivityPub in PurlDB follow the below steps
Inital PurlDB setup
git clone https://github.com/aboutcode-org/purldb.git && cd purldbgit checkout federatedcode-integrationmake dev && make envfile && make postgres.envfileFEDERATEDCODE_HOST_URL="http://127.0.0.1:8000"make runInitial FederatedCode setup
python manage.py createsuperuserurlwithhttp://127.0.0.1:8001/api/api/users/@purldband put username aspurldbRemote actorselect the one created in step 11.https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385python3 manage.py sync sync_scancode_scansto sync scanDemo
Once the inital setup is done follow these steps
python manage_purldb.py subscribe_package "pkg:npm/atlasboard"https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385/blob/main/npm/atlasboard/1.1.10/scancodeio.jsonand make any change in scan and commit the change.python3 manage.py sync sync_scancode_scansandpython3 manage.py federatepkg:npm/atlasboardin package_activity.Important
Replace
YOUR-GITHUB-USERNAMEwith your GitHub user/org name.[-]Function(s) and scripts for VulnerableCode and/or PurlDB to subscribe to Package updates over AP[/-][+]Function(s) and scripts for PurlDB to subscribe to Package updates over AP[/+]keshav-space commentedon Jan 6, 2025
@pombredanne Here is the instruction to test the package update in purldb using the docker build.
Note
This is very specific to running both purdb and federatedcode on same machine other wise we already have docs here https://federatedcode.readthedocs.io/en/latest/tutorial_getting_started.html and https://federatedcode.readthedocs.io/en/latest/tutorial_remote_subscribe_package_update.html
Important
This is designed to be used on linux 64-bits amd with python 3.11 or 3.12
Prerequisites
ip addr show).Both federatedcode and purldb need to communicate with each other. They cannot reach each other using the host's loopback address because the host's loopback is not accessible from inside the Docker containers.
Initial PurlDB setup
docker-compose.ymland add"Host(Your-IPv4-address)"in nginx route rule.nginx label should look like.
docker network create purldbdocker compose builddocker compose upInitial FederatedCode setup
docker-compose.ymland change port exposed by nginx to 81 and 442 since these ports are already in use by purldb.docker.envfile and add these linesdocker compose builddocker compose updocker compose -f docker-compose.yml run --rm web python manage.py createsuperuserhttp://Your-IPv4-address:81/admin/http://Your-IPv4-address:81/admin/fedcode/service/add/and create service select newly created superuser as user, and leave remote-actor empty.http://Your-IPv4-address:81/admin/fedcode/remoteactor/add/and add purldb remote actor. Populate url withhttp://Your-IPv4-address/api/users/@purldb/and put username aspurldbhttp://Your-IPv4-address:81/admin/fedcode/person/add/to add purldb. For now put any thing in summary and public key, leave user empty and in Remote actor select the one created in step 16.docker compose -f docker-compose.yml run --rm web python3 manage.py sync sync_scancode_scansto sync scanDemo
Once the initial setup is done follow these steps
docker compose -f docker-compose.yml run --rm web python manage_purldb.py subscribe_package "pkg:npm/atlasboard". On successful subscribe you will get this response{"status": "success", "message": "Successfully subscribed to package pkg:npm/atlasboard"}https://github.com/<YOUR-GITHUB-USERNAME>/aboutcode-packages-npm-385/blob/main/npm/atlasboard/1.1.10/scancodeio.jsonand make any change in scan and commit the change.docker compose -f docker-compose.yml run --rm web python3 manage.py sync sync_scancode_scansanddocker compose -f docker-compose.yml run --rm web python3 manage.py federatehttp://Your-IPv4-address/api/package_activity/and you will find the update for pkg:npm/atlasboard in package_activity.Important
Replace YOUR-GITHUB-USERNAME with your GitHub user/org name.