Skip to content

Commit 3f1d369

Browse files
authored
Merge pull request #38 from ziadhany/add-docs
Add docs for how to run the app
2 parents 1c10ede + 57aeb82 commit 3f1d369

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed
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: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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
42+
button in the app or send an HTTP request directly to the endpoint using the auth service.
43+
The endpoint is: `repository/<uuid:repository_id>/sync-repo/`
44+
45+
Visit http://127.0.0.1:8000/repo-list.
46+
47+
48+
Alternatively, you can integrate this action with GitHub Actions or any other
49+
CI tool to trigger the sync automatically whenever new data is pushed to the
50+
master branch.
51+
52+
Here’s an example of how to send the request manually using curl:
53+
ex:
54+
55+
.. code-block:: bash
56+
57+
curl -v -X POST \
58+
-H "Authorization: Token your-auth-token" \
59+
http://127.0.0.1:8000/repository/<uuid:repository_id>/sync-repo/
60+
61+
62+
**Note:** You can retrieve the service token after authenticating via the endpoint
63+
`api/v0/users/@<str:username>`.
64+
65+
Step 5:
66+
--------
67+
The admin should regularly run the following commands, either manually or in a loop:
68+
69+
.. code-block:: bash
70+
71+
python manage.py sync && python manage.py federate
72+
73+
Users can now log in or sign up, create and review metadata, and vote for packages.
74+
75+
Happy Federation, everyone!

0 commit comments

Comments
 (0)