Skip to content

Commit 403a6a1

Browse files
committed
docs: split it in setup (README) and API usage parts
The API usage part will show up in the main KernelCI docs. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
1 parent 504edcd commit 403a6a1

2 files changed

Lines changed: 78 additions & 61 deletions

File tree

README.md

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,7 @@ container=""
1818
sastoken=""
1919
```
2020

21-
## API
22-
23-
### Upload
24-
25-
`POST /upload`
26-
27-
Upload a file to the server.
28-
29-
field path: the path to store the file in the server.
30-
field file0: the file to upload.
31-
32-
### Download
33-
34-
`GET /path/to/file`
35-
36-
Download a file from the server.
37-
38-
### Authentication
21+
## Creating user tokens
3922

4023
The server uses JWT token based authentication. The token is passed in the `Authorization` header as a Bearer token.
4124
JWT secret is configured in the `config.toml` file.
@@ -45,7 +28,7 @@ JWT secret is configured in the `config.toml` file.
4528
```
4629
This will generate a JWT token for the user.
4730

48-
#### Testing Token Validity
31+
### Testing Token Validity
4932

5033
You can verify if a token is valid using the `/v1/checkauth` endpoint:
5134

@@ -58,46 +41,6 @@ curl -X GET http://localhost:3000/v1/checkauth \
5841
- `200 OK` with body `Authorized: user@email.com` - Token is valid
5942
- `401 Unauthorized` with body `Unauthorized` - Token is invalid or missing
6043

61-
### Testing upload and download using curl
62-
63-
```bash
64-
# Upload
65-
curl -X POST http://files.kernelci.org/upload \
66-
-H "Authorization: Bearer <JWT_TOKEN>" \
67-
-F "path=testfolder" \
68-
-F "file0=@local_folder/local_file"
69-
70-
# File will be uploaded to Azure Blob Storage as testfolder/local_folder/local_file
71-
72-
# Download
73-
curl http://files.kernelci.org/testfolder/local_folder/local_file
74-
```
75-
76-
## Principle of operation
77-
78-
```mermaid
79-
sequenceDiagram
80-
participant User
81-
participant Proxy Server
82-
participant Local Cache
83-
participant Azure Blob Storage
84-
85-
%% Upload Flow
86-
User->>Proxy Server: Upload File (POST Request)
87-
Proxy Server->>Azure Blob Storage: Store File in Cloud
88-
Azure Blob Storage-->>Proxy Server: Confirmation
89-
Proxy Server-->>User: Upload Successful
44+
## API
9045

91-
%% Download Flow
92-
User->>Proxy Server: Request File (GET Request)
93-
Proxy Server->>Local Cache: Check if File Exists
94-
alt File Found in Cache
95-
Local Cache-->>Proxy Server: Return Cached File
96-
Proxy Server-->>User: Send File
97-
else File Not in Cache
98-
Proxy Server->>Azure Blob Storage: Fetch File from Cloud
99-
Azure Blob Storage-->>Proxy Server: Send File Data
100-
Proxy Server->>Local Cache: Save File Locally
101-
Proxy Server-->>User: Send File
102-
end
103-
```
46+
See [docs](docs/) for the API documentation.

docs/_index.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "kernelci-storage"
3+
date: 2025-08-06
4+
description: KernelCI's Storage API documentation
5+
---
6+
7+
We have simple storage server that supports file upload and download, with JWT token based authentication.
8+
9+
## API Endpoints
10+
11+
The API is quite simple with upload through a `/upload` endpoint and download through a GET to the file url.
12+
13+
### Upload
14+
15+
`POST /upload`
16+
17+
Upload a file to the server.
18+
19+
field path: the path to store the file in the server.
20+
field file0: the file to upload.
21+
22+
### Download
23+
24+
`GET /path/to/file`
25+
26+
Download a file from the server.
27+
28+
### Request a token
29+
30+
Ask the kernelci-sysadmin team for a token.
31+
32+
### Testing upload and download using curl
33+
34+
```bash
35+
# Upload
36+
curl -X POST http://files.kernelci.org/upload \
37+
-H "Authorization: Bearer <JWT_TOKEN>" \
38+
-F "path=testfolder" \
39+
-F "file0=@local_folder/local_file"
40+
41+
# File will be uploaded to Azure Blob Storage as testfolder/local_folder/local_file
42+
43+
# Download
44+
curl http://files.kernelci.org/testfolder/local_folder/local_file
45+
```
46+
47+
## Principle of operation
48+
49+
```mermaid
50+
sequenceDiagram
51+
participant User
52+
participant Proxy Server
53+
participant Local Cache
54+
participant Azure Blob Storage
55+
56+
%% Upload Flow
57+
User->>Proxy Server: Upload File (POST Request)
58+
Proxy Server->>Azure Blob Storage: Store File in Cloud
59+
Azure Blob Storage-->>Proxy Server: Confirmation
60+
Proxy Server-->>User: Upload Successful
61+
62+
%% Download Flow
63+
User->>Proxy Server: Request File (GET Request)
64+
Proxy Server->>Local Cache: Check if File Exists
65+
alt File Found in Cache
66+
Local Cache-->>Proxy Server: Return Cached File
67+
Proxy Server-->>User: Send File
68+
else File Not in Cache
69+
Proxy Server->>Azure Blob Storage: Fetch File from Cloud
70+
Azure Blob Storage-->>Proxy Server: Send File Data
71+
Proxy Server->>Local Cache: Save File Locally
72+
Proxy Server-->>User: Send File
73+
end
74+
```

0 commit comments

Comments
 (0)