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
Copy file name to clipboardExpand all lines: README.md
+26-16Lines changed: 26 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# ContainerizationAPI
2
2
3
-
The general idea of this project is to provide a service similar to the [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI) by [The Alcoding Club](github.com/thealcodingclub) but to manually implement the containerization using cgroups, namespaces, chroot and a bunch of other unix/linux utility tools.
3
+
The general idea of this project is to provide a service similar to the [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI) by [The Alcoding Club](github.com/thealcodingclub) but to manually implement the containerization using cgroups, namespaces, chroot and a bunch of other unix/linux utility tools. This will help accomplish faster execution times and cut down on sandboxing overhead
4
4
5
5
I'm making this as part of a bigger project to host my own coding contests on a platform a little better than hackerrank. The Alcoding Club's API is fine but I need one thats more efficient and has less overhead than firejail.
6
6
@@ -11,16 +11,19 @@ To **Host** this API, you need to have Linux or WSL (if you're on windows) or Ma
11
11
12
12
## Usage
13
13
14
-
Just send an HTTP request to the `/execute` endpoint (sample requests with sample curl commands given below),
15
-
If you've already used [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI), this is basically a drop-in replacement for that project
14
+
Using this API is designed to be as simple as possible, at it's core, it's just an HTTP request that you send to `/execute`, or `/simple-execute`
16
15
17
-
### Route: /execute
16
+
The following are the routes that this API makes available, click one to see it's documentation
This route is a drop in replacement for [CodeExecutionAPI](https://github.com/thealcodingclub/CodeExecutionAPI), just take the code where you called the old API and replace `https://codeapi.anga.codes/execute` with `${url}/simple-execute` and watch as ur response times get faster!.
18
22
19
23
This route takes 4 fields:
20
24
21
25
1.`langauge`: The language of the code snippet.
22
-
23
-
<details>
26
+
<details>
24
27
<summary>Click to see supported languages</summary>
25
28
26
29
- python
@@ -29,22 +32,20 @@ This route takes 4 fields:
29
32
- c
30
33
- java
31
34
32
-
</details>
35
+
</details>
33
36
34
37
2.`code`: The code snippet to be executed.
35
-
3.`timeout`: The maximum time in seconds for which the code should run. If the code runs for more than this time, it will be terminated.
36
-
- default: **5 seconds**
37
-
- max: **60 seconds**
38
-
4.`max_memory`: The maximum memory in KB (kilobytes) that the code can use. If your code tries to use more memory than this, it'll encounter a memory limit error.
39
-
- default: **32768KB** (or 32MB)
40
-
- max: **131072KB** (or 128MB)
38
+
3.`timeout` (optional field): The maximum number of seconds for which the code should run. If the code takes more time to execute than what it was allocated, it will be terminated.
39
+
- default (value assumed if you dont specify): **5 seconds**
40
+
- max (you can't allocate more seconds than this): **60 seconds**
41
+
4.`max_memory`: The maximum memory in KB (kilobytes) that the code can use. If the code uses more memory than this, it will be terminated.
42
+
- default (value assumed if you dont specify): **32768KB** (or 32MB)
43
+
- max (you can't allocate more RAM than this): **131072KB** (or 128MB)
41
44
42
-
**Note:** The default and maximum values apply to the publically hosted URL of this repository, but if you are hosting your own instance, you can change the default and max values with environment variables (mentioned at the end of this README)
45
+
*Note: the above mentioned default and max values can be modified by editing the environment variables mentioned at the bottom of this README*
**Note**: the route `/simple-execute` also calls `/execute` under the hood, its just that the formatting for the input and output are slightly more easy to read and understand.
206
+
<details>
207
+
<summary><h3>POST Route: /execute</h3></summary>
208
+
Will type this out soon
209
+
</details>
210
+
201
211
## Environment Variables
202
212
203
213
-`MAX_TIMEOUT`: This is the maximum timeout that a request can set, if an incoming request has a higher timeout than the value you set here, then it will ignore the request's set timeout only be executed for `MAX_TIMEOUT` time.
0 commit comments