Skip to content

Commit 353f555

Browse files
committed
Add docs on how to run the app.
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent ea47351 commit 353f555

5 files changed

Lines changed: 72 additions & 0 deletions
41.5 KB
Loading
16.6 KB
Loading
40.6 KB
Loading

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ you will find information on:
2929
command-line-interface
3030
rest-api
3131
application-settings
32+
run-application
3233

3334
Indices and tables
3435
==================

docs/source/run-application.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. _run-application:
2+
3+
How to Run the Application
4+
===========================
5+
6+
This section provides an example of how to run the Federated Code application.
7+
8+
9+
Step 1: Create a Superuser
10+
---------------------------
11+
Run the following command to create a superuser:
12+
13+
.. code-block:: bash
14+
15+
python manage.py createsuperuser
16+
17+
18+
Step 2: Create a Service Account
19+
---------------------------------
20+
Only superusers can create a Service account (e.g., VCIO or SCIO).
21+
22+
1. Access the Django admin panel.
23+
http://127.0.0.1:8000/admin/
24+
25+
2. Create a new user through the admin interface.
26+
http://127.0.0.1:8000/admin/auth/user/add/
27+
28+
3. Assign the newly created user as a Service account.
29+
http://127.0.0.1:8000/admin/fedcode/service/
30+
31+
32+
Step 3: Service Login and Git Repository Creation
33+
--------------------------------------------------
34+
Now you have a Service login ex `VCIO` use this credential to create a Git Repository
35+
https://github.com/aboutcode-org/vulnerablecode-data
36+
37+
Visit http://127.0.0.1:8000/create-repo
38+
39+
Step 4:
40+
--------
41+
To initiate a sync of the master branch, you can either click on the sync request button in the app or send an HTTP request directly to the endpoint using the auth service.
42+
The endpoint is: `repository/<uuid:repository_id>/sync-repo/`
43+
44+
Visit http://127.0.0.1:8000/repo-list.
45+
46+
47+
Alternatively, you can integrate this action with GitHub Actions or any other CI tool to trigger the sync automatically whenever new data is pushed to the master branch.
48+
49+
Here’s an example of how to send the request manually using curl:
50+
ex:
51+
52+
.. code-block:: bash
53+
54+
curl -v -X POST \
55+
-H "Authorization: Token your-auth-token" \
56+
http://127.0.0.1:8000/repository/<uuid:repository_id>/sync-repo/
57+
58+
59+
**Note:** You can retrieve the service token after authenticating via the endpoint `api/v0/users/@<str:username>`.
60+
61+
Step 5:
62+
--------
63+
The admin should regularly run the following commands, either manually or in a loop:
64+
65+
.. code-block:: bash
66+
67+
python manage.py sync && python manage.py federate
68+
69+
Users can now log in or sign up, create and review metadata, and vote for packages.
70+
71+
Happy Federation, everyone!

0 commit comments

Comments
 (0)