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
The first command generates a JWT secret for your configuration, the second generates a token for the specified user.
30
57
31
58
### Testing Token Validity
32
59
33
60
You can verify if a token is valid using the `/v1/checkauth` endpoint:
34
61
35
62
```bash
36
-
curl -X GET http://localhost:3000/v1/checkauth \
63
+
curl -X GET https://localhost:3000/v1/checkauth \
37
64
-H "Authorization: Bearer <JWT_TOKEN>"
38
65
```
39
66
40
67
**Responses:**
41
68
-`200 OK` with body `Authorized: user@email.com` - Token is valid
42
69
-`401 Unauthorized` with body `Unauthorized` - Token is invalid or missing
43
70
71
+
## Environment Variables
72
+
73
+
-`KCI_STORAGE_CONFIG` - Override config file path (defaults to config.toml)
74
+
-`STORAGE_DEBUG` - Enable debug logging
75
+
44
76
## API
45
77
46
-
See [docs](docs/) for the API documentation.
78
+
### Endpoints
79
+
80
+
-`GET /` - Server status
81
+
-`POST /v1/file` or `POST /upload` - File upload (requires JWT)
82
+
-`GET /*filepath` - File download (public, supports range requests)
83
+
-`GET /v1/checkauth` - Validate JWT token
84
+
-`GET /v1/list` - List all files (public)
85
+
-`GET /metrics` - Prometheus metrics endpoint
86
+
87
+
The server supports large file uploads up to 4GB and includes upload conflict protection to prevent concurrent uploads to the same file path. Downloads have a 30-second timeout for acquiring file locks.
88
+
89
+
### Metrics
90
+
91
+
The `/metrics` endpoint provides Prometheus-compatible metrics including:
92
+
-`storage_free_space` - Available disk space
93
+
-`storage_total_space` - Total disk space
94
+
95
+
Both metrics include hostname, diskname, and mount_point labels.
We have simple storage server that supports file upload and download, with JWT tokenbased authentication.
7
+
We have a simple Proxy server that supports file upload and download, with JWT token-based authentication. The server supports multiple storage backends, file caching, range requests, and provides Prometheus metrics.
8
8
9
9
## API Endpoints
10
10
11
-
The API is quite simple with upload through a `/upload` endpoint and download through a GET to the file url.
12
-
13
11
### Upload
14
12
15
-
`POST /upload`
13
+
**`POST /upload`** or **`POST /v1/file`**
16
14
17
-
Upload a file to the server.
15
+
Upload a file to the server. Requires JWT authentication.
18
16
19
-
field path: the path to store the file in the server.
20
-
field file0: the file to upload.
17
+
**Form fields:**
18
+
-`path`: The path to store the file in the server
19
+
-`file0`: The file to upload
21
20
22
21
### Download
23
22
24
-
`GET /path/to/file`
23
+
**`GET /*filepath`**
24
+
25
+
Download a file from the server. Supports range requests for partial downloads.
26
+
27
+
### Authentication Check
28
+
29
+
**`GET /v1/checkauth`**
30
+
31
+
Validate a JWT token. Returns the authenticated user's email if valid.
32
+
33
+
### List Files
34
+
35
+
**`GET /v1/list`**
36
+
37
+
List all files in the storage (public endpoint).
25
38
26
-
Download a file from the server.
39
+
### Server Status
40
+
41
+
**`GET /`**
42
+
43
+
Returns server status: "KernelCI Proxy Server"
44
+
45
+
### Metrics
46
+
47
+
**`GET /metrics`**
48
+
49
+
Prometheus metrics endpoint showing storage space and system information.
27
50
28
51
### Request a token
29
52
30
53
Ask the kernelci-sysadmin team for a token.
31
54
32
-
### Testing upload and download using curl
55
+
### Testing with curl
33
56
34
57
```bash
35
-
# Upload
36
-
curl -X POST http://files.kernelci.org/upload \
58
+
# Upload a file
59
+
curl -X POST https://files.kernelci.org/upload \
60
+
-H "Authorization: Bearer <JWT_TOKEN>" \
61
+
-F "path=testfolder" \
62
+
-F "file0=@local_folder/local_file"
63
+
64
+
# Alternative upload endpoint
65
+
curl -X POST https://files.kernelci.org/v1/file \
37
66
-H "Authorization: Bearer <JWT_TOKEN>" \
38
67
-F "path=testfolder" \
39
68
-F "file0=@local_folder/local_file"
40
69
41
-
# File will be uploaded to Azure Blob Storage as testfolder/local_folder/local_file
70
+
# File will be uploaded as testfolder/local_folder/local_file
0 commit comments