2021-07-17 05:35:43 +02:00
|
|
|
# Configuration
|
|
|
|
|
|
|
|
Piston provides many different configuration options to tweak Piston to meet your needs.
|
|
|
|
|
|
|
|
Configuration is specified through environment variables, prefixed with `PISTON_`.
|
|
|
|
|
|
|
|
## Log Level
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_LOG_LEVEL
|
|
|
|
default: INFO
|
|
|
|
```
|
|
|
|
|
|
|
|
Level of log output to provide.
|
|
|
|
|
|
|
|
One of `DEBUG`, `INFO`, `WARN`, `ERROR` or `NONE`
|
|
|
|
|
|
|
|
## Bind Address
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_BIND_ADDRESS
|
|
|
|
default: 0.0.0.0:2000
|
|
|
|
```
|
|
|
|
|
|
|
|
Port and IP address to bind the Piston API to.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
!!! warning
|
|
|
|
Changing this value is not recommended.
|
|
|
|
|
|
|
|
This changes the bind address inside the container, and thus serves no purpose when running in a container
|
|
|
|
|
|
|
|
## Data Directory
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_DATA_DIRECTORY
|
|
|
|
default: /piston
|
|
|
|
```
|
|
|
|
|
|
|
|
Absolute path to piston related data, including packages and job contexts.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
!!! warning
|
|
|
|
Changing this value is not recommended.
|
|
|
|
|
|
|
|
Some packages require absolute paths on disk at build time.
|
|
|
|
Due to this, some packages may break when changing this parameter.
|
|
|
|
|
|
|
|
## Runner GID/UID range
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key:
|
2021-10-08 15:16:57 +02:00
|
|
|
- PISTON_RUNNER_UID_MIN
|
|
|
|
- PISTON_RUNNER_UID_MAX
|
|
|
|
- PISTON_RUNNER_GID_MIN
|
|
|
|
- PISTON_RUNNER_GID_MAX
|
2021-07-17 05:35:43 +02:00
|
|
|
default:
|
2021-10-08 15:16:57 +02:00
|
|
|
- 1001
|
|
|
|
- 1500
|
|
|
|
- 1001
|
|
|
|
- 1500
|
2021-07-17 05:35:43 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
UID and GID ranges to use when executing jobs.
|
|
|
|
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
!!! warning
|
|
|
|
Changing this value is not recommended.
|
|
|
|
|
|
|
|
The piston container creates 500 users and groups by default, and reserves user/group 1000 for running the API.
|
|
|
|
Any processes run by these users will be killed when cleaning up a job.
|
|
|
|
|
|
|
|
## Disable Networking
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_DISABLE_NETWORKING
|
|
|
|
default: true
|
|
|
|
```
|
|
|
|
|
|
|
|
Disallows access to `socket` syscalls, effectively disabling networking for jobs run by piston.
|
|
|
|
|
|
|
|
## Max Process Count
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_MAX_PROCESS_COUNT
|
|
|
|
default: 64
|
|
|
|
```
|
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
Maximum number of processes allowed to to have open for a job.
|
2021-07-17 05:35:43 +02:00
|
|
|
|
|
|
|
Resists against exhausting the process table, causing a full system lockup.
|
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
## Output Max Size
|
2021-07-17 05:35:43 +02:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_OUTPUT_MAX_SIZE
|
|
|
|
default: 1024
|
|
|
|
```
|
|
|
|
|
|
|
|
Maximum size of stdio buffers for each job.
|
|
|
|
|
|
|
|
Resist against run-away output which could lead to memory exhaustion.
|
|
|
|
|
|
|
|
## Max Open Files
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_MAX_OPEN_FILES
|
|
|
|
default: 64
|
|
|
|
```
|
|
|
|
|
|
|
|
Maximum number of open files at a given time by a job.
|
|
|
|
|
|
|
|
Resists against writing many smaller files to exhaust inodes.
|
|
|
|
|
|
|
|
## Max File Size
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_MAX_FILE_SIZE
|
|
|
|
default: 10000000 #10MB
|
|
|
|
```
|
|
|
|
|
|
|
|
Maximum size for a singular file written to disk.
|
|
|
|
|
|
|
|
Resists against large file writes to exhaust disk space.
|
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
## Compile/Run timeouts
|
2021-10-08 15:16:57 +02:00
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
```yaml
|
|
|
|
key:
|
|
|
|
- PISTON_COMPILE_TIMEOUT
|
|
|
|
default: 10000
|
|
|
|
|
|
|
|
key:
|
|
|
|
- PISTON_RUN_TIMEOUT
|
|
|
|
default: 3000
|
|
|
|
```
|
2021-10-08 15:16:57 +02:00
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
The maximum time that is allowed to be taken by a stage in milliseconds.
|
|
|
|
Use -1 for unlimited time.
|
|
|
|
|
2021-07-17 05:35:43 +02:00
|
|
|
## Compile/Run memory limits
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key:
|
2021-10-08 15:16:57 +02:00
|
|
|
- PISTON_COMPILE_MEMORY_LIMIT
|
|
|
|
- PISTON_RUN_MEMORY_LIMIT
|
2021-07-17 05:35:43 +02:00
|
|
|
default: -1
|
|
|
|
```
|
|
|
|
|
|
|
|
Maximum memory allowed by a stage in bytes.
|
|
|
|
Use -1 for unlimited memory usage.
|
|
|
|
|
|
|
|
Useful for running memory-limited contests.
|
|
|
|
|
|
|
|
## Repository URL
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_REPO_URL
|
2023-02-15 04:11:49 +01:00
|
|
|
default: https://github.com/Endercheif/piston/releases/download/pkgs/index
|
2021-07-17 05:35:43 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
URL for repository index, where packages will be downloaded from.
|
2021-10-01 09:28:54 +02:00
|
|
|
|
|
|
|
## Maximum Concurrent Jobs
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_MAX_CONCURRENT_JOBS
|
|
|
|
default: 64
|
|
|
|
```
|
|
|
|
|
|
|
|
Maximum number of jobs to run concurrently.
|
2021-10-04 21:35:13 +02:00
|
|
|
|
|
|
|
## Limit overrides
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
key: PISTON_LIMIT_OVERRIDES
|
|
|
|
default: {}
|
|
|
|
```
|
|
|
|
|
|
|
|
Per-language overrides/exceptions for the each of `max_process_count`, `max_open_files`, `max_file_size`,
|
|
|
|
`compile_memory_limit`, `run_memory_limit`, `compile_timeout`, `run_timeout`, `output_max_size`. Defined as follows:
|
2021-10-08 15:16:57 +02:00
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
```
|
|
|
|
PISTON_LIMIT_OVERRIDES={"c++":{"max_process_count":128}}
|
|
|
|
```
|
2021-10-08 15:16:57 +02:00
|
|
|
|
2021-10-04 21:35:13 +02:00
|
|
|
This will give `c++` a max_process_count of 128 regardless of the configuration.
|