Skip to content

Commit 0963da1

Browse files
docs: update readme and onboarding (#1724)
1 parent 072a8b8 commit 0963da1

2 files changed

Lines changed: 50 additions & 25 deletions

File tree

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ to static checks, build logs, boot logs and test results related for the Linux k
88
CI/test ecosystem. All that data will be provided by [KCIDB](https://docs.kernelci.org/kcidb/)
99
system from the [KernelCI Foundation](https://kernelci.org/).
1010

11-
# Repository
11+
## Repository
1212
What we have as a repository is a monorepo containing the *dashboard* (the web application) and a *backend*.
1313

1414
### Dashboard
@@ -18,13 +18,40 @@ A web app built with [React](https://react.dev/) + [Typescript](https://www.type
1818
A Python http server built with [Django](https://www.djangoproject.com/) + [DRF](https://www.django-rest-framework.org/), to see more information check the backend [README](/backend/README.md).
1919

2020

21-
# Build
21+
## Build
2222

23-
Create a .env file in /dashboard (Do not forget to check and set the variables and their values)
23+
### Frontend
24+
25+
Create a .env file in /dashboard, check and set the variables and their values
2426
```sh
2527
cp ./dashboard/.env.example ./dashboard/.env
2628
```
2729

30+
With docker, you can start just the frontend with `docker compose up --build proxy`. It is also possible to run the dashboard outside of it for development purposes.
31+
32+
We use `pnpm` to help with the package management. Install the dependencies with
33+
```sh
34+
pnpm install
35+
```
36+
37+
Then start the dev server with
38+
```sh
39+
pnpm dev
40+
```
41+
42+
If you want to test the production state of the dashboard, use
43+
```sh
44+
pnpm build
45+
pnpm preview
46+
```
47+
48+
### Backend
49+
50+
Create a .env file in the base directory,
51+
```sh
52+
cp .env.backend.example .env.bakckend
53+
```
54+
2855
Create a secret key for Django:
2956
```sh
3057
export DJANGO_SECRET_KEY=$(openssl rand -base64 22)
@@ -59,22 +86,17 @@ If you are going to use a database user other than `kernelci`, set it to `DB_DEF
5986
export DB_DEFAULT_USER=<user>
6087
```
6188

62-
If you are setting up instance different than production KernelCI dashboard, you need to define CORS_ALLOWED_ORIGINS.
63-
64-
docker-compose example:
65-
```yaml
66-
services:
67-
backend:
68-
environment:
69-
CORS_ALLOWED_ORIGINS: ["https://d.kernelci.org","https://dashboard.kernelci.org"]
70-
```
71-
or .env file example:
89+
If you are setting up instance different than production KernelCI dashboard, you need to define CORS_ALLOWED_ORIGINS. On .env.backend:
7290
```
7391
CORS_ALLOWED_ORIGINS=["https://d.kernelci.org","https://dashboard.kernelci.org"]
7492
```
7593

94+
It is also possible to run the backend outside of docker for development purposes. Simply run the ssh tunnel with the instructions sent to you by the database manager, then export the variables seen in [.env.backend.example](/.env.backend.example).
95+
7696
> For other optional envs, check the [backend README](backend/README.md).
7797
98+
### Common
99+
78100
Startup the services:
79101
```sh
80102
docker compose up --build -d
@@ -90,7 +112,7 @@ sudo -E docker compose up --build -d
90112
```
91113
Or you can also run the env exports and docker compose within the root user by running `sudo su`.
92114

93-
> Tip: you can create a quick script to set all the necessary envs and start the services. This will also allow docker to see the environment variables correclty.
115+
> Tip: you can create a quick script to set all the necessary envs and start the services. This will also allow docker to see the environment variables correclty. Example:
94116
95117
```sh
96118
export DB_DEFAULT_USER=email@email.com
@@ -101,9 +123,9 @@ export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
101123
docker compose up --build
102124
```
103125

104-
> [Note] If you are going to run using only a dump of the database, the DB_DEFAULT_NAME should be `dashboard` and the `DB_DEFAULT_USER` and `DB_DEFAULT_PASSWORD` should be `admin` (for now).
126+
> [Note] If you are going to run using only the local database, the DB_DEFAULT_NAME should be `dashboard` and the `DB_DEFAULT_USER` and `DB_DEFAULT_PASSWORD` should be `admin` (for now).
105127
> After you define those values, also set the env var `USE_DASHBOARD_DB` to True, setting the local database as the default one.
106-
> You can also skip the cloud-proxy on such case.
128+
> You could also set the DB_DEFAULT variables to point to the local database and leave `USE_DASHBOARD_DB` as False.
107129
108130

109131
## Deploying to production
@@ -117,5 +139,5 @@ See details about our new [notifications](docs/notifications.md) system.
117139

118140
## Contributing
119141

120-
There is an [onboarding guide](docs/Onboarding.md) to help get acquainted with the project.
142+
Check out our [CONTRIBUTING.md](/CONTRIBUTING.md), and there is an [onboarding guide](docs/Onboarding.md) to help get acquainted with the project. Contributions are welcome!
121143

docs/Onboarding.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ Definition of Done: The Redis server is running and you do not encounter Redis-r
5757

5858
### Task 2: Run the Backend locally
5959
1. Clone the KernelCI Dashboard repository from the following link: https://github.com/kernelci/dashboard
60-
2. Read the main README.md file to understand the project structure and how to run the project. Don't forget to communicate if there is something that you don't understand and feel free to send a PR with improvements.
61-
3. Go to the `backend` directory, see the README.md from the backend and run the project locally (read at least up to "Running the server").
60+
2. Go to the `backend` directory, see the [README.md](../backend/README.md) from the backend and run the project locally (read at least up to "Running the server").
61+
3. At this point you should have already read the [main README](../README.md) file for a general context of the project and how to run it too. If there are any mistakes feel free to send a PR with corrections and changes.
6262

6363
Definition of Done: You have the KernelCI Dashboard backend running locally.
6464

65+
6566
### Task 3: Get acquainted with the backend
6667
> Note:
6768
> Although the example requests use httpie, you can use any other request tool (such as curl, Postman, or Insomnia) to interact with the API.
6869
6970
1. Install [httpie](https://github.com/httpie)
7071
2. Check the folder `backend/requests` and see that there are multiple bash scripts file, those are httpie requests, try to run some of those. (If one of those requests is not working, it is a good opportunity to created a ticket or fix in a PR).
71-
3. Try to see in the [KernelCI Dashboard](https://dashboard.kernelci.org/) to see if you can view where those calls are being made.
72-
4. Try to see how the endpoints you can see where the URLs lead to in the `backend/kernelCI_app/urls.py` file.
72+
3. Try to look in the [KernelCI Dashboard](https://dashboard.kernelci.org/) to see if you can view where those calls are being made.
73+
4. Check the URL to endpoint relationship in the [backend/kernelCI_app/urls.py](../backend/kernelCI_app/urls.py) file.
7374

7475
Definition of Done: You have run some requests to the KernelCI Dashboard API and try to have a high level understanding of at least one endpoint from the dashboard to the database.
7576

@@ -78,18 +79,20 @@ Definition of Done: You have run some requests to the KernelCI Dashboard API and
7879
1. Install a Database management software like [DBeaver](https://dbeaver.io/) or [pgAdmin](https://www.pgadmin.org/)
7980
2. Connect to the KernelCI Database and try to see the tables and the data that is stored there.
8081
3. Read this docs to understand the database: [Database Knowledge](../backend/docs/database-logic.md)
81-
4. Try to make some SQL queries to see what you can do, feel free to look at the Backend code.
82+
4. Make some direct SQL queries to see what you can do, feel free to look at the Backend code.
8283
5. Move some data from kcidb to the dashboard_db by running the `update_db` command with `poetry run python3 manage.py update_db`. You don't need a lot of data, specially considering that the database is heavy. For now, just a couple of hours should suffice.
8384

84-
Definition of Done: Run a SQL query that gets all the tests from a specific Tree. (Feel free to choose any), you can post the query Result in the Github Issue.
85+
Definition of Done: Run a SQL query that gets all the tests from a specific Tree. (Feel free to choose any), post the query Result in the Github Issue.
86+
8587

8688
### Task 5: Run the Frontend locally
87-
1. Go to the `dashboard` directory, see the README.md from the frontend and try running the project locally.
88-
2. Look at the folder `api` and see how the requests are made, copy and search for where those requests are being used and see if you can relate with the production dashboard.
89+
1. Go to the `dashboard` directory, see the [README.md](../dashboard/README.md) from the frontend and try running the project locally.
90+
2. Look at the folder `api` and see how the requests are made, search for where those functions are being used (where the requests are made) and see if you can relate with the production dashboard.
8991
3. Try to mess with the code, change some colors, add some logs, try to understand the code structure, if there is a library that you don't know, read the documentation on that.
9092

9193
Definition of Done: You have the KernelCI Dashboard frontend running locally.
9294

95+
9396
### Task 6: Run the project in docker
9497

9598
> [!TIP]

0 commit comments

Comments
 (0)