Spaces:
Build error
Build error
Upload 177 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- CHANGELOG.md +1328 -0
- CODE_OF_CONDUCT.md +76 -0
- Dockerfile +52 -0
- Gemfile +21 -0
- Gemfile.lock +244 -0
- LICENSE +674 -0
- PRIVACY_POLICY.md +9 -0
- Rakefile +7 -0
- SECURITY.md +16 -0
- SPONSORSHIP.md +85 -0
- TELEMETRY.md +36 -0
- agricius +128 -0
- app/channels/application_cable/channel.rb +4 -0
- app/channels/application_cable/connection.rb +4 -0
- app/controllers/application_controller.rb +13 -0
- app/controllers/concerns/.keep +0 -0
- app/controllers/health_controller.rb +27 -0
- app/controllers/home_controller.rb +11 -0
- app/controllers/info_controller.rb +98 -0
- app/controllers/languages_controller.rb +13 -0
- app/controllers/sessions_controller.rb +51 -0
- app/controllers/statuses_controller.rb +5 -0
- app/controllers/submissions_controller.rb +236 -0
- app/enumerations/status.rb +30 -0
- app/helpers/config.rb +90 -0
- app/helpers/isolate_runner.rb +39 -0
- app/helpers/nil_value.rb +6 -0
- app/helpers/system_info.rb +13 -0
- app/jobs/application_job.rb +2 -0
- app/jobs/isolate_job.rb +371 -0
- app/mailers/application_mailer.rb +4 -0
- app/models/application_record.rb +3 -0
- app/models/concerns/.keep +0 -0
- app/models/language.rb +21 -0
- app/models/submission.rb +261 -0
- app/serializers/language_serializer.rb +3 -0
- app/serializers/status_serializer.rb +4 -0
- app/serializers/submission_serializer.rb +65 -0
- app/services/base64_service.rb +11 -0
- app/services/fields/submission.rb +41 -0
- app/views/layouts/mailer.html.erb +13 -0
- app/views/layouts/mailer.text.erb +1 -0
- bin/bundle +3 -0
- bin/rails +9 -0
- bin/rake +9 -0
- bin/setup +34 -0
- bin/spring +15 -0
- bin/telemetry +3 -0
- bin/update +29 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
bin/telemetry filter=lfs diff=lfs merge=lfs -text
|
CHANGELOG.md
ADDED
@@ -0,0 +1,1328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is the Changelog for Judge0 CE. The Changelog for Judge0 Extra CE can be found [here](https://github.com/judge0/judge0/blob/extra/CHANGELOG.md). Learn more about their difference [here](https://github.com/judge0/judge0#flavors).
|
2 |
+
|
3 |
+
# v1.13.1 (2024-04-18)
|
4 |
+
Security researcher [Daniel Cooper](https://www.linkedin.com/in/daniel-cooper4) (@stacksparrow4) found three critical vulnerabilities in Judge0 versions `<= 1.13.0`, which this release fixes. Thank you, Daniel, for your contribution.
|
5 |
+
|
6 |
+
## Security Fixes
|
7 |
+
This release fixes the following security vulnerabilities:
|
8 |
+
- [CVE-2024-28185](https://github.com/judge0/judge0/security/advisories/GHSA-h9g2-45c8-89cf)
|
9 |
+
- [CVE-2024-28189](https://github.com/judge0/judge0/security/advisories/GHSA-3xpw-36v7-2cmg)
|
10 |
+
- [CVE-2024-29021](https://github.com/judge0/judge0/security/advisories/GHSA-q7vg-26pg-v5hr)
|
11 |
+
|
12 |
+
## Deployment Procedure
|
13 |
+
Judge0 is collecting telemetry data to help improve the product and understand its use in various production environments. Read more about telemetry [here](https://github.com/judge0/judge0/blob/v1.13.1/TELEMETRY.md).
|
14 |
+
|
15 |
+
#### System Requirements
|
16 |
+
Please note that Judge0 has only been tested on **Linux** and might not work on other systems; thus, we do not provide support for it.
|
17 |
+
|
18 |
+
We recommend using Ubuntu 22.04, on which you need to do the following update of GRUB:
|
19 |
+
1. Use `sudo` to open file `/etc/default/grub`
|
20 |
+
2. Add `systemd.unified_cgroup_hierarchy=0` in the value of `GRUB_CMDLINE_LINUX` variable.
|
21 |
+
4. Apply the changes: `sudo update-grub`
|
22 |
+
5. Restart your server: `sudo reboot`
|
23 |
+
|
24 |
+
Additionally, make sure you have [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose) installed.
|
25 |
+
|
26 |
+
#### Deployment Steps
|
27 |
+
1. Download and extract the release archive:
|
28 |
+
```
|
29 |
+
wget https://github.com/judge0/judge0/releases/download/v1.13.1/judge0-v1.13.1.zip
|
30 |
+
unzip judge0-v1.13.1.zip
|
31 |
+
```
|
32 |
+
|
33 |
+
2. Visit [this website](https://www.random.org/passwords/?num=1&len=32&format=plain&rnd=new) to generate a random password.
|
34 |
+
3. Use the generated password to update the variable `REDIS_PASSWORD` in the `judge0.conf` file.
|
35 |
+
4. Visit again [this website](https://www.random.org/passwords/?num=1&len=32&format=plain&rnd=new) to generate another random password.
|
36 |
+
5. Use the generated password to update the variable `POSTGRES_PASSWORD` in the `judge0.conf` file.
|
37 |
+
6. Run all services and wait a few seconds until everything is initialized:
|
38 |
+
```
|
39 |
+
cd judge0-v1.13.1
|
40 |
+
docker-compose up -d db redis
|
41 |
+
sleep 10s
|
42 |
+
docker-compose up -d
|
43 |
+
sleep 5s
|
44 |
+
```
|
45 |
+
7. Your instance of Judge0 CE v1.13.1 is now up and running; visit docs at `http://<IP ADDRESS OF YOUR SERVER>:2358/docs`.
|
46 |
+
|
47 |
+
|
48 |
+
# v1.13.0 (2021-03-10)
|
49 |
+
Huge thanks to [**Filtered**](https://www.filtered.ai) for sponsoring this release.
|
50 |
+
|
51 |
+
## New Features
|
52 |
+
- Added support for `enable_network` configuration flag. With the new `ALLOW_ENABLE_NETWORK` configuration variable, usage of this flag can be permitted or denied. Furthermore, with the new `ENABLE_NETWORK` configuration variable the default value of this flag can be set for every submission.
|
53 |
+
- Commits: [@62a00520](https://github.com/judge0/judge0/commit/62a00520692c2b7a8bf0f54528aee8fbbf864f36)
|
54 |
+
- Added `USE_DOCS_AS_HOMEPAGE` configuration variable, which allows you to show or hide Judge0 homepage. **Now, by default, Judge0 homepage is empty** and does not show the API documentation. However, you can still access the API documentation via `/docs`.
|
55 |
+
- Issues: [#257](https://github.com/judge0/judge0/issues/257)
|
56 |
+
|
57 |
+
## Bug Fixes
|
58 |
+
- Fixed the bug where the wrong number of workers would be reported via `/workers`.
|
59 |
+
- Issues: [#256](https://github.com/judge0/judge0/issues/256)
|
60 |
+
|
61 |
+
## Security Fixes
|
62 |
+
- **HIGH** Fixed a security bug where certain submission configuration settings would allow the user to run a program that would run infinetly long. With this fix `wall_time_limit` **must** be at least 1 second.
|
63 |
+
- Commits: [@fce8d97a](https://github.com/judge0/judge0/commit/fce8d97ae765e87c4584115fcb73bd288d64d815)
|
64 |
+
|
65 |
+
## Other Changes
|
66 |
+
- Allow setting the `max_file_size` and `stack_limit` to 0 kB.
|
67 |
+
- Issues: [#242](https://github.com/judge0/judge0/issues/242)
|
68 |
+
- Commits: [@bf7c1284](https://github.com/judge0/judge0/commit/bf7c1284fe756d348154546ad8a6280ce3af5eb2) [@5a4b79ab](https://github.com/judge0/judge0/commit/5a4b79abd19c20b7b26ef70cf862da25f5fd8008)
|
69 |
+
- Allow setting the `cpu_time_limit` and `cpu_extra_time` to 0 seconds.
|
70 |
+
- Commits: [@fce8d97a](https://github.com/judge0/judge0/commit/fce8d97ae765e87c4584115fcb73bd288d64d815)
|
71 |
+
- Updated to a port 2358 as a new **default port for Judge0** as a online code execution service.
|
72 |
+
- Issues: [#205](https://github.com/judge0/judge0/issues/205)
|
73 |
+
- Commits: [@ea9c7c97](https://github.com/judge0/judge0/commit/ea9c7c975e0697d66ada910ec7806d3c28ad4a03)
|
74 |
+
- Updated the default number of Judge0 Workers, those that acutally run the user's code, to the 2*[`nproc`](https://linux.die.net/man/1/nproc). This has been shown as a good choice for general purpose use-case.
|
75 |
+
- Commits: [@113d9c74](https://github.com/judge0/judge0/commit/113d9c74b4659cf6707e748eb6e04701ce67d3f0)
|
76 |
+
- Updated the default number of Rails threads to `nproc` and Rails processes to 2. This has been shown as a good choice for general purpose use-case.
|
77 |
+
- Commits: [@113d9c74](https://github.com/judge0/judge0/commit/113d9c74b4659cf6707e748eb6e04701ce67d3f0)
|
78 |
+
- Updated Let's Encrypt Docker image for deployment with HTTPS.
|
79 |
+
- Commits: [@86b7f8e8](https://github.com/judge0/judge0/commit/86b7f8e8d0154ab5044db91c537872ea8deb7343)
|
80 |
+
- Updated Nginx proxy Docker image that is used in development setup and deployment with HTTPS.
|
81 |
+
- Commits: [@83f5b175](https://github.com/judge0/judge0/commit/83f5b175d0925fe21374e9c70d7fbb4e6941fa9c)
|
82 |
+
- Fixed documentation typos. Thank you @balababa.
|
83 |
+
- Pull Requests: [#245](https://github.com/judge0/judge0/pull/245)
|
84 |
+
- Updated base image to `judge0/compilers:1.4.0` which uses updated Isolate to [@ad39cc4d](https://github.com/judge0/isolate/commit/ad39cc4d0fbb577fb545910095c9da5ef8fc9a1a).
|
85 |
+
|
86 |
+
## Deployment Procedure
|
87 |
+
Judge0 is collecting telemetry data to help understand how to improve the product and to better understand how Judge0 is used in various production environments. Read more about telemetry [here](https://github.com/judge0/judge0/blob/v1.13.0/TELEMETRY.md).
|
88 |
+
|
89 |
+
Please note that Judge0 has only been tested on **Linux** and **macOS**, and might not work on Windows, thus we do not provide support for it.
|
90 |
+
|
91 |
+
### With HTTP
|
92 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
93 |
+
2. Download and extract the release archive:
|
94 |
+
```
|
95 |
+
wget https://github.com/judge0/judge0/releases/download/v1.13.0/judge0-v1.13.0.zip
|
96 |
+
unzip judge0-v1.13.0.zip
|
97 |
+
```
|
98 |
+
|
99 |
+
3. Run all services and wait a few seconds until everything is initialized:
|
100 |
+
```
|
101 |
+
cd judge0-v1.13.0
|
102 |
+
docker-compose up -d db redis
|
103 |
+
sleep 10s
|
104 |
+
docker-compose up -d
|
105 |
+
sleep 5s
|
106 |
+
```
|
107 |
+
|
108 |
+
4. Your instance of Judge0 CE v1.13.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>:2358`.
|
109 |
+
|
110 |
+
### With HTTPS (SSL/TLS)
|
111 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
112 |
+
2. Download and extract the release archive:
|
113 |
+
```
|
114 |
+
wget https://github.com/judge0/judge0/releases/download/v1.13.0/judge0-v1.13.0-https.zip
|
115 |
+
unzip judge0-v1.13.0-https.zip
|
116 |
+
```
|
117 |
+
|
118 |
+
3. Change directory to `judge0-v1.13.0-https`:
|
119 |
+
```
|
120 |
+
cd judge0-v1.13.0-https
|
121 |
+
```
|
122 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
123 |
+
5. Run all services and wait a few seconds until everything is initialized:
|
124 |
+
```
|
125 |
+
docker-compose up -d db redis
|
126 |
+
sleep 10s
|
127 |
+
docker-compose up -d
|
128 |
+
sleep 5s
|
129 |
+
```
|
130 |
+
|
131 |
+
6. Your instance of Judge0 CE v1.13.0 is now available at `https://<YOUR DOMAIN>`.
|
132 |
+
|
133 |
+
|
134 |
+
# v1.12.0 (2020-10-18)
|
135 |
+
## New Features
|
136 |
+
- Added support for invalidating statistics cache using the `invalidate_cache` query parameter.
|
137 |
+
- Commits: [@561c2a30](https://github.com/judge0/judge0/commit/561c2a309d98680801628fc2d79ea17e885e1d66)
|
138 |
+
- Added rake task `judge0:run_in_queue` to manually run submissions that might have stuck in the `In Queue` state.
|
139 |
+
- Commits: [@c3b87d23](https://github.com/judge0/judge0/commit/c3b87d232a8e922b5ae04f5afdb12fc49b2ec003)
|
140 |
+
- Added support for specifying `CALLBACKS_MAX_TRIES` and `CALLBACKS_TIMEOUT`. This is a global configuration that applies to all submissions that have defined webhooks (HTTP callbacks).
|
141 |
+
- Commits: [@c4bb76ec](https://github.com/judge0/judge0/commit/c4bb76ec866bce6b07bd733391291e720f40ef96)
|
142 |
+
- Added support for submission caching to reduce the number of unnecessary database hits. Cache duration can be controlled with the `SUBMISSION_CACHE_DURATION` variable which is currently set to 1 second by default. Submissions are only cached for `GET /submissions/<token>` route. Cache files are written to the server's file system and are automatically cleared every day at midnight. This is the first step toward more serious submission caching in the future.
|
143 |
+
- Commits: [@7a33c61c](https://github.com/judge0/judge0/commit/7a33c61c8dcbcdbf31fd4d93ef76cc2f1f5e154b) [@0b344920](https://github.com/judge0/judge0/commit/0b344920bd70bd2bf4b2a53fc78b6b145c298cbc)
|
144 |
+
|
145 |
+
## Improvements
|
146 |
+
- Update PostgreSQL to 13.0 and Redis to 6.0.
|
147 |
+
- Commits: [@05330f11](https://github.com/judge0/judge0/commit/05330f112b26850a18c59a380991f8b401eae224) [@be300efa](https://github.com/judge0/judge0/commit/be300efa4bec7653303bb76681f91588550c25ef)
|
148 |
+
- Reschedule failed jobs after 0.1 seconds with 100 attempts.
|
149 |
+
- Commits: [@f7265cf8](https://github.com/judge0/judge0/commit/f7265cf8d53ef5319a9e96e1bf7bee8649b09762) [@e003c888](https://github.com/judge0/judge0/commit/e003c888e64ea4f4a83e1acce8d355b666276aa2)
|
150 |
+
- Send only submission ID to the worker and not the whole serialized submission.
|
151 |
+
- Commits: [@f7265cf8](https://github.com/judge0/judge0/commit/f7265cf8d53ef5319a9e96e1bf7bee8649b09762) [@4222c090](https://github.com/judge0/judge0/commit/4222c090689deb1a356cf6c2588b81b9904124f1)
|
152 |
+
- Automatically restart Judge0 server without the need for Docker restart policies. Use the `RESTART_MAX_TRIES` variable to specify the maximum number of restart tries.
|
153 |
+
- Commits: [@65756516](https://github.com/judge0/judge0/commit/65756516b331265ec5a6742372ecc57ecbb8ca71) [@c0fd97e2](https://github.com/judge0/judge0/commit/c0fd97e2359172f7fc8bf7195089ab7c19845728)
|
154 |
+
|
155 |
+
## Bug Fixes
|
156 |
+
- Fixed a bug in the `is_project` method of submission model where an exception was raised and not handled properly due to unknown language.
|
157 |
+
- Commits: [@6426ac61](https://github.com/judge0/judge0/commit/6426ac61ea6723fcf6b93b72024ec39e3dc4b7f2)
|
158 |
+
|
159 |
+
## Other Changes
|
160 |
+
- Use Docker volumes for storing Postgres and Redis data instead of mounting directories. This is now the new recommended setting.
|
161 |
+
- Commits: [@600f5aaa](https://github.com/judge0/judge0/commit/600f5aaa3facfef38dd2cd5df25ac248734ace97)
|
162 |
+
- Added Resque Web to the development stack.
|
163 |
+
- Commits: [@3762a635](https://github.com/judge0/judge0/commit/3762a6355b8911d8d8e13d91869edeef9bec0a4f)
|
164 |
+
- Changed binding ports for Nginx and documentation server in the development stack. Nginx is now bound to port 80, and the development server to port 3001.
|
165 |
+
- Commits: [@3762a635](https://github.com/judge0/judge0/commit/3762a6355b8911d8d8e13d91869edeef9bec0a4f)
|
166 |
+
- Removed port bindings of Postgres and Redis in the development stack.
|
167 |
+
- Commits: [@3762a635](https://github.com/judge0/judge0/commit/3762a6355b8911d8d8e13d91869edeef9bec0a4f)
|
168 |
+
- Added PgBouncer to the development stack for testing and experimenting.
|
169 |
+
- Commits: [@24b3227a](https://github.com/judge0/judge0/commit/24b3227a0a47dcca89041e1c08106d08a413dcf3)
|
170 |
+
- Changed recommended values for `POSTGRES_DB` and `POSTGRES_USER`. Both are now `judge0`.
|
171 |
+
- Commits: [@745f4455](https://github.com/judge0/judge0/commit/745f4455937d15f2f6093539e9ab96c40bc506da)
|
172 |
+
|
173 |
+
## Deployment Procedure
|
174 |
+
Judge0 is collecting telemetry data to help understand how to improve the product and to better understand how Judge0 is used in various production environments. Read more about telemetry [here](https://github.com/judge0/judge0/blob/v1.12.0/TELEMETRY.md).
|
175 |
+
|
176 |
+
Please note that Judge0 has only been tested on **Linux** and **macOS**, and might not work on Windows, thus we do not provide support for it.
|
177 |
+
|
178 |
+
### With HTTP
|
179 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
180 |
+
2. Download and extract release archive:
|
181 |
+
```
|
182 |
+
wget https://github.com/judge0/judge0/releases/download/v1.12.0/judge0-v1.12.0.zip
|
183 |
+
unzip judge0-v1.12.0.zip
|
184 |
+
```
|
185 |
+
|
186 |
+
3. Run all services and wait a few seconds until everything is initialized:
|
187 |
+
```
|
188 |
+
cd judge0-v1.12.0
|
189 |
+
docker-compose up -d db redis
|
190 |
+
sleep 10s
|
191 |
+
docker-compose up -d
|
192 |
+
sleep 5s
|
193 |
+
```
|
194 |
+
|
195 |
+
4. Your instance of Judge0 v1.12.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
196 |
+
|
197 |
+
### With HTTPS (SSL/TLS)
|
198 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
199 |
+
2. Download and extract release archive:
|
200 |
+
```
|
201 |
+
wget https://github.com/judge0/judge0/releases/download/v1.12.0/judge0-v1.12.0-https.zip
|
202 |
+
unzip judge0-v1.12.0-https.zip
|
203 |
+
```
|
204 |
+
|
205 |
+
3. Change directory to `judge0-v1.12.0-https`:
|
206 |
+
```
|
207 |
+
cd judge0-v1.12.0-https
|
208 |
+
```
|
209 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
210 |
+
5. Run all services and wait a few seconds until everything is initialized:
|
211 |
+
```
|
212 |
+
docker-compose up -d db redis
|
213 |
+
sleep 10s
|
214 |
+
docker-compose up -d
|
215 |
+
sleep 5s
|
216 |
+
```
|
217 |
+
|
218 |
+
6. Your instance of Judge0 v1.12.0 is now available at `https://<YOUR DOMAIN>`.
|
219 |
+
|
220 |
+
|
221 |
+
# v1.11.0 (2020-09-09)
|
222 |
+
## New Features
|
223 |
+
- Added queue size into response of `/workers`.
|
224 |
+
- Issues: [#210](https://github.com/judge0/judge0/issues/210)
|
225 |
+
- Commits: [@7ee1b10c](https://github.com/judge0/judge0/commit/7ee1b10c79576e745140f02d49446d57a208bcca)
|
226 |
+
|
227 |
+
## Improvements
|
228 |
+
- Set configuration defaults even if `judge0.conf` is not present. Thank you @vvalchev.
|
229 |
+
- Issues: [#206](https://github.com/judge0/judge0/issues/206)
|
230 |
+
- Commits: [@8c42f7be](https://github.com/judge0/judge0/commit/8c42f7befcdf8d70fa8cb4e3ba549c828c38164d)
|
231 |
+
|
232 |
+
## Other Changes
|
233 |
+
- Updated documentation with some better explanation on the use of `base64_encoded` query parameter. Thank you @mejibyte.
|
234 |
+
|
235 |
+
## Deployment Procedure
|
236 |
+
Judge0 is collecting telemetry data to help understand how to improve the product and to better understand how Judge0 is used in various production environments. Read more about telemetry [here](https://github.com/judge0/judge0/blob/v1.11.0/TELEMETRY.md).
|
237 |
+
|
238 |
+
Please note that Judge0 has only been tested on **Linux** and might not work on Windows or macOS, thus we do not provide support for these systems.
|
239 |
+
|
240 |
+
### With HTTP
|
241 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
242 |
+
2. Download and extract release archive:
|
243 |
+
```
|
244 |
+
wget https://github.com/judge0/judge0/releases/download/v1.11.0/judge0-v1.11.0.zip
|
245 |
+
unzip judge0-v1.11.0.zip
|
246 |
+
```
|
247 |
+
|
248 |
+
3. Run all services and wait few seconds until everything is initialized:
|
249 |
+
```
|
250 |
+
cd judge0-v1.11.0
|
251 |
+
docker-compose up -d db redis
|
252 |
+
sleep 10s
|
253 |
+
docker-compose up -d
|
254 |
+
sleep 5s
|
255 |
+
```
|
256 |
+
|
257 |
+
4. Your instance of Judge0 v1.11.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
258 |
+
|
259 |
+
### With HTTPS (SSL/TLS)
|
260 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
261 |
+
2. Download and extract release archive:
|
262 |
+
```
|
263 |
+
wget https://github.com/judge0/judge0/releases/download/v1.11.0/judge0-v1.11.0-https.zip
|
264 |
+
unzip judge0-v1.11.0-https.zip
|
265 |
+
```
|
266 |
+
|
267 |
+
3. Change directory to `judge0-v1.11.0-https`:
|
268 |
+
```
|
269 |
+
cd judge0-v1.11.0-https
|
270 |
+
```
|
271 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
272 |
+
5. Run all services and wait few seconds until everything is initialized:
|
273 |
+
```
|
274 |
+
docker-compose up -d db redis
|
275 |
+
sleep 10s
|
276 |
+
docker-compose up -d
|
277 |
+
sleep 5s
|
278 |
+
```
|
279 |
+
|
280 |
+
6. Your instance of Judge0 v1.11.0 is now available at `https://<YOUR DOMAIN>`.
|
281 |
+
|
282 |
+
|
283 |
+
# v1.10.0 (2020-07-27)
|
284 |
+
## New Features
|
285 |
+
- Added support for multi-file programs in the terms of adding a new special language called **Multi-file program**. In total there are now **47 active languages**.
|
286 |
+
|
287 |
+
|ID|Name|Note|
|
288 |
+
|---|---|---|
|
289 |
+
|89|Multi-file program||
|
290 |
+
|
291 |
+
Multi-file programs allow you specify your own compilation and execution scripts that Judge0 will use.
|
292 |
+
|
293 |
+
To use multi-file program feature you need to choose a language called *Multi-file program* whoose ID is **89**. Moreover, you need to send all program files with `additional_files` attribute. With multi-file programs attribute `source_code` cannot be used, i.e. all files should be sent with `additional_files` attribute.
|
294 |
+
|
295 |
+
For the Judge0 to know how to compile and execute your multi-file program you need to provide two special files that should be available in the root of the `.zip` archive that you are sending with `additional_files` attribute. These files should be named `compile` and `run`, and are expected to be Bash scripts that know how to compile and execute your multi-file program. If your multi-file program does not need compilation step, then you don't need to provide `compile` script. Take a look at [this example](https://github.com/judge0/examples/tree/master/cpp-project-01) to learn how to use this feature to compile and run multi-file C++ project that uses CMake.
|
296 |
+
|
297 |
+
## Other Changes
|
298 |
+
- Updated gems.
|
299 |
+
|
300 |
+
## Deployment Procedure
|
301 |
+
Judge0 is collecting telemetry data to help understand how to improve the product and to better understand how Judge0 is used in various production environments. Read more about telemetry [here](https://github.com/judge0/api/blob/v1.10.0/TELEMETRY.md).
|
302 |
+
|
303 |
+
### With HTTPS (SSL/TLS)
|
304 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
305 |
+
2. Download and extract release archive:
|
306 |
+
```
|
307 |
+
wget https://github.com/judge0/api/releases/download/v1.10.0/judge0-v1.10.0-https.zip
|
308 |
+
unzip judge0-v1.10.0-https.zip
|
309 |
+
```
|
310 |
+
|
311 |
+
3. Change directory to `judge0-v1.10.0-https`:
|
312 |
+
```
|
313 |
+
cd judge0-v1.10.0-https
|
314 |
+
```
|
315 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
316 |
+
5. Run all services and wait few seconds until everything is initialized:
|
317 |
+
```
|
318 |
+
docker-compose up -d db redis
|
319 |
+
sleep 10s
|
320 |
+
docker-compose up -d
|
321 |
+
sleep 5s
|
322 |
+
```
|
323 |
+
|
324 |
+
6. Your instance of Judge0 v1.10.0 is now available at `https://<YOUR DOMAIN>`.
|
325 |
+
|
326 |
+
### With HTTP
|
327 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
328 |
+
2. Download and extract release archive:
|
329 |
+
```
|
330 |
+
wget https://github.com/judge0/api/releases/download/v1.10.0/judge0-v1.10.0.zip
|
331 |
+
unzip judge0-v1.10.0.zip
|
332 |
+
```
|
333 |
+
|
334 |
+
3. Run all services and wait few seconds until everything is initialized:
|
335 |
+
```
|
336 |
+
cd judge0-v1.10.0
|
337 |
+
docker-compose up -d db redis
|
338 |
+
sleep 10s
|
339 |
+
docker-compose up -d
|
340 |
+
sleep 5s
|
341 |
+
```
|
342 |
+
|
343 |
+
4. Your instance of Judge0 v1.10.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
344 |
+
|
345 |
+
|
346 |
+
# v1.9.0 (2020-06-10)
|
347 |
+
Huge thanks to [**Filtered**](https://www.filtered.ai) for sponsoring this release.
|
348 |
+
|
349 |
+
## New Features
|
350 |
+
- Added support for configuration variable `RAILS_SERVER_PROCESSES` which allows to create multiple processes for handling requests.
|
351 |
+
|
352 |
+
## Other Changes
|
353 |
+
- Updated gems.
|
354 |
+
|
355 |
+
## Deployment Procedure
|
356 |
+
Judge0 is collecting telemetry data to help understand how to improve the product and to better understand how Judge0 is used in various production environments. Read more about telemetry [here](https://github.com/judge0/api/blob/v1.9.0/TELEMETRY.md).
|
357 |
+
|
358 |
+
### With HTTPS (SSL/TLS)
|
359 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
360 |
+
2. Download and extract release archive:
|
361 |
+
```
|
362 |
+
wget https://github.com/judge0/api/releases/download/v1.9.0/judge0-v1.9.0-https.zip
|
363 |
+
unzip judge0-v1.9.0-https.zip
|
364 |
+
```
|
365 |
+
|
366 |
+
3. Change directory to `judge0-v1.9.0-https`:
|
367 |
+
```
|
368 |
+
cd judge0-v1.9.0-https
|
369 |
+
```
|
370 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
371 |
+
5. Run all services and wait few seconds until everything is initialized:
|
372 |
+
```
|
373 |
+
docker-compose up -d db redis
|
374 |
+
sleep 10s
|
375 |
+
docker-compose up -d
|
376 |
+
sleep 5s
|
377 |
+
```
|
378 |
+
|
379 |
+
6. Your instance of Judge0 v1.9.0 is now available at `https://<YOUR DOMAIN>`.
|
380 |
+
|
381 |
+
### With HTTP
|
382 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
383 |
+
2. Download and extract release archive:
|
384 |
+
```
|
385 |
+
wget https://github.com/judge0/api/releases/download/v1.9.0/judge0-v1.9.0.zip
|
386 |
+
unzip judge0-v1.9.0.zip
|
387 |
+
```
|
388 |
+
|
389 |
+
3. Run all services and wait few seconds until everything is initialized:
|
390 |
+
```
|
391 |
+
cd judge0-v1.9.0
|
392 |
+
docker-compose up -d db redis
|
393 |
+
sleep 10s
|
394 |
+
docker-compose up -d
|
395 |
+
sleep 5s
|
396 |
+
```
|
397 |
+
|
398 |
+
4. Your instance of Judge0 v1.9.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
399 |
+
|
400 |
+
|
401 |
+
# v1.8.0 (2020-05-28)
|
402 |
+
Huge thanks to [**Filtered**](https://www.filtered.ai) for sponsoring this release.
|
403 |
+
|
404 |
+
## New Features
|
405 |
+
- Added **4 new languages**, and in total there are now **46 active languages**.
|
406 |
+
|
407 |
+
|ID|Name|Note|
|
408 |
+
|---|---|---|
|
409 |
+
|85|Perl (5.28.1)|Sponsored by [Filtered](https://www.filtered.ai).|
|
410 |
+
|86|Clojure (1.10.1)|Sponsored by [Filtered](https://www.filtered.ai).|
|
411 |
+
|87|F# (.NET Core SDK 3.1.202)|Sponsored by [Filtered](https://www.filtered.ai).|
|
412 |
+
|88|Groovy (3.0.3)|Sponsored by [Filtered](https://www.filtered.ai).|
|
413 |
+
|
414 |
+
## Bug Fixes
|
415 |
+
- Fixed `/statistics` route caching.
|
416 |
+
- Issues: [#184](https://github.com/judge0/api/issues/184)
|
417 |
+
- Commits: [@83c5cfc6](https://github.com/judge0/api/commit/83c5cfc6b4ae95fa8bdef0bba2eee98829207dd0)
|
418 |
+
|
419 |
+
## Other Changes
|
420 |
+
- Updated gems.
|
421 |
+
- Commits: [@0c766273](https://github.com/judge0/api/commit/0c766273d7cb8009695a3aa1903719c8474a233d) [@700e6582](https://github.com/judge0/api/commit/700e65829910ee860ddfa43254847f564c0d5623)
|
422 |
+
- Increased default `CPU_TIME_LIMIT` to 5, `CPU_EXTRA_TIME` to 1, `MAX_CPU_EXTRA_TIME` to 5 and `WALL_TIME_LIMIT` to 10 seconds.
|
423 |
+
- Commits: [@77961ab9](https://github.com/judge0/api/commit/77961ab9f6b1015d5bdb5150e29d8de06478f38c)
|
424 |
+
- Changed `HOME` environment variable value for sandbox to `/tmp`.
|
425 |
+
- Commits: [@77961ab9](https://github.com/judge0/api/commit/77961ab9f6b1015d5bdb5150e29d8de06478f38c)
|
426 |
+
- Updated *isolate* to [@9be3ff6f](https://github.com/judge0/isolate/commit/9be3ff6ff0670763e564912a6662730e55b69536).
|
427 |
+
|
428 |
+
## Deployment Procedure
|
429 |
+
Judge0 API is collecting telemetry data to help understand how to improve the product and to better understand how the Judge0 API is used in various production environments. Read more about telemetry [here](https://github.com/judge0/api/blob/v1.8.0/TELEMETRY.md).
|
430 |
+
|
431 |
+
### With HTTPS (SSL/TLS)
|
432 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
433 |
+
2. Download and extract release archive:
|
434 |
+
```
|
435 |
+
wget https://github.com/judge0/api/releases/download/v1.8.0/judge0-api-v1.8.0-https.zip
|
436 |
+
unzip judge0-api-v1.8.0-https.zip
|
437 |
+
```
|
438 |
+
|
439 |
+
3. Change directory to `judge0-api-v1.8.0-https`:
|
440 |
+
```
|
441 |
+
cd judge0-api-v1.8.0-https
|
442 |
+
```
|
443 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
444 |
+
5. Run all services and wait few seconds until everything is initialized:
|
445 |
+
```
|
446 |
+
docker-compose up -d db redis
|
447 |
+
sleep 10s
|
448 |
+
docker-compose up -d
|
449 |
+
sleep 5s
|
450 |
+
```
|
451 |
+
|
452 |
+
6. Your instance of Judge0 API v1.8.0 is now available at `https://<YOUR DOMAIN>`.
|
453 |
+
|
454 |
+
### With HTTP
|
455 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
456 |
+
2. Download and extract release archive:
|
457 |
+
```
|
458 |
+
wget https://github.com/judge0/api/releases/download/v1.8.0/judge0-api-v1.8.0.zip
|
459 |
+
unzip judge0-api-v1.8.0.zip
|
460 |
+
```
|
461 |
+
|
462 |
+
3. Run all services and wait few seconds until everything is initialized:
|
463 |
+
```
|
464 |
+
cd judge0-api-v1.8.0
|
465 |
+
docker-compose up -d db redis
|
466 |
+
sleep 10s
|
467 |
+
docker-compose up -d
|
468 |
+
sleep 5s
|
469 |
+
```
|
470 |
+
|
471 |
+
4. Your instance of Judge0 API v1.8.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
472 |
+
|
473 |
+
|
474 |
+
# v1.7.1 (2020-05-06)
|
475 |
+
## Bug Fixes
|
476 |
+
- Compile Swift before executing since default file size limit of 1MB for execution is not enough for Swift to run successfully. Compilation has a file size limit of 4MB by default which seems to be enough for Swift to compile. Thanks @OliverwengFiltered.
|
477 |
+
- Issues: [#154](https://github.com/judge0/api/issues/154)
|
478 |
+
- Commits: [@371e2463](https://github.com/judge0/api/commit/371e246312a41242033d916f1f4fea3db80015b7)
|
479 |
+
- Fixed environment loading for Telemetry Client.
|
480 |
+
- Commits: [@bd16119c](https://github.com/judge0/api/commit/bd16119ccde52798b5d354afdd5e008df6d5b940)
|
481 |
+
|
482 |
+
## Other Changes
|
483 |
+
- Set `VIRTUAL_HOST` environment variable in Dockerfile to value `3000`.
|
484 |
+
- Updated Telemetry Client to version `c62fa63d`.
|
485 |
+
- Added separated Docker Compose files for server and workers.
|
486 |
+
- Renamed service `worker` to `workers` and `api` to `server`.
|
487 |
+
|
488 |
+
## Deployment Procedure
|
489 |
+
Judge0 API is collecting telemetry data to help understand how to improve the product and to better understand how the Judge0 API is used in various production environments. Read more about telemetry [here](https://github.com/judge0/api/blob/v1.7.1/TELEMETRY.md).
|
490 |
+
|
491 |
+
### With HTTPS (SSL/TLS)
|
492 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
493 |
+
2. Download and extract release archive:
|
494 |
+
```
|
495 |
+
wget https://github.com/judge0/api/releases/download/v1.7.1/judge0-api-v1.7.1-https.zip
|
496 |
+
unzip judge0-api-v1.7.1-https.zip
|
497 |
+
```
|
498 |
+
|
499 |
+
3. Change directory to `judge0-api-v1.7.1-https`:
|
500 |
+
```
|
501 |
+
cd judge0-api-v1.7.1-https
|
502 |
+
```
|
503 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
504 |
+
5. Run all services and wait few seconds until everything is initialized:
|
505 |
+
```
|
506 |
+
docker-compose up -d db redis
|
507 |
+
sleep 10s
|
508 |
+
docker-compose up -d
|
509 |
+
sleep 5s
|
510 |
+
```
|
511 |
+
|
512 |
+
6. Your instance of Judge0 API v1.7.1 is now available at `https://<YOUR DOMAIN>`.
|
513 |
+
|
514 |
+
### With HTTP
|
515 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
516 |
+
2. Download and extract release archive:
|
517 |
+
```
|
518 |
+
wget https://github.com/judge0/api/releases/download/v1.7.1/judge0-api-v1.7.1.zip
|
519 |
+
unzip judge0-api-v1.7.1.zip
|
520 |
+
```
|
521 |
+
|
522 |
+
3. Run all services and wait few seconds until everything is initialized:
|
523 |
+
```
|
524 |
+
cd judge0-api-v1.7.1
|
525 |
+
docker-compose up -d db redis
|
526 |
+
sleep 10s
|
527 |
+
docker-compose up -d
|
528 |
+
sleep 5s
|
529 |
+
```
|
530 |
+
|
531 |
+
4. Your instance of Judge0 API v1.7.1 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
532 |
+
|
533 |
+
|
534 |
+
# v1.7.0 (2020-05-05)
|
535 |
+
Huge thanks to sponsors of this release: [**Filtered**](https://www.filtered.ai) and [**Evalart**](https://evalart.com).
|
536 |
+
|
537 |
+
## New Features
|
538 |
+
- Added **10 new languages**, and in total there are now **42 active languages**.
|
539 |
+
|
540 |
+
|ID|Name|Note|
|
541 |
+
|---|---|---|
|
542 |
+
|75|C (Clang 7.0.1)||
|
543 |
+
|76|C++ (Clang 7.0.1)||
|
544 |
+
|77|COBOL (GnuCOBOL 2.2)|Sponsored by [Evalart](https://evalart.com).|
|
545 |
+
|78|Kotlin (1.3.70)|Sponsored by [Filtered](https://www.filtered.ai).|
|
546 |
+
|79|Objective-C (Clang 7.0.1)|Sponsored by [Filtered](https://www.filtered.ai) and [Evalart](https://evalart.com).|
|
547 |
+
|80|R (4.0.0)|Sponsored by [Filtered](https://www.filtered.ai).|
|
548 |
+
|81|Scala (2.13.2)|Sponsored by [Filtered](https://www.filtered.ai).|
|
549 |
+
|82|SQL (SQLite 3.27.2)|Sponsored by [Filtered](https://www.filtered.ai). (*)|
|
550 |
+
|83|Swift (5.2.3)|Sponsored by [Filtered](https://www.filtered.ai) and [Evalart](https://evalart.com).|
|
551 |
+
|84|Visual Basic.Net (vbnc 0.0.0.5943)|Sponsored by [Filtered](https://www.filtered.ai).|
|
552 |
+
|
553 |
+
(*) Watch [this asciicast](https://asciinema.org/a/326975) to learn how to use this language.
|
554 |
+
|
555 |
+
## Other Changes
|
556 |
+
- Increased default `MAX_MEMORY_LIMIT` to 512000.
|
557 |
+
- Commits: [@3dcbfc96](https://github.com/judge0/api/commit/3dcbfc9605a0f81680afd890a239ef2b60739186)
|
558 |
+
- Set compile CPU time limit to `MAX_CPU_TIME_LIMIT`.
|
559 |
+
- Commits: [@3dcbfc96](https://github.com/judge0/api/commit/3dcbfc9605a0f81680afd890a239ef2b60739186)
|
560 |
+
- Set compile wall time limit to `MAX_WALL_TIME_LIMIT`.
|
561 |
+
- Commits: [@3dcbfc96](https://github.com/judge0/api/commit/3dcbfc9605a0f81680afd890a239ef2b60739186)
|
562 |
+
- Redirect input from `/dev/null` when compiling. Thank you @gollux for your [help](https://github.com/ioi/isolate/issues/90).
|
563 |
+
- Commits: [@42b89a7c](https://github.com/judge0/api/commit/42b89a7cdb333253460023fa7bcbf1640329d48b)
|
564 |
+
|
565 |
+
## Deployment Procedure
|
566 |
+
### With HTTPS (SSL/TLS)
|
567 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
568 |
+
2. Download and extract release archive:
|
569 |
+
```
|
570 |
+
wget https://github.com/judge0/api/releases/download/v1.7.0/judge0-api-v1.7.0-https.zip
|
571 |
+
unzip judge0-api-v1.7.0-https.zip
|
572 |
+
```
|
573 |
+
|
574 |
+
3. Change directory to `judge0-api-v1.7.0-https`:
|
575 |
+
```
|
576 |
+
cd judge0-api-v1.7.0-https
|
577 |
+
```
|
578 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
579 |
+
5. Run all services and wait few seconds until everything is initialized:
|
580 |
+
```
|
581 |
+
docker-compose up -d db redis
|
582 |
+
sleep 10s
|
583 |
+
docker-compose up -d
|
584 |
+
sleep 5s
|
585 |
+
```
|
586 |
+
|
587 |
+
6. Your instance of Judge0 API v1.7.0 is now available at `https://<YOUR DOMAIN>`.
|
588 |
+
|
589 |
+
### With HTTP
|
590 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
591 |
+
2. Download and extract release archive:
|
592 |
+
```
|
593 |
+
wget https://github.com/judge0/api/releases/download/v1.7.0/judge0-api-v1.7.0.zip
|
594 |
+
unzip judge0-api-v1.7.0.zip
|
595 |
+
```
|
596 |
+
|
597 |
+
3. Run all services and wait few seconds until everything is initialized:
|
598 |
+
```
|
599 |
+
cd judge0-api-v1.7.0
|
600 |
+
docker-compose up -d db redis
|
601 |
+
sleep 10s
|
602 |
+
docker-compose up -d
|
603 |
+
sleep 5s
|
604 |
+
```
|
605 |
+
|
606 |
+
4. Your instance of Judge0 API v1.7.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
607 |
+
|
608 |
+
|
609 |
+
# v1.6.0 (2020-05-01)
|
610 |
+
## New Features
|
611 |
+
- Added support for automatically redirecting stderr to stdout of the running program with the configuration flag `redirect_stderr_to_stdout`. Added configuration variable `REDIRECT_STDERR_TO_STDOUT` that can be used for setting default behaviour for every submission.
|
612 |
+
- Commits: [@8e6617aa](https://github.com/judge0/api/commit/8e6617aae2d4dd9106ab610738dcc5e59633b2f4)
|
613 |
+
- Added configuration variable `DISALLOW_ORIGIN` that can be used for disabling CORS only for specific origins.
|
614 |
+
- Commits: [@f61b5496](https://github.com/judge0/api/commit/f61b54965f12a9ccb0d19d3449bc818b12881127) [@a927c9db](https://github.com/judge0/api/commit/a927c9db0f47aa8bd3d2b7dd1774a829a0cbc6f7)
|
615 |
+
- Added configuration variables `ALLOW_IP` and `DISALLOW_IP` that can be used for allowing/disallowing only specific IP addresses that can use instance of Judge0 API.
|
616 |
+
- Commits: [@4fd0f34b](https://github.com/judge0/api/commit/4fd0f34b8f08fe808dd6b19ca96bac1e15b2a6f3)
|
617 |
+
- Added support for built in maintenance mode that can be enabled with configuration variables `MAINTENANCE_MODE` and `MAINTENANCE_MESSAGE`. In maintenance mode clients cannot create or delete submissions i.e. they cannot create new database changes.
|
618 |
+
- Commits: [@201221e2](https://github.com/judge0/api/commit/201221e22bbe64e960306b2dcf22cc6941892e3f)
|
619 |
+
- Added support for universal field `*` which returns all attributes of a submission.
|
620 |
+
- Commits: [@521cc2e2](https://github.com/judge0/api/commit/521cc2e2e94f1b469c084680020953e76af6e2b9)
|
621 |
+
- Added route `GET /statistics` which returns some basic and useful information about Judge0 API instance. Statistic report is cached for 10 minutes.
|
622 |
+
- Commits: [@a24db632](https://github.com/judge0/api/commit/a24db6326b793e093a64dea877c26402c585c680) [@621c50f1](https://github.com/judge0/api/commit/621c50f1f8056e716ff073a404556e51ab3a34c3) [@eead8067](https://github.com/judge0/api/commit/eead806786fac79e13cee9fca0fe7196f116680b)
|
623 |
+
- Added basic support for callbacks which are called with HTTP verb `PUT`.
|
624 |
+
- Pull Requests: [#98](https://github.com/judge0/api/pull/98)
|
625 |
+
- Issues: [#33](https://github.com/judge0/api/issues/33)
|
626 |
+
- Commits: [@41e846b1](https://github.com/judge0/api/commit/41e846b156bc7c071b9d2827271d87cfaee584f7)
|
627 |
+
- Added support for presetting custom additional files in a sandbox.
|
628 |
+
- Issues: [#32](https://github.com/judge0/api/issues/32) [#88](https://github.com/judge0/api/issues/88)
|
629 |
+
- Commits: [@7829db87](https://github.com/judge0/api/commit/7829db878895acdb3adfa063df03204c87cd1589) [@6d1f4293](https://github.com/judge0/api/commit/6d1f4293000a479a0cae0e9c4dc905652297199b) [@6573c52f](https://github.com/judge0/api/commit/6573c52faccee55e467457ab54742dd189a48a4b)
|
630 |
+
- Added routes `GET /submissions/batch` and `POST /submissions/batch` batch create and show or
|
631 |
+
submissions.
|
632 |
+
- Issues: [#34](https://github.com/judge0/api/issues/34)
|
633 |
+
- Commits: [@6420156b](https://github.com/judge0/api/commit/6420156b0ad6526bed3d638be3e824c996cd33cd) [@87859b58](https://github.com/judge0/api/commit/87859b58e4c348249237f2a7881c1c26dcb5d785) [@595c7e11](https://github.com/judge0/api/commit/595c7e11d6ede28d6bef7b98c2675f29e1ae2a9a) [@04c900c9](https://github.com/judge0/api/commit/04c900c9d9c325720ed5c807b46272a500c22a97) [@cb676d6c](https://github.com/judge0/api/commit/cb676d6c7fe3a6e9144a9246329c6223e48c6511)
|
634 |
+
|
635 |
+
## Improvements
|
636 |
+
- Use Redis queue with name that corresponds with the current Judge0 API version. This allows multiple instances of different versions of Judge0 API to use the same Redis instance.
|
637 |
+
- Commits: [@dd6b62d7](https://github.com/judge0/api/commit/dd6b62d73c6ab0ef028711258e2edb141c1ba81a)
|
638 |
+
- Refactored submission field checking.
|
639 |
+
- Commits: [@9acefdbc](https://github.com/judge0/api/commit/9acefdbc7959ff88770ea186d12a085158bce521)
|
640 |
+
- Refactored setting up of default values.
|
641 |
+
- Commits: [@a14ae5d5](https://github.com/judge0/api/commit/a14ae5d540db75a0ade3a4dbfc12e6120d0c1ee2)
|
642 |
+
|
643 |
+
## Bug Fixes
|
644 |
+
- Fixed a bug that ignored custom setting of configuration variables `enable_per_process_and_thread_time_limit` and `enable_per_process_and_thread_memory_limit`.
|
645 |
+
- Commits: [@a6f693a0](https://github.com/judge0/api/commit/a6f693a0ced221a28a3f4b4815e9d3baf8c2c4c0)
|
646 |
+
- Fixed a bug where cgroups flags for isolate were chosen in the wrong conditions.
|
647 |
+
- Commits: [@4116b9cb](https://github.com/judge0/api/commit/4116b9cb988816cad81f6b5c3265da01a8cec120)
|
648 |
+
- Fixed a bug that caused `Internal Error` because sandbox cleanup failed.
|
649 |
+
- Pull Requests: [#126](https://github.com/judge0/api/pull/126)
|
650 |
+
- Issues: [#123](https://github.com/judge0/api/issues/123) [#143](https://github.com/judge0/api/issues/143)
|
651 |
+
- Commits: [@514aec53](https://github.com/judge0/api/commit/514aec53dca8f1fb9f8f153add05c14d263d6624)
|
652 |
+
- Fixed a bug where low `memory_limit` would cause `Internal Error`. Minimum required value for `memory_limit` is now 2048.
|
653 |
+
- Commits: [@655ccf27](https://github.com/judge0/api/commit/655ccf277aad2c11371ca223c5386380c0bfc4ba)
|
654 |
+
|
655 |
+
## Security Fixes
|
656 |
+
- Fixed a bug that allowed creation of an arbitrary size of the compile output.
|
657 |
+
- Commits: [@5fc7b823](https://github.com/judge0/api/commit/5fc7b823a7bccecb148c57615da0be9d52f1585a)
|
658 |
+
|
659 |
+
## Other Changes
|
660 |
+
- Do not implicitly force wide open CORS settings when in development mode. I.e. variable `ALLOW_ORIGIN` can now also be used in development mode.
|
661 |
+
- Commits: [@a3a24c5c](https://github.com/judge0/api/commit/a3a24c5c6fab31ab845905b7120146b18bfe7dbb)
|
662 |
+
- Removed output of configuration settings when server or worker starts.
|
663 |
+
- Commits: [@7061de7a](https://github.com/judge0/api/commit/7061de7a69ffb07b335e44f7120619558a6cf79d)
|
664 |
+
- Updated all the gems except Rails to the latest versions.
|
665 |
+
- Commits: [@230c7a77](https://github.com/judge0/api/commit/230c7a777edf96d6d8848618c15c239134d1f29b) [@69a9fe11](https://github.com/judge0/api/commit/69a9fe1193fb437e103a56b9691196e3687e5e7e) [@095588e6](https://github.com/judge0/api/commit/095588e6642211a123e5091227271de27fc700d5)
|
666 |
+
- Changed default value of `enable_per_process_and_thread_memory_limit` to `false`.
|
667 |
+
- Commits: [@4116b9cb](https://github.com/judge0/api/commit/4116b9cb988816cad81f6b5c3265da01a8cec120)
|
668 |
+
- Don't show total number of workers in `/workers` that is determined with configuration variable `COUNT` because that number is not relevant.
|
669 |
+
- Commits: [@99939b89](https://github.com/judge0/api/commit/99939b89a58d21fc7c6a43fcec90550f75681e39)
|
670 |
+
- Changed the default port to `80` in Docker Compose file.
|
671 |
+
- Commits: [@6ab67d6b](https://github.com/judge0/api/commit/6ab67d6b1e723ce1e959dd17c899605c340bc6ed)
|
672 |
+
- Limited the log size to 100 MB in Docker Compose file.
|
673 |
+
- Commits: [@435c7d79](https://github.com/judge0/api/commit/435c7d792babfda8564dd432d31d4edc5a694ab9)
|
674 |
+
- Added logging to `run-workers` script.
|
675 |
+
- Commits: [@381265a2](https://github.com/judge0/api/commit/381265a295c130c54d540641ba071a18447d8223)
|
676 |
+
- Updated dummy client default values.
|
677 |
+
- Added Docker Compose file for HTTPS support.
|
678 |
+
- Refactored all development and production scripts from `scripts` directory.
|
679 |
+
- Refactored `judge0-api.conf` file.
|
680 |
+
|
681 |
+
## Deployment Procedure
|
682 |
+
### With HTTPS (SSL/TLS)
|
683 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
684 |
+
2. Download and extract release archive:
|
685 |
+
```
|
686 |
+
wget https://github.com/judge0/api/releases/download/v1.6.0/judge0-api-v1.6.0-https.zip
|
687 |
+
unzip judge0-api-v1.6.0-https.zip
|
688 |
+
```
|
689 |
+
|
690 |
+
3. Change directory to `judge0-api-v1.6.0-https`:
|
691 |
+
```
|
692 |
+
cd judge0-api-v1.6.0-https
|
693 |
+
```
|
694 |
+
4. Edit `docker-compose.yml` and change variables `VIRTUAL_HOST`, `LETSENCRYPT_HOST` and `LETSENCRYPT_EMAIL`.
|
695 |
+
5. Run all services and wait few seconds until everything is initialized:
|
696 |
+
```
|
697 |
+
docker-compose up -d db redis nginx letsencrypt
|
698 |
+
sleep 10s
|
699 |
+
docker-compose up -d
|
700 |
+
sleep 5s
|
701 |
+
```
|
702 |
+
|
703 |
+
6. Your instance of Judge0 API v1.6.0 is now available at `https://<YOUR DOMAIN>`.
|
704 |
+
|
705 |
+
### With HTTP
|
706 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
707 |
+
2. Download and extract release archive:
|
708 |
+
```
|
709 |
+
wget https://github.com/judge0/api/releases/download/v1.6.0/judge0-api-v1.6.0.zip
|
710 |
+
unzip judge0-api-v1.6.0.zip
|
711 |
+
```
|
712 |
+
|
713 |
+
3. Run all services and wait few seconds until everything is initialized:
|
714 |
+
```
|
715 |
+
cd judge0-api-v1.6.0
|
716 |
+
docker-compose up -d db redis
|
717 |
+
sleep 10s
|
718 |
+
docker-compose up -d
|
719 |
+
sleep 5s
|
720 |
+
```
|
721 |
+
|
722 |
+
4. Your instance of Judge0 API v1.6.0 is now available at `http://<IP ADDRESS OF YOUR SERVER>`.
|
723 |
+
|
724 |
+
|
725 |
+
# v1.5.0 (2020-01-01)
|
726 |
+
## New Features
|
727 |
+
- Added **30 new languages**, archived 42 languages and kept active 2 languages from the last release. In total, there are now **32 active languages** that can be used and all are updated to their latest versions as of the date of this release. Archived languages cannot be used anymore. Following table shows a status of every language that API supports.
|
728 |
+
- Issues: [#51](https://github.com/judge0/api/issues/51) [#90](https://github.com/judge0/api/issues/90) [#106](https://github.com/judge0/api/issues/106) [#131](https://github.com/judge0/api/issues/131)
|
729 |
+
- Commits: [@f86a546c](https://github.com/judge0/api/commit/f86a546cb9c90eeaedf08862d2a2a2a76293a87f)
|
730 |
+
|
731 |
+
|ID|Name|Status|
|
732 |
+
|---|---|---|
|
733 |
+
|1|Bash (4.4)|archived|
|
734 |
+
|2|Bash (4.0)|archived|
|
735 |
+
|3|Basic (fbc 1.05.0)|archived|
|
736 |
+
|4|C (gcc 7.2.0)|archived|
|
737 |
+
|5|C (gcc 6.4.0)|archived|
|
738 |
+
|6|C (gcc 6.3.0)|archived|
|
739 |
+
|7|C (gcc 5.4.0)|archived|
|
740 |
+
|8|C (gcc 4.9.4)|archived|
|
741 |
+
|9|C (gcc 4.8.5)|archived|
|
742 |
+
|10|C++ (g++ 7.2.0)|archived|
|
743 |
+
|11|C++ (g++ 6.4.0)|archived|
|
744 |
+
|12|C++ (g++ 6.3.0)|archived|
|
745 |
+
|13|C++ (g++ 5.4.0)|archived|
|
746 |
+
|14|C++ (g++ 4.9.4)|archived|
|
747 |
+
|15|C++ (g++ 4.8.5)|archived|
|
748 |
+
|16|C# (mono 5.4.0.167)|archived|
|
749 |
+
|17|C# (mono 5.2.0.224)|archived|
|
750 |
+
|18|Clojure (1.8.0)|archived|
|
751 |
+
|19|Crystal (0.23.1)|archived|
|
752 |
+
|20|Elixir (1.5.1)|archived|
|
753 |
+
|21|Erlang (OTP 20.0)|archived|
|
754 |
+
|22|Go (1.9)|archived|
|
755 |
+
|23|Haskell (ghc 8.2.1)|archived|
|
756 |
+
|24|Haskell (ghc 8.0.2)|archived|
|
757 |
+
|25|Insect (5.0.0)|archived|
|
758 |
+
|26|Java (OpenJDK 9 with Eclipse OpenJ9)|archived|
|
759 |
+
|27|Java (OpenJDK 8)|archived|
|
760 |
+
|28|Java (OpenJDK 7)|archived|
|
761 |
+
|29|JavaScript (nodejs 8.5.0)|archived|
|
762 |
+
|30|JavaScript (nodejs 7.10.1)|archived|
|
763 |
+
|31|OCaml (4.05.0)|archived|
|
764 |
+
|32|Octave (4.2.0)|archived|
|
765 |
+
|33|Pascal (fpc 3.0.0)|archived|
|
766 |
+
|34|Python (3.6.0)|archived|
|
767 |
+
|35|Python (3.5.3)|archived|
|
768 |
+
|36|Python (2.7.9)|archived|
|
769 |
+
|37|Python (2.6.9)|archived|
|
770 |
+
|38|Ruby (2.4.0)|archived|
|
771 |
+
|39|Ruby (2.3.3)|archived|
|
772 |
+
|40|Ruby (2.2.6)|archived|
|
773 |
+
|41|Ruby (2.1.9)|archived|
|
774 |
+
|42|Rust (1.20.0)|archived|
|
775 |
+
|43|Plain Text|Renamed from `Text (plain text)`.|
|
776 |
+
|44|Executable|Not changed.|
|
777 |
+
|45|Assembly (NASM 2.14.02)|**NEW**|
|
778 |
+
|46|Bash (5.0.0)|**NEW**|
|
779 |
+
|47|Basic (FBC 1.07.1)|**NEW**|
|
780 |
+
|48|C (GCC 7.4.0)|**NEW**|
|
781 |
+
|49|C (GCC 8.3.0)|**NEW**|
|
782 |
+
|50|C (GCC 9.2.0)|**NEW**|
|
783 |
+
|51|C# (Mono 6.6.0.161)|**NEW**|
|
784 |
+
|52|C++ (GCC 7.4.0)|**NEW**|
|
785 |
+
|53|C++ (GCC 8.3.0)|**NEW**|
|
786 |
+
|54|C++ (GCC 9.2.0)|**NEW**|
|
787 |
+
|55|Common Lisp (SBCL 2.0.0)|**NEW**|
|
788 |
+
|56|D (DMD 2.089.1)|**NEW**|
|
789 |
+
|57|Elixir (1.9.4)|**NEW**|
|
790 |
+
|58|Erlang (OTP 22.2)|**NEW**|
|
791 |
+
|59|Fortran (GFortran 9.2.0)|**NEW**|
|
792 |
+
|60|Go (1.13.5)|**NEW**|
|
793 |
+
|61|Haskell (GHC 8.8.1)|**NEW**|
|
794 |
+
|62|Java (OpenJDK 13.0.1)|**NEW**|
|
795 |
+
|63|JavaScript (Node.js 12.14.0)|**NEW**|
|
796 |
+
|64|Lua (5.3.5)|**NEW**|
|
797 |
+
|65|OCaml (4.09.0)|**NEW**|
|
798 |
+
|66|Octave (5.1.0)|**NEW**|
|
799 |
+
|67|Pascal (FPC 3.0.4)|**NEW**|
|
800 |
+
|68|PHP (7.4.1)|**NEW**|
|
801 |
+
|69|Prolog (GNU Prolog 1.4.5)|**NEW**|
|
802 |
+
|70|Python (2.7.17)|**NEW**|
|
803 |
+
|71|Python (3.8.1)|**NEW**|
|
804 |
+
|72|Ruby (2.7.0)|**NEW**|
|
805 |
+
|73|Rust (1.40.0)|**NEW**|
|
806 |
+
|74|TypeScript (3.7.4)|**NEW**|
|
807 |
+
|
808 |
+
- Added route `GET /languages/:id` for getting all attributes of specified language.
|
809 |
+
- Commits: [@2a31e963](https://github.com/judge0/api/commit/2a31e96326651b90b59403d811ae48445fa4202e)
|
810 |
+
- Added route `GET /languages/all` for getting a list of all languages (archived and active).
|
811 |
+
- Commits: [@2a31e963](https://github.com/judge0/api/commit/2a31e96326651b90b59403d811ae48445fa4202e)
|
812 |
+
- Added route `DELETE /submissions/:token` for deleting specified submission. Only authorized requests (users) are allowed to delete a submission.
|
813 |
+
- Commits: [@3365e3c8](https://github.com/judge0/api/commit/3365e3c8da28bd273dbd7a21417e75fe393d83ee)
|
814 |
+
- Added configuration variable `ENABLE_SUBMISSION_DELETE` with default value set to `false`. By default you cannot delete a submission as long as this variable is set to `false`. When set to `true` then only authorized requests (users) can delete specific submission.
|
815 |
+
- Commits: [@79e1de95](https://github.com/judge0/api/commit/79e1de95a4a6d2e022af557b96056b009a90be5e)
|
816 |
+
- Added info routes `GET /about`, `GET /version`, `GET /license` and `GET /isolate`. Last route `GET /isolate` returns result from [`isolate --version`](https://github.com/ioi/isolate) command.
|
817 |
+
- Commits: [@9f5202a5](https://github.com/judge0/api/commit/9f5202a501f8cc2375be68908c6fbd0249ac3dd1)
|
818 |
+
|
819 |
+
## Improvements
|
820 |
+
- Updated base image to `judge0/api-base:1.0.0` which uses [Debian "buster"](https://www.debian.org/releases/buster/) and has installed Ruby 2.7.0.
|
821 |
+
- Issues: [#113](https://github.com/judge0/api/issues/113)
|
822 |
+
- Commits: [@f86a546c](https://github.com/judge0/api/commit/f86a546cb9c90eeaedf08862d2a2a2a76293a87f)
|
823 |
+
- Improved handling of an server error when one or more submission attributes cannot be serialized to JSON without Base64 encoding. User now gets an error with instructions to use `base64_encoded=true` query parameter.
|
824 |
+
- Issues: [#107](https://github.com/judge0/api/issues/107) [#129](https://github.com/judge0/api/issues/129) [#130](https://github.com/judge0/api/issues/130)
|
825 |
+
- Commits: [@cdcaa512](https://github.com/judge0/api/commit/cdcaa5122f96c90c0a9fcd16273a808c0ff06d4e)
|
826 |
+
|
827 |
+
## Bug Fixes
|
828 |
+
- Fixed example in configuration for using `ALLOW_ORIGIN` variable with multiple origins.
|
829 |
+
- Commits: [@21d0202a](https://github.com/judge0/api/commit/21d0202ae16aa2e92853d146ba8fedb0c6bb6ab2)
|
830 |
+
- Fixed a bug where value of `MAX_MAX_PROCESSES_AND_OR_THREADS` was used as default value for `max_processes_and_or_threads` attribute of submission, whereas `MAX_PROCESSES_AND_OR_THREADS` should be used.
|
831 |
+
- Commits: [@563f8ea2](https://github.com/judge0/api/commit/563f8ea264dad9396b4e7743cef187c785cbee67)
|
832 |
+
|
833 |
+
## Other Changes
|
834 |
+
- Increased maximum allowed `compiler_options` and `command_line_arguments` length to 512 characters.
|
835 |
+
- Issues: [#122](https://github.com/judge0/api/issues/122)
|
836 |
+
- Commits: [@3d4df3bf](https://github.com/judge0/api/commit/3d4df3bfe661ddff9ee7e6c015fa4403baf8be85)
|
837 |
+
- Increased default value of `MAX_PROCESSES_AND_OR_THREADS` to 60.
|
838 |
+
- Commits: [@563f8ea2](https://github.com/judge0/api/commit/563f8ea264dad9396b4e7743cef187c785cbee67)
|
839 |
+
- Increased default value of `MAX_MAX_PROCESSES_AND_OR_THREADS` to 120.
|
840 |
+
- Commits: [@563f8ea2](https://github.com/judge0/api/commit/563f8ea264dad9396b4e7743cef187c785cbee67)
|
841 |
+
- Changed default value of `RAILS_ENV` to `production`.
|
842 |
+
- Commits: [@be55ca65](https://github.com/judge0/api/commit/be55ca656b524c5e99e75bd6d6207c4a078f5689)
|
843 |
+
- Changed default value of `INTERVAL` to 0.1.
|
844 |
+
- Commits: [@be55ca65](https://github.com/judge0/api/commit/be55ca656b524c5e99e75bd6d6207c4a078f5689)
|
845 |
+
- Updated year in LICENSE.
|
846 |
+
- Commits: [@679fb2ba](https://github.com/judge0/api/commit/679fb2bad981a22dcaebdd63baff506678b36939)
|
847 |
+
- Added environment variables `JUDGE0_{HOMEPAGE,SOURCE_CODE,MAINTAINER,VERSION}`. Isolate sandbox inherits these variables and they are now available for use in user code.
|
848 |
+
- Commits: [@9f5202a5](https://github.com/judge0/api/commit/9f5202a501f8cc2375be68908c6fbd0249ac3dd1)
|
849 |
+
|
850 |
+
## Deployment Procedure
|
851 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
852 |
+
2. Download and extract release archive:
|
853 |
+
```
|
854 |
+
wget https://github.com/judge0/api/releases/download/v1.5.0/judge0-api-v1.5.0.zip
|
855 |
+
unzip judge0-api-v1.5.0.zip
|
856 |
+
```
|
857 |
+
|
858 |
+
3. Run all services and wait few seconds until everything is initialized:
|
859 |
+
```
|
860 |
+
cd judge0-api-v1.5.0
|
861 |
+
docker-compose up -d db redis
|
862 |
+
sleep 10s
|
863 |
+
docker-compose up -d
|
864 |
+
sleep 5s
|
865 |
+
```
|
866 |
+
|
867 |
+
4. Your instance of Judge0 API v1.5.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
868 |
+
|
869 |
+
|
870 |
+
# v1.4.0 (2019-10-31)
|
871 |
+
## New Features
|
872 |
+
- Added support for `compiler_options` and `command_line_arguments`.
|
873 |
+
- Added configuration variables `ENABLE_COMPILER_OPTIONS`, `ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS` and `ENABLE_COMMAND_LINE_ARGUMENTS` for controlling usage of compiler options and command line arguments.
|
874 |
+
|
875 |
+
## Security Improvements
|
876 |
+
- Run compilation process for compiled languages inside sandbox and use values of *limit configuration variables* for controlling sandbox resources.
|
877 |
+
- Move application location from `/usr/src/api` to `/api` to prevent untrusted code from reading it.
|
878 |
+
- Commits: [@0f1b07fe](https://github.com/judge0/api/commit/0f1b07fe0f75141ec82431ef28ad939d73e418a3)
|
879 |
+
|
880 |
+
## Other Changes
|
881 |
+
- Don't link math library for C language by default. You now need to send `-lm` in `compiler_options`.
|
882 |
+
- Commits: [@619a3bbe](https://github.com/judge0/api/commit/619a3bbed204b22c71e012f0de0faabf6f846d70)
|
883 |
+
|
884 |
+
|
885 |
+
## Deployment Procedure
|
886 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
887 |
+
2. Download and extract release archive:
|
888 |
+
```
|
889 |
+
wget https://github.com/judge0/api/releases/download/v1.4.0/judge0-api-v1.4.0.zip
|
890 |
+
unzip judge0-api-v1.4.0.zip
|
891 |
+
```
|
892 |
+
|
893 |
+
3. Run all services and wait few seconds until everything is initialized:
|
894 |
+
```
|
895 |
+
cd judge0-api-v1.4.0
|
896 |
+
docker-compose up -d
|
897 |
+
sleep 10s
|
898 |
+
```
|
899 |
+
|
900 |
+
4. Your instance of Judge0 API v1.4.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
901 |
+
|
902 |
+
|
903 |
+
# v1.3.1 (2019-09-16)
|
904 |
+
## Improvements
|
905 |
+
- Improved handling exec format error by introducing new status **Exec Format Error**.
|
906 |
+
- Commits: [@93a60115](https://github.com/judge0/api/commit/93a601159187d67d1ca52e8c06ebecd8318ed6c3)
|
907 |
+
|
908 |
+
## Bug Fixes
|
909 |
+
- Fixed bug where execution of Go code with no `main` package would induce `execve("./main"): No such file or directory` because Go compiler wouldn't create `main` binary.
|
910 |
+
- Commits: [@93a60115](https://github.com/judge0/api/commit/93a601159187d67d1ca52e8c06ebecd8318ed6c3)
|
911 |
+
|
912 |
+
## Deployment Procedure
|
913 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
914 |
+
2. Download and extract release archive:
|
915 |
+
```
|
916 |
+
wget https://github.com/judge0/api/releases/download/v1.3.1/judge0-api-v1.3.1.zip
|
917 |
+
unzip judge0-api-v1.3.1.zip
|
918 |
+
```
|
919 |
+
|
920 |
+
3. Run all services and wait few seconds until everything is initialized:
|
921 |
+
```
|
922 |
+
cd judge0-api-v1.3.1
|
923 |
+
docker-compose up -d
|
924 |
+
sleep 10s
|
925 |
+
```
|
926 |
+
|
927 |
+
4. Your instance of Judge0 API v1.3.1 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
928 |
+
|
929 |
+
|
930 |
+
# v1.3.0 (2019-09-15)
|
931 |
+
## New Features
|
932 |
+
- Added `MAX_QUEUE_SIZE` variable that defines a maximum submission queue size. If there is a new submission request and the queue is full, then that submission will be rejected.
|
933 |
+
- Commits: [@a2bcdecb](https://github.com/judge0/api/commit/a2bcdecbb99dbd8d3875e2f95bdf71f12e34f495)
|
934 |
+
|
935 |
+
## Improvements
|
936 |
+
- Improved worker shutdown procedure. Workers are now gracefully shutdown on `docker stop`.
|
937 |
+
- Commits: [@2ae0cd31](https://github.com/judge0/api/commit/2ae0cd31153dca4218638096d390ee6f84896236)
|
938 |
+
|
939 |
+
## Bug Fixes
|
940 |
+
- Fixed a bug where authentication token was auto converted to integer.
|
941 |
+
- Issues: [#101](https://github.com/judge0/api/issues/101)
|
942 |
+
- Commits: [@b92c4970](https://github.com/judge0/api/commit/b92c49705c687e955f91dc6638015f14bbcad97c)
|
943 |
+
|
944 |
+
## Deployment Procedure
|
945 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
946 |
+
2. Download and extract release archive:
|
947 |
+
```
|
948 |
+
wget https://github.com/judge0/api/releases/download/v1.3.0/judge0-api-v1.3.0.zip
|
949 |
+
unzip judge0-api-v1.3.0.zip
|
950 |
+
```
|
951 |
+
|
952 |
+
3. Run all services and wait few seconds until everything is initialized:
|
953 |
+
```
|
954 |
+
cd judge0-api-v1.3.0
|
955 |
+
docker-compose up -d
|
956 |
+
sleep 10s
|
957 |
+
```
|
958 |
+
|
959 |
+
4. Your instance of Judge0 API v1.3.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
960 |
+
|
961 |
+
|
962 |
+
# v1.2.2 (2019-09-07)
|
963 |
+
## Securty Fixes
|
964 |
+
- Fixed a bug that allowed anybody to read `judge0-api.conf` file. This bug was introduced in version [v1.2.1](https://github.com/judge0/api/releases/tag/v1.2.1) when config was mounted into container. With this fix, config is still mounted into container but not in `/usr/src/api` folder but rather in `/`. Root folder is not binded in isolate sandbox, whereas `/usr/src/api` is.
|
965 |
+
- Commits: [@121c8f9d](https://github.com/judge0/api/commit/121c8f9de8d89b45c5fec69266d625b375e3181e)
|
966 |
+
|
967 |
+
## Other Changes
|
968 |
+
- Don't allow execution of scripts in `/usr/src/api` folder.
|
969 |
+
- Commits: [@121c8f9d](https://github.com/judge0/api/commit/121c8f9de8d89b45c5fec69266d625b375e3181e)
|
970 |
+
|
971 |
+
## Deployment Procedure
|
972 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
973 |
+
2. Download and extract release archive:
|
974 |
+
```
|
975 |
+
wget https://github.com/judge0/api/releases/download/v1.2.2/judge0-api-v1.2.2.zip
|
976 |
+
unzip judge0-api-v1.2.2.zip
|
977 |
+
```
|
978 |
+
|
979 |
+
3. Run all services and wait few seconds until everything is initialized:
|
980 |
+
```
|
981 |
+
cd judge0-api-v1.2.2
|
982 |
+
docker-compose up -d
|
983 |
+
sleep 10s
|
984 |
+
```
|
985 |
+
|
986 |
+
4. Your instance of Judge0 API v1.2.2 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
987 |
+
|
988 |
+
|
989 |
+
# v1.2.1 (2019-08-24)
|
990 |
+
## Improvements
|
991 |
+
- Improved config loading. Config can now be changed and reload just with `docker-compose restart` command.
|
992 |
+
- Commits: [@06fc37f1](https://github.com/judge0/api/commit/06fc37f16571840e87c41658807da20a08358926)
|
993 |
+
|
994 |
+
## Bug Fixes
|
995 |
+
- Fixed bug in `run-worker` script that didn't consider `COUNT` config variable.
|
996 |
+
- Issues: [#91](https://github.com/judge0/api/issues/91)
|
997 |
+
- Commits: [@06fc37f1](https://github.com/judge0/api/commit/06fc37f16571840e87c41658807da20a08358926)
|
998 |
+
|
999 |
+
## Deployment Procedure
|
1000 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1001 |
+
2. Download and extract release archive:
|
1002 |
+
```
|
1003 |
+
wget https://github.com/judge0/api/releases/download/v1.2.1/judge0-api-v1.2.1.zip
|
1004 |
+
unzip judge0-api-v1.2.1.zip
|
1005 |
+
```
|
1006 |
+
|
1007 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1008 |
+
```
|
1009 |
+
cd judge0-api-v1.2.1
|
1010 |
+
docker-compose up -d
|
1011 |
+
sleep 10s
|
1012 |
+
```
|
1013 |
+
|
1014 |
+
4. Your instance of Judge0 API v1.2.1 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1015 |
+
|
1016 |
+
|
1017 |
+
# v1.2.0-nim0.20.0 (2019-06-26)
|
1018 |
+
This image contains only [The Nim Programming Language](https://nim-lang.org). Free public instance of this image is available on https://nim.api.judge0.com.
|
1019 |
+
|
1020 |
+
This image was build for the purpose of creating dedicated web playground for this language, and in the future I will add and deploy every new release of it. In the [`nim`](https://github.com/judge0/api-base/tree/nim) branch of Judge0 API Base I will follow and install new releases of Nim, and in the [`nim`](https://github.com/judge0/api/tree/nim) branch of Judge0 API I will maintain a Judge0 API that only has Nim available.
|
1021 |
+
|
1022 |
+
Free playground for the Nim programming language that uses Judge0 API is available at https://nim.ide.judge0.com.
|
1023 |
+
|
1024 |
+
## Deployment Procedure
|
1025 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1026 |
+
2. Download and extract release archive:
|
1027 |
+
```
|
1028 |
+
wget https://github.com/judge0/api/releases/download/v1.2.0-nim0.20.0/judge0-api-v1.2.0-nim0.20.0.zip
|
1029 |
+
unzip judge0-api-v1.2.0-nim0.20.0.zip
|
1030 |
+
```
|
1031 |
+
|
1032 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1033 |
+
```
|
1034 |
+
cd judge0-api-v1.2.0-nim0.20.0
|
1035 |
+
docker-compose up -d
|
1036 |
+
sleep 10s
|
1037 |
+
```
|
1038 |
+
|
1039 |
+
4. Your instance of Judge0 API v1.2.0-nim0.20.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1040 |
+
|
1041 |
+
|
1042 |
+
# v1.2.0-vlang0.1.3 (2019-06-26)
|
1043 |
+
This image contains only [The V Programming Language](https://vlang.io), specifically only V compiler built from commit [@b00a47be](https://github.com/vlang/v/commit/b00a47be66e868b087146feb7999fd72f2af3da0). Free public instance of this image is available on https://vlang.api.judge0.com.
|
1044 |
+
|
1045 |
+
This image was build for the purpose of creating dedicated web playground for this new programming language, and in the future I will add and deploy every new release of it. In the [`vlang`](https://github.com/judge0/api-base/tree/vlang) branch of Judge0 API Base I will follow and install new releases of V, and in the [`vlang`](https://github.com/judge0/api/tree/vlang) branch of Judge0 API I will maintain a Judge0 API that only has V available.
|
1046 |
+
|
1047 |
+
Free playground for the V programming language that uses Judge0 API is available at https://vlang.ide.judge0.com.
|
1048 |
+
|
1049 |
+
## Deployment Procedure
|
1050 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1051 |
+
2. Download and extract release archive:
|
1052 |
+
```
|
1053 |
+
wget https://github.com/judge0/api/releases/download/v1.2.0-vlang0.1.3/judge0-api-v1.2.0-vlang0.1.3.zip
|
1054 |
+
unzip judge0-api-v1.2.0-vlang0.1.3.zip
|
1055 |
+
```
|
1056 |
+
|
1057 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1058 |
+
```
|
1059 |
+
cd judge0-api-v1.2.0-vlang0.1.3
|
1060 |
+
docker-compose up -d
|
1061 |
+
sleep 10s
|
1062 |
+
```
|
1063 |
+
|
1064 |
+
4. Your instance of Judge0 API v1.2.0-vlang0.1.3 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1065 |
+
|
1066 |
+
|
1067 |
+
# v1.2.0 (2019-06-17)
|
1068 |
+
## New Features
|
1069 |
+
- Added new language **Executable** that allows executing custom executable files.
|
1070 |
+
- Commits: [@0ab08351](https://github.com/judge0/api/commit/0ab08351f59ae75d9626b6941be3728b48e835db)
|
1071 |
+
- Added new configuration variables: `REDIS_PASSWORD`, `REDIS_PORT` and `POSTGRES_PORT`.
|
1072 |
+
- Commits: [@962d7d1d](https://github.com/judge0/api/commit/962d7d1dcff051357de492f2d31e996405b1d125)
|
1073 |
+
|
1074 |
+
## Improvements
|
1075 |
+
- Improved `run-server` and `run-worker` scripts.
|
1076 |
+
- Commits: [@e1b3564b](https://github.com/judge0/api/commit/e1b3564b5f262c610c42a45879e313eca93e720f)
|
1077 |
+
|
1078 |
+
## Bug Fixes
|
1079 |
+
- Fixed `/etc/apt/sources.list` that prevented package update.
|
1080 |
+
- Issues: [#84](https://github.com/judge0/api/issues/84)
|
1081 |
+
- Commits: [@7fdca3cf](https://github.com/judge0/api/commit/7fdca3cfa5f3bddefbe2ae1e12a18ba18a7e5f63)
|
1082 |
+
- Fixed cleanup bug that didn't remove sandbox files if `tmp` directory was not empty.
|
1083 |
+
- Commits: [@50ee4dbf](https://github.com/judge0/api/commit/50ee4dbf841bc9d0ce195380aaa1c5ee957ee2b7)
|
1084 |
+
- Fixed another UTF-8 problem with Python that @nguyenvanquan7826 reported.
|
1085 |
+
- Issues: [#69](https://github.com/judge0/api/issues/69)
|
1086 |
+
- Commits: [@64635c98](https://github.com/judge0/api/commit/64635c98f7c0475e33b9b4629a6da8bc20fff60a)
|
1087 |
+
|
1088 |
+
## Other Changes
|
1089 |
+
- Updated some gems that had security issues.
|
1090 |
+
- Pull Requests: [#77](https://github.com/judge0/api/pull/77) [#78](https://github.com/judge0/api/pull/78) [#79](https://github.com/judge0/api/pull/79) [#80](https://github.com/judge0/api/pull/80) [#81](https://github.com/judge0/api/pull/81) [#82](https://github.com/judge0/api/pull/82)
|
1091 |
+
- Commits: [@e1b3564b](https://github.com/judge0/api/commit/e1b3564b5f262c610c42a45879e313eca93e720f)
|
1092 |
+
- Prepared Isolate Job for accepting custom compile flags.
|
1093 |
+
- Commits: [@4f2dde1f](https://github.com/judge0/api/commit/4f2dde1f79e32545da219de5cea7c5aaf25869cb)
|
1094 |
+
|
1095 |
+
## Deployment Procedure
|
1096 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1097 |
+
2. Download and extract release archive:
|
1098 |
+
```
|
1099 |
+
wget https://github.com/judge0/api/releases/download/v1.2.0/judge0-api-v1.2.0.zip
|
1100 |
+
unzip judge0-api-v1.2.0.zip
|
1101 |
+
```
|
1102 |
+
|
1103 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1104 |
+
```
|
1105 |
+
cd judge0-api-v1.2.0
|
1106 |
+
docker-compose up -d
|
1107 |
+
sleep 10s
|
1108 |
+
```
|
1109 |
+
|
1110 |
+
4. Your instance of Judge0 API v1.2.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1111 |
+
|
1112 |
+
|
1113 |
+
# v1.1.5-python3.6.8 (2019-03-08)
|
1114 |
+
On @guvenim [request](https://github.com/judge0/api/issues/67) I have built an Judge0 API image that contains just Python 3.6.8. This release also shows what changes are necessary in [api-base](https://github.com/judge0/api-base/commit/bfde9426e4a3d44098dab2a2d082e02de2bc5be5) and [api](https://github.com/judge0/api/commit/9f9f5cd0577a724d66be934c11d2e57b2b3fc705) when you only want to use languages that you need.
|
1115 |
+
|
1116 |
+
## Deployment Procedure
|
1117 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1118 |
+
2. Download and extract release archive:
|
1119 |
+
```
|
1120 |
+
wget https://github.com/judge0/api/releases/download/v1.1.5-python3.6.8/judge0-api-v1.1.5-python3.6.8.zip
|
1121 |
+
unzip judge0-api-v1.1.5-python3.6.8.zip
|
1122 |
+
```
|
1123 |
+
|
1124 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1125 |
+
```
|
1126 |
+
cd judge0-api-v1.1.5-python3.6.8
|
1127 |
+
docker-compose up -d
|
1128 |
+
sleep 10s
|
1129 |
+
```
|
1130 |
+
|
1131 |
+
4. Your instance of Judge0 API v1.1.5-python3.6.8 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1132 |
+
|
1133 |
+
|
1134 |
+
# v1.1.5 (2019-02-17)
|
1135 |
+
## Bug Fixes
|
1136 |
+
- Fixed problem with assigning compile output to submission when rerunning submission.
|
1137 |
+
- Commits: [@c3cd0232](https://github.com/judge0/api/commit/c3cd023258a4ec48949d4ee2310bc39a2f40cac9)
|
1138 |
+
|
1139 |
+
## Other Changes
|
1140 |
+
- Remove unwanted newlines from compile output.
|
1141 |
+
- Commits: [@c3cd0232](https://github.com/judge0/api/commit/c3cd023258a4ec48949d4ee2310bc39a2f40cac9)
|
1142 |
+
|
1143 |
+
## Deployment Procedure
|
1144 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1145 |
+
2. Download and extract release archive:
|
1146 |
+
```
|
1147 |
+
wget https://github.com/judge0/api/releases/download/v1.1.5/judge0-api-v1.1.5.zip
|
1148 |
+
unzip judge0-api-v1.1.5.zip
|
1149 |
+
```
|
1150 |
+
|
1151 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1152 |
+
```
|
1153 |
+
cd judge0-api-v1.1.5
|
1154 |
+
docker-compose up -d
|
1155 |
+
sleep 10s
|
1156 |
+
```
|
1157 |
+
|
1158 |
+
4. Your instance of Judge0 API v1.1.5 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1159 |
+
|
1160 |
+
|
1161 |
+
# v1.1.4 (2019-02-17)
|
1162 |
+
## Bug Fixes
|
1163 |
+
- Fixed problem with assigning compile output to submission when compile output is not empty.
|
1164 |
+
- Commits: [@22403707](https://github.com/judge0/api/commit/224037078325dfe02f5fbf191a55513582ca84b5)
|
1165 |
+
|
1166 |
+
## Deployment Procedure
|
1167 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1168 |
+
2. Download and extract release archive:
|
1169 |
+
```
|
1170 |
+
wget https://github.com/judge0/api/releases/download/v1.1.4/judge0-api-v1.1.4.zip
|
1171 |
+
unzip judge0-api-v1.1.4.zip
|
1172 |
+
```
|
1173 |
+
|
1174 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1175 |
+
```
|
1176 |
+
cd judge0-api-v1.1.4
|
1177 |
+
docker-compose up -d
|
1178 |
+
sleep 10s
|
1179 |
+
```
|
1180 |
+
|
1181 |
+
4. Your instance of Judge0 API v1.1.4 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1182 |
+
|
1183 |
+
|
1184 |
+
# v1.1.3 (2019-02-15)
|
1185 |
+
## Improvements
|
1186 |
+
- Improved cleanup of sandbox by deleting stdin, stdout, stderr and meta file before running isolate cleanup.
|
1187 |
+
- Commits: [@1dcfaf98](https://github.com/judge0/api/commit/1dcfaf98536fc55fe200c57de10540de64936654)
|
1188 |
+
|
1189 |
+
## Bug Fixes
|
1190 |
+
- Fixed problem with compile output that contained invalid byte sequence in UTF-8.
|
1191 |
+
- Commits: [@37d46b14](https://github.com/judge0/api/commit/37d46b140c75aaafeca35ffc36e53746e0905387)
|
1192 |
+
- Fixed problem with submissions not changing their post-run attributes after rerun if compile error occured.
|
1193 |
+
- Commits: [@37d46b14](https://github.com/judge0/api/commit/37d46b140c75aaafeca35ffc36e53746e0905387)
|
1194 |
+
|
1195 |
+
## Deployment Procedure
|
1196 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1197 |
+
2. Download and extract release archive:
|
1198 |
+
```
|
1199 |
+
wget https://github.com/judge0/api/releases/download/v1.1.3/judge0-api-v1.1.3.zip
|
1200 |
+
unzip judge0-api-v1.1.3.zip
|
1201 |
+
```
|
1202 |
+
|
1203 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1204 |
+
```
|
1205 |
+
cd judge0-api-v1.1.3
|
1206 |
+
docker-compose up -d
|
1207 |
+
sleep 10s
|
1208 |
+
```
|
1209 |
+
|
1210 |
+
4. Your instance of Judge0 API v1.1.3 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1211 |
+
|
1212 |
+
|
1213 |
+
# v1.1.2 (2019-02-15)
|
1214 |
+
## Improvements
|
1215 |
+
- Improved reading from stdin and writing to stdout, stderr and meta. They are now not available in sandbox.
|
1216 |
+
- Commits: [@1f135c1a](https://github.com/judge0/api/commit/1f135c1a53f5039b52de5e9c78764c80a7ed3945) [@350ff3a4](https://github.com/judge0/api/commit/350ff3a4705b6d83ef4f1188de52586cbb87e693)
|
1217 |
+
|
1218 |
+
## Bug Fixes
|
1219 |
+
- Fixed writing of source code and stdin to disc, they are now written as binary files to avoid UTF-8 problems.
|
1220 |
+
- Commits: [@519efbea](https://github.com/judge0/api/commit/519efbea1548f9dab5a95032af2cfa88fc319c65)
|
1221 |
+
- Fixed problem with stripping output that contained invalid byte sequence in UTF-8.
|
1222 |
+
- Commits: [@4c994c67](https://github.com/judge0/api/commit/4c994c67630d6679a636a656ba0041ba6a680219)
|
1223 |
+
|
1224 |
+
## Other Changes
|
1225 |
+
- Use `judge0/api-base:0.3.0` as base image which uses [isolate@18554e83](https://github.com/ioi/isolate/commit/18554e83793508acd1032d0cf4229a332c43085e).
|
1226 |
+
- Commits: [@350ff3a4](https://github.com/judge0/api/commit/350ff3a4705b6d83ef4f1188de52586cbb87e693)
|
1227 |
+
|
1228 |
+
## Deployment Procedure
|
1229 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1230 |
+
2. Download and extract release archive:
|
1231 |
+
```
|
1232 |
+
wget https://github.com/judge0/api/releases/download/v1.1.2/judge0-api-v1.1.2.zip
|
1233 |
+
unzip judge0-api-v1.1.2.zip
|
1234 |
+
```
|
1235 |
+
|
1236 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1237 |
+
```
|
1238 |
+
cd judge0-api-v1.1.2
|
1239 |
+
docker-compose up -d
|
1240 |
+
sleep 10s
|
1241 |
+
```
|
1242 |
+
|
1243 |
+
4. Your instance of Judge0 API v1.1.2 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1244 |
+
|
1245 |
+
|
1246 |
+
# v1.1.1 (2019-02-13)
|
1247 |
+
## Bug Fixes
|
1248 |
+
- Fixed a problem when `strip` method was called on a `nil` class when expected output was `nil`.
|
1249 |
+
- Commits: [@b25153e9](https://github.com/judge0/api/commit/b25153e9450569c995e8f3afe036fed4ad58726c)
|
1250 |
+
|
1251 |
+
## Other Changes
|
1252 |
+
- Don't let worker update submission's `finished_at` attribute if it already exists. This allows Judge0 API administrators to manually rerun submissions from command line and preserve initial timestamps if some unexpected error occured.
|
1253 |
+
- Commits: [@b25153e9](https://github.com/judge0/api/commit/b25153e9450569c995e8f3afe036fed4ad58726c)
|
1254 |
+
|
1255 |
+
## Deployment Procedure
|
1256 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1257 |
+
2. Download and extract release archive:
|
1258 |
+
```
|
1259 |
+
wget https://github.com/judge0/api/releases/download/v1.1.1/judge0-api-v1.1.1.zip
|
1260 |
+
unzip judge0-api-v1.1.1.zip
|
1261 |
+
```
|
1262 |
+
|
1263 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1264 |
+
```
|
1265 |
+
cd judge0-api-v1.1.1
|
1266 |
+
docker-compose up -d
|
1267 |
+
sleep 10s
|
1268 |
+
```
|
1269 |
+
|
1270 |
+
4. Your instance of Judge0 API v1.1.1 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
1271 |
+
|
1272 |
+
|
1273 |
+
# v1.1.0 (2019-02-10)
|
1274 |
+
## New Features
|
1275 |
+
- Added `-lm` compile flag to link with math library when compiling C source code.
|
1276 |
+
- Pull Requests: [#60](https://github.com/judge0/api/pull/60)
|
1277 |
+
- Added fixed time limit of 10 seconds for compilation.
|
1278 |
+
- Issues: [#63](https://github.com/judge0/api/issues/63) [#64](https://github.com/judge0/api/issues/64)
|
1279 |
+
- Commits: [@2f05ce2c](https://github.com/judge0/api/commit/2f05ce2c9305fccaeb0c08e23d645736593d787e)
|
1280 |
+
|
1281 |
+
## Improvements
|
1282 |
+
- Improved procedure of seeding database with languages. Seeding is now idempotent.
|
1283 |
+
- Commits: [@72cff961](https://github.com/judge0/api/commit/72cff9616db20bed128a38111e3c28dbfc75696e)
|
1284 |
+
|
1285 |
+
## Bux Fixes
|
1286 |
+
- Fixed versions of Postgres and Redis in Docker Compose files.
|
1287 |
+
- Issues: [#20](https://github.com/judge0/api/issues/20) [#38](https://github.com/judge0/api/issues/38) [#40](https://github.com/judge0/api/issues/40) [#45](https://github.com/judge0/api/issues/45) [#47](https://github.com/judge0/api/issues/47) [#56](https://github.com/judge0/api/issues/56) [#57](https://github.com/judge0/api/issues/57)
|
1288 |
+
- Commits: [@80a61629](https://github.com/judge0/api/commit/80a61629129af75e1d8a4bb167b349ab34cabfd3) [@90ec40cf](https://github.com/judge0/api/commit/90ec40cf5b4dc2ca6aa4c3af59326d431530cf80)
|
1289 |
+
- Fixed problem with workers stopping when they lost connection with Postgres or Redis.
|
1290 |
+
- Commits: [@eee340b6](https://github.com/judge0/api/commit/eee340b650aeacc7971ce5e73652a7bfa9e243af)
|
1291 |
+
- Fixed problem of storing submission's stdout and stderr that contained invalid byte sequence in UTF-8.
|
1292 |
+
- Commits: [@ff63c1bc](https://github.com/judge0/api/commit/ff63c1bc498a62101d4c074f5aa7b7a971550164)
|
1293 |
+
|
1294 |
+
## Deployment Procedure
|
1295 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1296 |
+
2. Download and extract release archive:
|
1297 |
+
```
|
1298 |
+
wget https://github.com/judge0/api/releases/download/v1.1.0/judge0-api-v1.1.0.zip
|
1299 |
+
unzip judge0-api-v1.1.0.zip
|
1300 |
+
```
|
1301 |
+
|
1302 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1303 |
+
```
|
1304 |
+
cd judge0-api-v1.1.0
|
1305 |
+
docker-compose up -d
|
1306 |
+
sleep 10s
|
1307 |
+
```
|
1308 |
+
|
1309 |
+
|
1310 |
+
# v1.0.0 (2017-10-01)
|
1311 |
+
This is the first production ready release of Judge0 API.
|
1312 |
+
|
1313 |
+
## Deployment Procedure
|
1314 |
+
1. Install [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose).
|
1315 |
+
2. Download and extract release archive:
|
1316 |
+
```
|
1317 |
+
wget https://github.com/judge0/api/releases/download/v1.0.0/judge0-api-v1.0.0.zip
|
1318 |
+
unzip judge0-api-v1.0.0.zip
|
1319 |
+
```
|
1320 |
+
|
1321 |
+
3. Run all services and wait few seconds until everything is initialized:
|
1322 |
+
```
|
1323 |
+
cd judge0-api-v1.0.0
|
1324 |
+
docker-compose up -d
|
1325 |
+
sleep 10s
|
1326 |
+
```
|
1327 |
+
|
1328 |
+
4. Your instance of Judge0 API v1.0.0 is now available at `http://<IP OF YOUR SERVER>:3000`.
|
CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contributor Covenant Code of Conduct
|
2 |
+
|
3 |
+
## Our Pledge
|
4 |
+
|
5 |
+
In the interest of fostering an open and welcoming environment, we as
|
6 |
+
contributors and maintainers pledge to making participation in our project and
|
7 |
+
our community a harassment-free experience for everyone, regardless of age, body
|
8 |
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9 |
+
level of experience, education, socio-economic status, nationality, personal
|
10 |
+
appearance, race, religion, or sexual identity and orientation.
|
11 |
+
|
12 |
+
## Our Standards
|
13 |
+
|
14 |
+
Examples of behavior that contributes to creating a positive environment
|
15 |
+
include:
|
16 |
+
|
17 |
+
* Using welcoming and inclusive language
|
18 |
+
* Being respectful of differing viewpoints and experiences
|
19 |
+
* Gracefully accepting constructive criticism
|
20 |
+
* Focusing on what is best for the community
|
21 |
+
* Showing empathy towards other community members
|
22 |
+
|
23 |
+
Examples of unacceptable behavior by participants include:
|
24 |
+
|
25 |
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26 |
+
advances
|
27 |
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28 |
+
* Public or private harassment
|
29 |
+
* Publishing others' private information, such as a physical or electronic
|
30 |
+
address, without explicit permission
|
31 |
+
* Other conduct which could reasonably be considered inappropriate in a
|
32 |
+
professional setting
|
33 |
+
|
34 |
+
## Our Responsibilities
|
35 |
+
|
36 |
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37 |
+
behavior and are expected to take appropriate and fair corrective action in
|
38 |
+
response to any instances of unacceptable behavior.
|
39 |
+
|
40 |
+
Project maintainers have the right and responsibility to remove, edit, or
|
41 |
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42 |
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43 |
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44 |
+
threatening, offensive, or harmful.
|
45 |
+
|
46 |
+
## Scope
|
47 |
+
|
48 |
+
This Code of Conduct applies both within project spaces and in public spaces
|
49 |
+
when an individual is representing the project or its community. Examples of
|
50 |
+
representing a project or community include using an official project e-mail
|
51 |
+
address, posting via an official social media account, or acting as an appointed
|
52 |
+
representative at an online or offline event. Representation of a project may be
|
53 |
+
further defined and clarified by project maintainers.
|
54 |
+
|
55 |
+
## Enforcement
|
56 |
+
|
57 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58 |
+
reported by contacting the project team at [email protected]. All
|
59 |
+
complaints will be reviewed and investigated and will result in a response that
|
60 |
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61 |
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62 |
+
Further details of specific enforcement policies may be posted separately.
|
63 |
+
|
64 |
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65 |
+
faith may face temporary or permanent repercussions as determined by other
|
66 |
+
members of the project's leadership.
|
67 |
+
|
68 |
+
## Attribution
|
69 |
+
|
70 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71 |
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72 |
+
|
73 |
+
[homepage]: https://www.contributor-covenant.org
|
74 |
+
|
75 |
+
For answers to common questions about this code of conduct, see
|
76 |
+
https://www.contributor-covenant.org/faq
|
Dockerfile
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM judge0/compilers:1.4.0 AS production
|
2 |
+
|
3 |
+
ENV JUDGE0_HOMEPAGE "https://judge0.com"
|
4 |
+
LABEL homepage=$JUDGE0_HOMEPAGE
|
5 |
+
|
6 |
+
ENV JUDGE0_SOURCE_CODE "https://github.com/judge0/judge0"
|
7 |
+
LABEL source_code=$JUDGE0_SOURCE_CODE
|
8 |
+
|
9 |
+
ENV JUDGE0_MAINTAINER "Herman Zvonimir Došilović <[email protected]>"
|
10 |
+
LABEL maintainer=$JUDGE0_MAINTAINER
|
11 |
+
|
12 |
+
ENV PATH "/usr/local/ruby-2.7.0/bin:/opt/.gem/bin:$PATH"
|
13 |
+
ENV GEM_HOME "/opt/.gem/"
|
14 |
+
|
15 |
+
RUN apt-get update && \
|
16 |
+
apt-get install -y --no-install-recommends \
|
17 |
+
cron \
|
18 |
+
libpq-dev \
|
19 |
+
sudo && \
|
20 |
+
rm -rf /var/lib/apt/lists/* && \
|
21 |
+
echo "gem: --no-document" > /root/.gemrc && \
|
22 |
+
gem install bundler:2.1.4 && \
|
23 |
+
npm install -g --unsafe-perm [email protected]
|
24 |
+
|
25 |
+
EXPOSE 2358
|
26 |
+
|
27 |
+
WORKDIR /api
|
28 |
+
|
29 |
+
COPY Gemfile* ./
|
30 |
+
RUN RAILS_ENV=production bundle
|
31 |
+
|
32 |
+
COPY cron /etc/cron.d
|
33 |
+
RUN cat /etc/cron.d/* | crontab -
|
34 |
+
|
35 |
+
COPY . .
|
36 |
+
|
37 |
+
ENTRYPOINT ["/api/docker-entrypoint.sh"]
|
38 |
+
CMD ["/api/scripts/server"]
|
39 |
+
|
40 |
+
RUN useradd -u 1000 -m -r judge0 && \
|
41 |
+
echo "judge0 ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \
|
42 |
+
chown judge0: /api/tmp/
|
43 |
+
|
44 |
+
USER judge0
|
45 |
+
|
46 |
+
ENV JUDGE0_VERSION "1.13.1"
|
47 |
+
LABEL version=$JUDGE0_VERSION
|
48 |
+
|
49 |
+
|
50 |
+
FROM production AS development
|
51 |
+
|
52 |
+
CMD ["sleep", "infinity"]
|
Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
source 'https://rubygems.org'
|
2 |
+
|
3 |
+
gem 'rails', '~> 6.1'
|
4 |
+
gem 'pg', '~> 1.2'
|
5 |
+
|
6 |
+
gem 'active_model_serializers', '~> 0.10'
|
7 |
+
gem 'enumerations', '~> 2.3'
|
8 |
+
gem 'httparty', '~> 0.21'
|
9 |
+
gem 'pry-byebug', '~> 3.9'
|
10 |
+
gem 'pry-rails', '~> 0.3'
|
11 |
+
gem 'puma', '~> 5.6'
|
12 |
+
gem 'rack-cors', '~> 1.1'
|
13 |
+
gem 'redis', '< 4.6'
|
14 |
+
gem 'resque', '~> 2.6'
|
15 |
+
gem 'resque-scheduler', '~> 4.10'
|
16 |
+
gem 'will_paginate', '~> 3.2'
|
17 |
+
|
18 |
+
group :development do
|
19 |
+
gem 'annotate', '~> 3.0'
|
20 |
+
gem 'listen', '~> 3.2'
|
21 |
+
end
|
Gemfile.lock
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GEM
|
2 |
+
remote: https://rubygems.org/
|
3 |
+
specs:
|
4 |
+
actioncable (6.1.7.7)
|
5 |
+
actionpack (= 6.1.7.7)
|
6 |
+
activesupport (= 6.1.7.7)
|
7 |
+
nio4r (~> 2.0)
|
8 |
+
websocket-driver (>= 0.6.1)
|
9 |
+
actionmailbox (6.1.7.7)
|
10 |
+
actionpack (= 6.1.7.7)
|
11 |
+
activejob (= 6.1.7.7)
|
12 |
+
activerecord (= 6.1.7.7)
|
13 |
+
activestorage (= 6.1.7.7)
|
14 |
+
activesupport (= 6.1.7.7)
|
15 |
+
mail (>= 2.7.1)
|
16 |
+
actionmailer (6.1.7.7)
|
17 |
+
actionpack (= 6.1.7.7)
|
18 |
+
actionview (= 6.1.7.7)
|
19 |
+
activejob (= 6.1.7.7)
|
20 |
+
activesupport (= 6.1.7.7)
|
21 |
+
mail (~> 2.5, >= 2.5.4)
|
22 |
+
rails-dom-testing (~> 2.0)
|
23 |
+
actionpack (6.1.7.7)
|
24 |
+
actionview (= 6.1.7.7)
|
25 |
+
activesupport (= 6.1.7.7)
|
26 |
+
rack (~> 2.0, >= 2.0.9)
|
27 |
+
rack-test (>= 0.6.3)
|
28 |
+
rails-dom-testing (~> 2.0)
|
29 |
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
30 |
+
actiontext (6.1.7.7)
|
31 |
+
actionpack (= 6.1.7.7)
|
32 |
+
activerecord (= 6.1.7.7)
|
33 |
+
activestorage (= 6.1.7.7)
|
34 |
+
activesupport (= 6.1.7.7)
|
35 |
+
nokogiri (>= 1.8.5)
|
36 |
+
actionview (6.1.7.7)
|
37 |
+
activesupport (= 6.1.7.7)
|
38 |
+
builder (~> 3.1)
|
39 |
+
erubi (~> 1.4)
|
40 |
+
rails-dom-testing (~> 2.0)
|
41 |
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
42 |
+
active_model_serializers (0.10.13)
|
43 |
+
actionpack (>= 4.1, < 7.1)
|
44 |
+
activemodel (>= 4.1, < 7.1)
|
45 |
+
case_transform (>= 0.2)
|
46 |
+
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
47 |
+
activejob (6.1.7.7)
|
48 |
+
activesupport (= 6.1.7.7)
|
49 |
+
globalid (>= 0.3.6)
|
50 |
+
activemodel (6.1.7.7)
|
51 |
+
activesupport (= 6.1.7.7)
|
52 |
+
activerecord (6.1.7.7)
|
53 |
+
activemodel (= 6.1.7.7)
|
54 |
+
activesupport (= 6.1.7.7)
|
55 |
+
activestorage (6.1.7.7)
|
56 |
+
actionpack (= 6.1.7.7)
|
57 |
+
activejob (= 6.1.7.7)
|
58 |
+
activerecord (= 6.1.7.7)
|
59 |
+
activesupport (= 6.1.7.7)
|
60 |
+
marcel (~> 1.0)
|
61 |
+
mini_mime (>= 1.1.0)
|
62 |
+
activesupport (6.1.7.7)
|
63 |
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64 |
+
i18n (>= 1.6, < 2)
|
65 |
+
minitest (>= 5.1)
|
66 |
+
tzinfo (~> 2.0)
|
67 |
+
zeitwerk (~> 2.3)
|
68 |
+
annotate (3.2.0)
|
69 |
+
activerecord (>= 3.2, < 8.0)
|
70 |
+
rake (>= 10.4, < 14.0)
|
71 |
+
builder (3.2.4)
|
72 |
+
byebug (11.1.3)
|
73 |
+
case_transform (0.2)
|
74 |
+
activesupport
|
75 |
+
coderay (1.1.3)
|
76 |
+
concurrent-ruby (1.2.3)
|
77 |
+
crass (1.0.6)
|
78 |
+
date (3.3.4)
|
79 |
+
enumerations (2.5.3)
|
80 |
+
activerecord
|
81 |
+
activesupport
|
82 |
+
i18n
|
83 |
+
erubi (1.12.0)
|
84 |
+
et-orbi (1.2.7)
|
85 |
+
tzinfo
|
86 |
+
ffi (1.15.5)
|
87 |
+
fugit (1.9.0)
|
88 |
+
et-orbi (~> 1, >= 1.2.7)
|
89 |
+
raabro (~> 1.4)
|
90 |
+
globalid (1.2.1)
|
91 |
+
activesupport (>= 6.1)
|
92 |
+
httparty (0.21.0)
|
93 |
+
mini_mime (>= 1.0.0)
|
94 |
+
multi_xml (>= 0.5.2)
|
95 |
+
i18n (1.14.1)
|
96 |
+
concurrent-ruby (~> 1.0)
|
97 |
+
jsonapi-renderer (0.2.2)
|
98 |
+
listen (3.7.1)
|
99 |
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
100 |
+
rb-inotify (~> 0.9, >= 0.9.10)
|
101 |
+
loofah (2.22.0)
|
102 |
+
crass (~> 1.0.2)
|
103 |
+
nokogiri (>= 1.12.0)
|
104 |
+
mail (2.8.1)
|
105 |
+
mini_mime (>= 0.1.1)
|
106 |
+
net-imap
|
107 |
+
net-pop
|
108 |
+
net-smtp
|
109 |
+
marcel (1.0.2)
|
110 |
+
method_source (1.0.0)
|
111 |
+
mini_mime (1.1.5)
|
112 |
+
mini_portile2 (2.8.5)
|
113 |
+
minitest (5.22.2)
|
114 |
+
mono_logger (1.1.2)
|
115 |
+
multi_json (1.15.0)
|
116 |
+
multi_xml (0.6.0)
|
117 |
+
mustermann (3.0.0)
|
118 |
+
ruby2_keywords (~> 0.0.1)
|
119 |
+
net-imap (0.3.7)
|
120 |
+
date
|
121 |
+
net-protocol
|
122 |
+
net-pop (0.1.2)
|
123 |
+
net-protocol
|
124 |
+
net-protocol (0.2.2)
|
125 |
+
timeout
|
126 |
+
net-smtp (0.4.0.1)
|
127 |
+
net-protocol
|
128 |
+
nio4r (2.7.0)
|
129 |
+
nokogiri (1.14.5)
|
130 |
+
mini_portile2 (~> 2.8.2)
|
131 |
+
racc (~> 1.4)
|
132 |
+
pg (1.3.5)
|
133 |
+
pry (0.13.1)
|
134 |
+
coderay (~> 1.1)
|
135 |
+
method_source (~> 1.0)
|
136 |
+
pry-byebug (3.9.0)
|
137 |
+
byebug (~> 11.0)
|
138 |
+
pry (~> 0.13.0)
|
139 |
+
pry-rails (0.3.9)
|
140 |
+
pry (>= 0.10.4)
|
141 |
+
puma (5.6.8)
|
142 |
+
nio4r (~> 2.0)
|
143 |
+
raabro (1.4.0)
|
144 |
+
racc (1.7.3)
|
145 |
+
rack (2.2.8.1)
|
146 |
+
rack-cors (1.1.1)
|
147 |
+
rack (>= 2.0.0)
|
148 |
+
rack-protection (3.1.0)
|
149 |
+
rack (~> 2.2, >= 2.2.4)
|
150 |
+
rack-test (2.1.0)
|
151 |
+
rack (>= 1.3)
|
152 |
+
rails (6.1.7.7)
|
153 |
+
actioncable (= 6.1.7.7)
|
154 |
+
actionmailbox (= 6.1.7.7)
|
155 |
+
actionmailer (= 6.1.7.7)
|
156 |
+
actionpack (= 6.1.7.7)
|
157 |
+
actiontext (= 6.1.7.7)
|
158 |
+
actionview (= 6.1.7.7)
|
159 |
+
activejob (= 6.1.7.7)
|
160 |
+
activemodel (= 6.1.7.7)
|
161 |
+
activerecord (= 6.1.7.7)
|
162 |
+
activestorage (= 6.1.7.7)
|
163 |
+
activesupport (= 6.1.7.7)
|
164 |
+
bundler (>= 1.15.0)
|
165 |
+
railties (= 6.1.7.7)
|
166 |
+
sprockets-rails (>= 2.0.0)
|
167 |
+
rails-dom-testing (2.2.0)
|
168 |
+
activesupport (>= 5.0.0)
|
169 |
+
minitest
|
170 |
+
nokogiri (>= 1.6)
|
171 |
+
rails-html-sanitizer (1.6.0)
|
172 |
+
loofah (~> 2.21)
|
173 |
+
nokogiri (~> 1.14)
|
174 |
+
railties (6.1.7.7)
|
175 |
+
actionpack (= 6.1.7.7)
|
176 |
+
activesupport (= 6.1.7.7)
|
177 |
+
method_source
|
178 |
+
rake (>= 12.2)
|
179 |
+
thor (~> 1.0)
|
180 |
+
rake (13.1.0)
|
181 |
+
rb-fsevent (0.11.1)
|
182 |
+
rb-inotify (0.10.1)
|
183 |
+
ffi (~> 1.0)
|
184 |
+
redis (4.5.1)
|
185 |
+
redis-namespace (1.11.0)
|
186 |
+
redis (>= 4)
|
187 |
+
resque (2.6.0)
|
188 |
+
mono_logger (~> 1.0)
|
189 |
+
multi_json (~> 1.0)
|
190 |
+
redis-namespace (~> 1.6)
|
191 |
+
sinatra (>= 0.9.2)
|
192 |
+
resque-scheduler (4.10.2)
|
193 |
+
mono_logger (~> 1.0)
|
194 |
+
redis (>= 3.3)
|
195 |
+
resque (>= 1.27)
|
196 |
+
rufus-scheduler (~> 3.2, != 3.3)
|
197 |
+
ruby2_keywords (0.0.5)
|
198 |
+
rufus-scheduler (3.9.1)
|
199 |
+
fugit (~> 1.1, >= 1.1.6)
|
200 |
+
sinatra (3.1.0)
|
201 |
+
mustermann (~> 3.0)
|
202 |
+
rack (~> 2.2, >= 2.2.4)
|
203 |
+
rack-protection (= 3.1.0)
|
204 |
+
tilt (~> 2.0)
|
205 |
+
sprockets (4.2.1)
|
206 |
+
concurrent-ruby (~> 1.0)
|
207 |
+
rack (>= 2.2.4, < 4)
|
208 |
+
sprockets-rails (3.4.2)
|
209 |
+
actionpack (>= 5.2)
|
210 |
+
activesupport (>= 5.2)
|
211 |
+
sprockets (>= 3.0.0)
|
212 |
+
thor (1.3.1)
|
213 |
+
tilt (2.3.0)
|
214 |
+
timeout (0.4.1)
|
215 |
+
tzinfo (2.0.6)
|
216 |
+
concurrent-ruby (~> 1.0)
|
217 |
+
websocket-driver (0.7.6)
|
218 |
+
websocket-extensions (>= 0.1.0)
|
219 |
+
websocket-extensions (0.1.5)
|
220 |
+
will_paginate (3.3.1)
|
221 |
+
zeitwerk (2.6.13)
|
222 |
+
|
223 |
+
PLATFORMS
|
224 |
+
ruby
|
225 |
+
|
226 |
+
DEPENDENCIES
|
227 |
+
active_model_serializers (~> 0.10)
|
228 |
+
annotate (~> 3.0)
|
229 |
+
enumerations (~> 2.3)
|
230 |
+
httparty (~> 0.21)
|
231 |
+
listen (~> 3.2)
|
232 |
+
pg (~> 1.2)
|
233 |
+
pry-byebug (~> 3.9)
|
234 |
+
pry-rails (~> 0.3)
|
235 |
+
puma (~> 5.6)
|
236 |
+
rack-cors (~> 1.1)
|
237 |
+
rails (~> 6.1)
|
238 |
+
redis (< 4.6)
|
239 |
+
resque (~> 2.6)
|
240 |
+
resque-scheduler (~> 4.10)
|
241 |
+
will_paginate (~> 3.2)
|
242 |
+
|
243 |
+
BUNDLED WITH
|
244 |
+
2.1.4
|
LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
Judge0 is a robust and scalable open-source online code execution system.
|
635 |
+
Copyright (C) 2016-2020 Herman Zvonimir Došilović
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
Judge0 Copyright (C) 2016-2020 Herman Zvonimir Došilović
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
PRIVACY_POLICY.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Privacy Policy
|
2 |
+
This document is for those who consume Judge0 and not for those who deploy Judge0 to their own infrastructure.
|
3 |
+
|
4 |
+
If you deploy Judge0 to your own infrastructure then you should read about [telemetry](TELEMETRY.md).
|
5 |
+
|
6 |
+
## Collected Data
|
7 |
+
Judge0 does **not** store any personal information.
|
8 |
+
|
9 |
+
For every submission Judge0 stores the data that has been well documented [here](https://api.judge0.com/#submissions-submission).
|
Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
require_relative 'config/application'
|
2 |
+
require 'resque/tasks'
|
3 |
+
require 'resque/scheduler/tasks'
|
4 |
+
|
5 |
+
task 'resque:setup' => :environment
|
6 |
+
|
7 |
+
Rails.application.load_tasks
|
SECURITY.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Security Policy
|
2 |
+
|
3 |
+
## Supported Versions
|
4 |
+
|
5 |
+
| Version | Supported |
|
6 |
+
| ---------------- | ------------------ |
|
7 |
+
| >= 1.13.0 | :white_check_mark: |
|
8 |
+
| >= 1.13.0-extra | :white_check_mark: |
|
9 |
+
| < 1.13.0 | :x: |
|
10 |
+
| < 1.13.0-extra | :x: |
|
11 |
+
|
12 |
+
## Reporting a Vulnerability
|
13 |
+
|
14 |
+
Please report vulnerability via GitHub or email at [email protected].
|
15 |
+
|
16 |
+
Your reports will be reviewed ASAP, and an update will also be released ASAP.
|
SPONSORSHIP.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Sponsorship
|
2 |
+
Thank you for considering supporting this project and thus [me](https://github.com/hermanzdosilovic) and my work. There are many ways you can support this project and you might have different motivation or reason to do so. Whatever your reason or motivation is, thank you!
|
3 |
+
|
4 |
+
Every donation is valuable and helps me keep this project free and open-source for everybody.
|
5 |
+
|
6 |
+
## Common Support
|
7 |
+
You can support this project by becoming a [Patron](https://www.patreon.com/hermanzdosilovic) or by donating via [PayPal](https://www.patreon.com/hermanzdosilovic) or [Revolut](https://pay.revolut.com/profile/hermancy5).
|
8 |
+
|
9 |
+
This is the simplest yet very welcome and significant way for you to express your appreciation and support the project with your monthly or one-time donation.
|
10 |
+
|
11 |
+
Thank you!
|
12 |
+
|
13 |
+
## Development Sponsorship
|
14 |
+
You can directly sponsor the development of the features, bug fixes or anything that is important to you, your organization or company. For the sake of simplicity in the following text I will just reffer to "features", but remember that it can be anything that you want to see in the project.
|
15 |
+
|
16 |
+
Sponsored features are put on the top of the [priority list](https://github.com/judge0/judge0/projects) for one of the next releases and push the development forward by reducing the release cycles.
|
17 |
+
|
18 |
+
### Sponsorship Protocol
|
19 |
+
The protocol for development sponsorship is described below. Described protocol is based on two assumptions:
|
20 |
+
1. You trust me. I will do the work in the agreed deadline.
|
21 |
+
2. I trust you. You will donate agreed amount after the work is done.
|
22 |
+
|
23 |
+
Moreover, with the following protocol I want to keep everything transparent as possible and in the spirit of the open-source values.
|
24 |
+
|
25 |
+
#### 1. Issue Creation
|
26 |
+
Create a new or choose an existing issue on the [Issues](https://github.com/judge0/judge0/issues) page. It can be anything from feature request, bug fix or documentation update. It can be anything that you would like to see in one of the next releases as soon as possible.
|
27 |
+
|
28 |
+
#### 2. Declare Sponsorship
|
29 |
+
Add a comment that you, your organization or company is willing to sponsor the development of this feature:
|
30 |
+
|
31 |
+
```
|
32 |
+
This feature will be sponsored by [me|ORGANIZATION NAME](URL).
|
33 |
+
```
|
34 |
+
|
35 |
+
It is important to note who is sponsoring the feature because the name of the sponsor (with the given URL) will be written in the release notes.
|
36 |
+
|
37 |
+
If you, however, want to stay anonymous then comment:
|
38 |
+
```
|
39 |
+
This feature will be anonymously sponsored.
|
40 |
+
```
|
41 |
+
|
42 |
+
Even though the feature is anonymously sponsored it will be noted as such in the release notes.
|
43 |
+
|
44 |
+
#### 3. (Optional) Specify Your Deadline
|
45 |
+
If you have a deadline you want me to meet, please specify it. It can be anything from 1 day to 1 year.
|
46 |
+
|
47 |
+
#### 4. Review and Validation
|
48 |
+
I will then review the feature request and iteratate further with you on its specification before we agree on what exactly will be developed.
|
49 |
+
|
50 |
+
This step is important because I want to develop exactly what you are asking for, so we need to be on the same page.
|
51 |
+
|
52 |
+
I have a full right to reject and close the issue at any point if it does not match my vision of the direction in which the project should go.
|
53 |
+
|
54 |
+
#### 5. Deadline and Offer
|
55 |
+
I will then tell you in what release this feature can be included and when it can be released. I will also specify the donation amount required for this feature to be developed and released by specified deadline.
|
56 |
+
|
57 |
+
Note that even one sponsored feature can make me do a new release.
|
58 |
+
|
59 |
+
#### 6. Accept or Reject
|
60 |
+
You can then accept or reject my donation request:
|
61 |
+
```
|
62 |
+
I [accept|reject] your donation request and deadline.
|
63 |
+
```
|
64 |
+
|
65 |
+
Note that if you reject my donation request it doesn't mean that the issue won't be resolved. It just means that it won't be put on the priority list for the next release. It will be treated as any other issue (non sponsored).
|
66 |
+
|
67 |
+
If you accept my donation request I will add a label `sponsored` on the issue and forward it for the next stage on [Projects](https://github.com/judge0/judge0/projects) page.
|
68 |
+
|
69 |
+
#### 7. Development and Testing
|
70 |
+
In the development and testing phase I will sometimes send you links to where you can try the new feature.
|
71 |
+
|
72 |
+
For some issues this might not be necessary.
|
73 |
+
|
74 |
+
#### 8. Release
|
75 |
+
After the development the issue will be closed and the feature will be released in the specified release cycle within agreed deadline.
|
76 |
+
|
77 |
+
After the release I expect you to send the agreed donation amount via [PayPal](https://www.patreon.com/hermanzdosilovic) or [Revolut](https://pay.revolut.com/profile/hermancy5). You can also do this after sixth step.
|
78 |
+
|
79 |
+
### Notes
|
80 |
+
1. Sponsored features **must** stay open-source.
|
81 |
+
2. One feature can be sponsored by many sponsors.
|
82 |
+
3. One sponsor can sponsor many features.
|
83 |
+
|
84 |
+
## Other Types of Sponsorships
|
85 |
+
If you have any other suggestions on how you would like to collaborate or support this project, please send me an [email](https://github.com/hermanzdosilovic) or schedule a [meeting](https://judge0.appointlet.com) with me.
|
TELEMETRY.md
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Telemetry
|
2 |
+
This document is for those who deploy Judge0 to their own infrastructure and not for those who consume Judge0.
|
3 |
+
|
4 |
+
If you just consume Judge0 then you should read the [privacy policy](PRIVACY_POLICY.md).
|
5 |
+
|
6 |
+
## Introduction
|
7 |
+
Since version v1.6.0 Judge0 is collecting telemetry data which is used to help understand how to improve the product and to better understand how Judge0 is used in various production environments.
|
8 |
+
|
9 |
+
Our close-source [telemetry client](bin/telemetry) periodically sends telemetry data to our central telemetry server.
|
10 |
+
|
11 |
+
Telemetry reporting is **enabled** by default.
|
12 |
+
|
13 |
+
This document describes how to disable telemetry reporting and what data is collected.
|
14 |
+
|
15 |
+
## Disabling Telemetry Reporting
|
16 |
+
To disable telemetry reporting set variable `JUDGE0_TELEMETRY_ENABLE` to `false` in [judge0.conf](judge0.conf).
|
17 |
+
|
18 |
+
## Collected Data
|
19 |
+
Every deployed instance of Judge0 with enabled telemetry reporting has its own ID that is used to identify the instance.
|
20 |
+
|
21 |
+
### The Data Telemetry Client Sends
|
22 |
+
Your instance of Judge0 will send the new telemetry report to our central telemetry server every 12 hours. Following data is send in the report:
|
23 |
+
- the ID of your instance and
|
24 |
+
- the version of your Judge0 instance
|
25 |
+
|
26 |
+
### The Data Telemetry Server Stores
|
27 |
+
When the new telemetry report arrives our telemetry server stores the following data:
|
28 |
+
- all the data that telemetry clients sends and
|
29 |
+
- timestamp when the report was send
|
30 |
+
|
31 |
+
IP address of your instance is **not** sent or stored.
|
32 |
+
|
33 |
+
Note that only the last report is stored on telemetry server, i.e. the new report overwrites the last report.
|
34 |
+
|
35 |
+
## Other Notes and Information
|
36 |
+
1. You can disable telemetry reporting at any time but the data from the last report stays stored on the telemetry server.
|
agricius
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
#
|
3 |
+
# Agricius - build tool for Judge0.
|
4 |
+
#
|
5 |
+
# Named after Saint Agricius of Trier - protector of carpenters, builders, confectioners, blacksmiths, tailors and butchers.
|
6 |
+
|
7 |
+
_err() {
|
8 |
+
echo >&2 "Error: $*"
|
9 |
+
}
|
10 |
+
|
11 |
+
_die() {
|
12 |
+
_err "$*"
|
13 |
+
exit 1
|
14 |
+
}
|
15 |
+
|
16 |
+
__get_argument() {
|
17 |
+
if [[ -n "$2" ]] && [[ ${2:0:1} != "-" ]]; then
|
18 |
+
echo "$2"
|
19 |
+
else
|
20 |
+
_err "Argument for $1 is missing."
|
21 |
+
fi
|
22 |
+
}
|
23 |
+
|
24 |
+
_positional_params=""
|
25 |
+
while [[ $# -gt 0 ]]; do
|
26 |
+
case "$1" in
|
27 |
+
--cache-from)
|
28 |
+
_cache="$(__get_argument $1 $2)"; [[ "$_cache" == "" ]] && exit 1
|
29 |
+
shift 2
|
30 |
+
;;
|
31 |
+
-*|--*)
|
32 |
+
_die "Unknown option $1.
|
33 |
+
Usage: $0 [--cache-from image] command
|
34 |
+
|
35 |
+
Available commands:
|
36 |
+
build Build Docker images.
|
37 |
+
publish Push Docker images to repository. Implies build."
|
38 |
+
;;
|
39 |
+
*)
|
40 |
+
_positional_params="$_positional_params $1"
|
41 |
+
shift
|
42 |
+
;;
|
43 |
+
esac
|
44 |
+
done
|
45 |
+
eval set -- "$_positional_params"
|
46 |
+
|
47 |
+
if [[ "$_cache" != "" ]]; then
|
48 |
+
docker pull $_cache
|
49 |
+
_cache="--cache-from $_cache"
|
50 |
+
fi
|
51 |
+
|
52 |
+
JUDGE0_DOCKER_REPOSITORY=judge0/judge0
|
53 |
+
|
54 |
+
JUDGE0_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
55 |
+
JUDGE0_COMMIT="$(git log -1 --format=%h --abbrev=8)"
|
56 |
+
JUDGE0_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
57 |
+
|
58 |
+
JUDGE0_EDITION="$JUDGE0_BRANCH"
|
59 |
+
if [[ "$JUDGE0_BRANCH" == "master" ]]; then
|
60 |
+
JUDGE0_EDITION="standard"
|
61 |
+
fi
|
62 |
+
|
63 |
+
JUDGE0_EDITION_SLUG="-$JUDGE0_EDITION"
|
64 |
+
if [[ "$JUDGE0_EDITION" == "standard" ]]; then
|
65 |
+
JUDGE0_EDITION_SLUG=""
|
66 |
+
fi
|
67 |
+
|
68 |
+
JUDGE0_VERSION_TAG="$(git tag --points-at HEAD)"
|
69 |
+
JUDGE0_VERSION="${JUDGE0_VERSION_TAG:1}" # Remove the "v" the beginning.
|
70 |
+
JUDGE0_VERSION="${JUDGE0_VERSION%-*}" # Remove everything else after "-".
|
71 |
+
|
72 |
+
JUDGE0_PRODUCTION_IMAGES="$JUDGE0_DOCKER_REPOSITORY:$JUDGE0_COMMIT$JUDGE0_EDITION_SLUG"
|
73 |
+
if [[ "$JUDGE0_VERSION" != "" ]]; then
|
74 |
+
JUDGE0_PRODUCTION_IMAGES="$JUDGE0_PRODUCTION_IMAGES $JUDGE0_DOCKER_REPOSITORY:latest$JUDGE0_EDITION_SLUG"
|
75 |
+
JUDGE0_PRODUCTION_IMAGES="$JUDGE0_PRODUCTION_IMAGES $JUDGE0_DOCKER_REPOSITORY:$JUDGE0_VERSION$JUDGE0_EDITION_SLUG"
|
76 |
+
fi
|
77 |
+
|
78 |
+
JUDGE0_DEVELOPMENT_IMAGES="$JUDGE0_DOCKER_REPOSITORY:$JUDGE0_COMMIT-dev$JUDGE0_EDITION_SLUG"
|
79 |
+
if [[ "$JUDGE0_VERSION" != "" ]]; then
|
80 |
+
JUDGE0_DEVELOPMENT_IMAGES="$JUDGE0_DEVELOPMENT_IMAGES $JUDGE0_DOCKER_REPOSITORY:latest$JUDGE0_EDITION_SLUG-dev"
|
81 |
+
JUDGE0_DEVELOPMENT_IMAGES="$JUDGE0_DEVELOPMENT_IMAGES $JUDGE0_DOCKER_REPOSITORY:$JUDGE0_VERSION$JUDGE0_EDITION_SLUG-dev"
|
82 |
+
fi
|
83 |
+
|
84 |
+
env | grep JUDGE0_ | sort
|
85 |
+
|
86 |
+
pushd "$JUDGE0_PROJECT_ROOT"
|
87 |
+
|
88 |
+
function build_and_tag() {
|
89 |
+
local _target=$1
|
90 |
+
local _images=($2)
|
91 |
+
local _main_image=${_images[0]}
|
92 |
+
|
93 |
+
set -xe
|
94 |
+
docker build -t $_main_image $_cache --target $_target .
|
95 |
+
set +xe
|
96 |
+
|
97 |
+
for (( i=0; i<${#_images[@]}; i++ )) do
|
98 |
+
docker tag $_main_image ${_images[i]}
|
99 |
+
done
|
100 |
+
}
|
101 |
+
build_and_tag production "$JUDGE0_PRODUCTION_IMAGES"
|
102 |
+
build_and_tag development "$JUDGE0_DEVELOPMENT_IMAGES"
|
103 |
+
|
104 |
+
_command="$1"
|
105 |
+
if [[ "$_command" == "publish" ]]; then
|
106 |
+
if [[ "$JUDGE0_VERSION" == "" ]]; then
|
107 |
+
_die "Cannot publish untagged version."
|
108 |
+
fi
|
109 |
+
_push_images() {
|
110 |
+
local _images=($1)
|
111 |
+
for (( i=1; i<${#_images[@]}; i++ )) do
|
112 |
+
docker push ${_images[i]}
|
113 |
+
done
|
114 |
+
}
|
115 |
+
_push_images "$JUDGE0_PRODUCTION_IMAGES"
|
116 |
+
_push_images "$JUDGE0_DEVELOPMENT_IMAGES"
|
117 |
+
fi
|
118 |
+
|
119 |
+
_untag() {
|
120 |
+
local _images=($1)
|
121 |
+
for (( i=0; i<${#_images[@]}-1; i++ )) do
|
122 |
+
docker rmi ${_images[i]}
|
123 |
+
done
|
124 |
+
}
|
125 |
+
_untag "$JUDGE0_PRODUCTION_IMAGES"
|
126 |
+
_untag "$JUDGE0_DEVELOPMENT_IMAGES"
|
127 |
+
|
128 |
+
popd
|
app/channels/application_cable/channel.rb
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module ApplicationCable
|
2 |
+
class Channel < ActionCable::Channel::Base
|
3 |
+
end
|
4 |
+
end
|
app/channels/application_cable/connection.rb
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module ApplicationCable
|
2 |
+
class Connection < ActionCable::Connection::Base
|
3 |
+
end
|
4 |
+
end
|
app/controllers/application_controller.rb
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class ApplicationController < SessionsController
|
2 |
+
private
|
3 |
+
|
4 |
+
def pagination_dict(collection)
|
5 |
+
{
|
6 |
+
current_page: collection.current_page,
|
7 |
+
next_page: collection.next_page,
|
8 |
+
prev_page: collection.previous_page,
|
9 |
+
total_pages: collection.total_pages,
|
10 |
+
total_count: collection.total_entries
|
11 |
+
}
|
12 |
+
end
|
13 |
+
end
|
app/controllers/concerns/.keep
ADDED
File without changes
|
app/controllers/health_controller.rb
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class HealthController < ApplicationController
|
2 |
+
def workers
|
3 |
+
Resque.workers.first.try(:prune_dead_workers) if params[:prune_dead_workers] == "true"
|
4 |
+
|
5 |
+
queues = Hash.new { |h, k| h[k] = [] }
|
6 |
+
Resque.workers.each do |worker|
|
7 |
+
worker.queues.each do |queue|
|
8 |
+
queues[queue] << worker
|
9 |
+
end
|
10 |
+
end
|
11 |
+
|
12 |
+
json = []
|
13 |
+
Resque.queues.each do |queue|
|
14 |
+
workers = queues[queue]
|
15 |
+
json << {
|
16 |
+
queue: queue,
|
17 |
+
size: Resque.size(queue),
|
18 |
+
available: workers.count,
|
19 |
+
idle: workers.count { |w| w.idle? },
|
20 |
+
working: workers.count { |w| w.working? },
|
21 |
+
paused: workers.count { |w| w.paused? }
|
22 |
+
}
|
23 |
+
end
|
24 |
+
|
25 |
+
render json: json
|
26 |
+
end
|
27 |
+
end
|
app/controllers/home_controller.rb
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class HomeController < ActionController::API
|
2 |
+
include ActionView::Layouts
|
3 |
+
|
4 |
+
def index
|
5 |
+
if Config::USE_DOCS_AS_HOMEPAGE
|
6 |
+
render file: Rails.root.join('public/docs.html')
|
7 |
+
else
|
8 |
+
head :ok
|
9 |
+
end
|
10 |
+
end
|
11 |
+
end
|
app/controllers/info_controller.rb
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class InfoController < ApplicationController
|
2 |
+
@@license ||= File.read("LICENSE")
|
3 |
+
@@isolate ||= `isolate --version`
|
4 |
+
|
5 |
+
def system_info
|
6 |
+
render json: SystemInfo.sys_info
|
7 |
+
end
|
8 |
+
|
9 |
+
def config_info
|
10 |
+
render json: Config.config_info
|
11 |
+
end
|
12 |
+
|
13 |
+
def about
|
14 |
+
render json: {
|
15 |
+
version: ENV["JUDGE0_VERSION"],
|
16 |
+
homepage: ENV["JUDGE0_HOMEPAGE"],
|
17 |
+
source_code: ENV["JUDGE0_SOURCE_CODE"],
|
18 |
+
maintainer: ENV["JUDGE0_MAINTAINER"]
|
19 |
+
}
|
20 |
+
end
|
21 |
+
|
22 |
+
def version
|
23 |
+
render plain: ENV["JUDGE0_VERSION"]
|
24 |
+
end
|
25 |
+
|
26 |
+
def license
|
27 |
+
render plain: @@license
|
28 |
+
end
|
29 |
+
|
30 |
+
def isolate
|
31 |
+
render plain: @@isolate
|
32 |
+
end
|
33 |
+
|
34 |
+
def statistics
|
35 |
+
Rails.cache.delete("statistics") if params[:invalidate_cache] == "true"
|
36 |
+
@@cache_duration ||= 10.minutes
|
37 |
+
render json: Rails.cache.fetch("statistics", expires_in: @@cache_duration) {
|
38 |
+
@@language_name ||= Hash[Language.unscoped.pluck(:id, :name)]
|
39 |
+
|
40 |
+
count_by_language = []
|
41 |
+
Submission.unscoped.group(:language_id).count.each do |language_id, count|
|
42 |
+
count_by_language << {
|
43 |
+
language: {
|
44 |
+
id: language_id,
|
45 |
+
name: @@language_name[language_id]
|
46 |
+
},
|
47 |
+
count: count
|
48 |
+
}
|
49 |
+
end
|
50 |
+
count_by_language = count_by_language.sort_by { |x| x[:count] }.reverse
|
51 |
+
|
52 |
+
count_by_status = []
|
53 |
+
Submission.unscoped.group(:status_id).count.each do |status_id, count|
|
54 |
+
count_by_status << {
|
55 |
+
status: {
|
56 |
+
id: status_id,
|
57 |
+
name: Status.find_by(id: status_id).name # Not a SQL query!
|
58 |
+
},
|
59 |
+
count: count
|
60 |
+
}
|
61 |
+
end
|
62 |
+
count_by_status = count_by_status.sort_by{ |x| x[:count] }.reverse
|
63 |
+
|
64 |
+
now = DateTime.now
|
65 |
+
today = DateTime.now.beginning_of_day.to_date
|
66 |
+
last_30_days = Submission.unscoped.group("created_at::DATE").where("created_at::DATE >= ?", today - 30).count
|
67 |
+
last_30_days[today] ||= 0
|
68 |
+
last_30_days_result = {}
|
69 |
+
(today-30...today).each do |day|
|
70 |
+
last_30_days_result[day.to_date] = last_30_days[day] || 0
|
71 |
+
end
|
72 |
+
last_30_days_result = last_30_days_result.sort.reverse.to_h
|
73 |
+
|
74 |
+
database_size = ActiveRecord::Base.connection.execute(
|
75 |
+
"SELECT
|
76 |
+
pg_size_pretty(pg_database_size('#{ENV['POSTGRES_DB']}')) AS size_pretty,
|
77 |
+
pg_database_size('#{ENV['POSTGRES_DB']}') AS size_in_bytes
|
78 |
+
"
|
79 |
+
).to_a[0]
|
80 |
+
|
81 |
+
{
|
82 |
+
created_at: now,
|
83 |
+
cached_until: now + @@cache_duration,
|
84 |
+
submissions: {
|
85 |
+
total: Submission.count,
|
86 |
+
today: last_30_days[today],
|
87 |
+
last_30_days: last_30_days_result
|
88 |
+
},
|
89 |
+
languages: count_by_language,
|
90 |
+
statuses: count_by_status,
|
91 |
+
database: {
|
92 |
+
size_pretty: database_size["size_pretty"],
|
93 |
+
size_in_bytes: database_size["size_in_bytes"]
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
end
|
98 |
+
end
|
app/controllers/languages_controller.rb
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class LanguagesController < ApplicationController
|
2 |
+
def index
|
3 |
+
render json: Language.all, each_serializer: LanguageSerializer, fields: [:id, :name]
|
4 |
+
end
|
5 |
+
|
6 |
+
def all
|
7 |
+
render json: Language.unscoped.order(name: :asc), each_serializer: LanguageSerializer, fields: [:id, :name, :is_archived]
|
8 |
+
end
|
9 |
+
|
10 |
+
def show
|
11 |
+
render json: Language.unscoped.find(params[:id])
|
12 |
+
end
|
13 |
+
end
|
app/controllers/sessions_controller.rb
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class SessionsController < ActionController::API
|
2 |
+
before_action :verify_ip_address
|
3 |
+
before_action :authenticate_request
|
4 |
+
before_action :authorize_request, only: [:authorize]
|
5 |
+
|
6 |
+
def authenticate
|
7 |
+
head :ok
|
8 |
+
end
|
9 |
+
|
10 |
+
def authorize
|
11 |
+
head :ok
|
12 |
+
end
|
13 |
+
|
14 |
+
private
|
15 |
+
|
16 |
+
def verify_ip_address
|
17 |
+
@@disallowed_ip_addresses ||= ENV['DISALLOW_IP'].to_s.split - ENV['ALLOW_IP'].to_s.split
|
18 |
+
@@allowed_ip_addresses ||= ENV['ALLOW_IP'].to_s.split - ENV['DISALLOW_IP'].to_s.split
|
19 |
+
head :forbidden if @@disallowed_ip_addresses.include?(request.remote_ip)
|
20 |
+
head :forbidden if @@allowed_ip_addresses.present? && !@@allowed_ip_addresses.include?(request.remote_ip)
|
21 |
+
end
|
22 |
+
|
23 |
+
def authenticate_request
|
24 |
+
head :unauthorized if safe_compare(Rails.application.secrets.authn_token, Rails.application.secrets.authn_header)
|
25 |
+
end
|
26 |
+
|
27 |
+
def authorize_request
|
28 |
+
head :forbidden unless Rails.application.secrets.authz_token.present?
|
29 |
+
head :forbidden if safe_compare(Rails.application.secrets.authz_token, Rails.application.secrets.authz_header)
|
30 |
+
end
|
31 |
+
|
32 |
+
def check_maintenance
|
33 |
+
@@maintenance_message ||= ENV['MAINTENANCE_MESSAGE']
|
34 |
+
if Config::MAINTENANCE_MODE
|
35 |
+
render json: {
|
36 |
+
error: @@maintenance_message
|
37 |
+
}, status: :service_unavailable
|
38 |
+
end
|
39 |
+
end
|
40 |
+
|
41 |
+
def safe_compare(token, header)
|
42 |
+
token = token.to_s
|
43 |
+
header = header.to_s
|
44 |
+
return false unless token.present?
|
45 |
+
provided_token = (request.headers[header] || params[header]).to_s
|
46 |
+
token.split.each do |value|
|
47 |
+
return false if ActiveSupport::SecurityUtils.secure_compare(value, provided_token)
|
48 |
+
end
|
49 |
+
true
|
50 |
+
end
|
51 |
+
end
|
app/controllers/statuses_controller.rb
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class StatusesController < ApplicationController
|
2 |
+
def index
|
3 |
+
render json: Status.all, each_serializer: StatusSerializer
|
4 |
+
end
|
5 |
+
end
|
app/controllers/submissions_controller.rb
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class SubmissionsController < ApplicationController
|
2 |
+
before_action :authorize_request, only: [:index, :destroy]
|
3 |
+
before_action :check_maintenance, only: [:create, :destroy]
|
4 |
+
before_action :check_wait, only: [:create] # Wait in batch_create is not allowed
|
5 |
+
before_action :check_batched_submissions, only: [:batch_create, :batch_show]
|
6 |
+
before_action :check_queue_size, only: [:create, :batch_create]
|
7 |
+
before_action :check_requested_fields, except: [:batch_create] # Fields are ignored in batch_create
|
8 |
+
before_action :set_base64_encoded
|
9 |
+
|
10 |
+
def index
|
11 |
+
page = params[:page].try(:to_i) || 1
|
12 |
+
per_page = params[:per_page].try(:to_i) || Submission.per_page
|
13 |
+
|
14 |
+
if page <= 0
|
15 |
+
render json: { error: "invalid page: #{page}" }, status: :bad_request
|
16 |
+
return
|
17 |
+
elsif per_page < 0
|
18 |
+
render json: { error: "invalid per_page: #{per_page}" }, status: :bad_request
|
19 |
+
return
|
20 |
+
end
|
21 |
+
|
22 |
+
submissions = Submission.paginate(page: page, per_page: per_page)
|
23 |
+
serializable_submissions = ActiveModelSerializers::SerializableResource.new(
|
24 |
+
submissions, { each_serializer: SubmissionSerializer, base64_encoded: @base64_encoded, fields: @requested_fields }
|
25 |
+
)
|
26 |
+
|
27 |
+
render json: {
|
28 |
+
submissions: serializable_submissions.as_json,
|
29 |
+
meta: pagination_dict(submissions)
|
30 |
+
}
|
31 |
+
rescue Encoding::UndefinedConversionError => e
|
32 |
+
render json: {
|
33 |
+
error: "some attributes for one or more submissions cannot be converted to UTF-8, use base64_encoded=true query parameter"
|
34 |
+
}, status: :bad_request
|
35 |
+
end
|
36 |
+
|
37 |
+
def destroy
|
38 |
+
if !Config::ENABLE_SUBMISSION_DELETE
|
39 |
+
render json: { error: "delete not allowed" }, status: :bad_request
|
40 |
+
return
|
41 |
+
end
|
42 |
+
|
43 |
+
submission = Submission.find_by!(token: params[:token])
|
44 |
+
if submission.status == Status.queue || submission.status == Status.process
|
45 |
+
render json: {
|
46 |
+
error: "submission cannot be deleted because its status is #{submission.status.id} (#{submission.status.name})"
|
47 |
+
}, status: :bad_request
|
48 |
+
return
|
49 |
+
end
|
50 |
+
|
51 |
+
submission.delete
|
52 |
+
|
53 |
+
# Forcing base64_encoded=true because it guarantees user will get requested data after delete.
|
54 |
+
render json: submission, base64_encoded: true, fields: @requested_fields
|
55 |
+
end
|
56 |
+
|
57 |
+
def show
|
58 |
+
token = params[:token]
|
59 |
+
render json: Rails.cache.fetch("#{token}", expires_in: Config::SUBMISSION_CACHE_DURATION, race_condition_ttl: 0.1*Config::SUBMISSION_CACHE_DURATION) {
|
60 |
+
Submission.find_by!(token: token)
|
61 |
+
}, base64_encoded: @base64_encoded, fields: @requested_fields
|
62 |
+
rescue Encoding::UndefinedConversionError
|
63 |
+
render_conversion_error(:bad_request)
|
64 |
+
end
|
65 |
+
|
66 |
+
def batch_show
|
67 |
+
tokens = (request.headers[:tokens] || params[:tokens]).to_s.strip.split(",")
|
68 |
+
|
69 |
+
if tokens.length > Config::MAX_SUBMISSION_BATCH_SIZE
|
70 |
+
render json: {
|
71 |
+
error: "number of submissions in a batch should be less than or equal to #{Config::MAX_SUBMISSION_BATCH_SIZE}"
|
72 |
+
}, status: :bad_request
|
73 |
+
return
|
74 |
+
elsif tokens.length == 0
|
75 |
+
render json: {
|
76 |
+
error: "there should be at least one submission in a batch"
|
77 |
+
}, status: :bad_request
|
78 |
+
return
|
79 |
+
end
|
80 |
+
|
81 |
+
existing_submissions = Hash[Submission.where(token: tokens).collect{ |s| [s.token, s] }]
|
82 |
+
|
83 |
+
submissions = []
|
84 |
+
tokens.each do |token|
|
85 |
+
if existing_submissions.has_key?(token)
|
86 |
+
serialized_submission = ActiveModelSerializers::SerializableResource.new(
|
87 |
+
existing_submissions[token], { serializer: SubmissionSerializer, base64_encoded: @base64_encoded, fields: @requested_fields }
|
88 |
+
)
|
89 |
+
submissions << serialized_submission.as_json
|
90 |
+
else
|
91 |
+
submissions << nil
|
92 |
+
end
|
93 |
+
end
|
94 |
+
|
95 |
+
render json: { submissions: submissions }
|
96 |
+
rescue Encoding::UndefinedConversionError => e
|
97 |
+
render json: {
|
98 |
+
error: "some attributes for one or more submissions cannot be converted to UTF-8, use base64_encoded=true query parameter"
|
99 |
+
}, status: :bad_request
|
100 |
+
end
|
101 |
+
|
102 |
+
def create
|
103 |
+
submission = Submission.new(submission_params(params))
|
104 |
+
|
105 |
+
if submission.save
|
106 |
+
if @wait
|
107 |
+
begin
|
108 |
+
IsolateRunner.perform_now(submission)
|
109 |
+
submission.reload
|
110 |
+
render json: submission, status: :created, base64_encoded: @base64_encoded, fields: @requested_fields
|
111 |
+
rescue Encoding::UndefinedConversionError => e
|
112 |
+
render_conversion_error(:created, submission.token)
|
113 |
+
end
|
114 |
+
else
|
115 |
+
IsolateRunner.perform_later(submission)
|
116 |
+
render json: submission, status: :created, fields: [:token]
|
117 |
+
end
|
118 |
+
else
|
119 |
+
render json: submission.errors, status: :unprocessable_entity
|
120 |
+
end
|
121 |
+
end
|
122 |
+
|
123 |
+
# Batch Create does not support sync (wait=true) mode.
|
124 |
+
def batch_create
|
125 |
+
number_of_submissions = params[:submissions].try(:size).to_i
|
126 |
+
|
127 |
+
if number_of_submissions > Config::MAX_SUBMISSION_BATCH_SIZE
|
128 |
+
render json: {
|
129 |
+
error: "number of submissions in a batch should be less than or equal to #{Config::MAX_SUBMISSION_BATCH_SIZE}"
|
130 |
+
}, status: :bad_request
|
131 |
+
return
|
132 |
+
elsif number_of_submissions == 0
|
133 |
+
render json: {
|
134 |
+
error: "there should be at least one submission in a batch"
|
135 |
+
}, status: :bad_request
|
136 |
+
return
|
137 |
+
end
|
138 |
+
|
139 |
+
submissions = params[:submissions].each.collect{ |p| Submission.new(submission_params(p)) }
|
140 |
+
|
141 |
+
response = []
|
142 |
+
has_valid_submission = false
|
143 |
+
|
144 |
+
submissions.each do |submission|
|
145 |
+
if submission.save
|
146 |
+
IsolateRunner.perform_later(submission)
|
147 |
+
response << { token: submission.token }
|
148 |
+
has_valid_submission = true
|
149 |
+
else
|
150 |
+
response << submission.errors
|
151 |
+
end
|
152 |
+
end
|
153 |
+
|
154 |
+
render json: response, status: has_valid_submission ? :created : :unprocessable_entity
|
155 |
+
end
|
156 |
+
|
157 |
+
private
|
158 |
+
|
159 |
+
def submission_params(params)
|
160 |
+
submission_params = params.permit(
|
161 |
+
:source_code,
|
162 |
+
:language_id,
|
163 |
+
:compiler_options,
|
164 |
+
:command_line_arguments,
|
165 |
+
:number_of_runs,
|
166 |
+
:stdin,
|
167 |
+
:expected_output,
|
168 |
+
:cpu_time_limit,
|
169 |
+
:cpu_extra_time,
|
170 |
+
:wall_time_limit,
|
171 |
+
:memory_limit,
|
172 |
+
:stack_limit,
|
173 |
+
:max_processes_and_or_threads,
|
174 |
+
:enable_per_process_and_thread_time_limit,
|
175 |
+
:enable_per_process_and_thread_memory_limit,
|
176 |
+
:max_file_size,
|
177 |
+
:redirect_stderr_to_stdout,
|
178 |
+
:callback_url,
|
179 |
+
:additional_files,
|
180 |
+
:enable_network
|
181 |
+
)
|
182 |
+
|
183 |
+
submission_params[:additional_files] = Base64Service.decode(submission_params[:additional_files])
|
184 |
+
|
185 |
+
if @base64_encoded
|
186 |
+
submission_params[:source_code] = Base64Service.decode(submission_params[:source_code])
|
187 |
+
submission_params[:stdin] = Base64Service.decode(submission_params[:stdin])
|
188 |
+
submission_params[:expected_output] = Base64Service.decode(submission_params[:expected_output])
|
189 |
+
end
|
190 |
+
|
191 |
+
submission_params
|
192 |
+
end
|
193 |
+
|
194 |
+
def check_wait
|
195 |
+
@wait = params[:wait] == "true"
|
196 |
+
if @wait && !Config::ENABLE_WAIT_RESULT
|
197 |
+
render json: { error: "wait not allowed" }, status: :bad_request
|
198 |
+
end
|
199 |
+
end
|
200 |
+
|
201 |
+
def check_batched_submissions
|
202 |
+
unless Config::ENABLE_BATCHED_SUBMISSIONS
|
203 |
+
render json: { error: "batched submissions are not allowed" }, status: :bad_request
|
204 |
+
end
|
205 |
+
end
|
206 |
+
|
207 |
+
def check_queue_size
|
208 |
+
number_of_submissions = params[:submissions].try(:size).presence || 1
|
209 |
+
if Resque.size(ENV["JUDGE0_VERSION"]) + number_of_submissions > Config::MAX_QUEUE_SIZE
|
210 |
+
render json: { error: "queue is full" }, status: :service_unavailable
|
211 |
+
end
|
212 |
+
end
|
213 |
+
|
214 |
+
def check_requested_fields
|
215 |
+
fields_service = Fields::Submission.new(params[:fields])
|
216 |
+
render json: { error: "invalid fields: [#{fields_service.invalid_fields.join(", ")}]" }, status: :bad_request if fields_service.has_invalid_fields?
|
217 |
+
@requested_fields = fields_service.requested_fields
|
218 |
+
end
|
219 |
+
|
220 |
+
def set_base64_encoded
|
221 |
+
if Config::DISABLE_IMPLICIT_BASE64_ENCODING
|
222 |
+
@base64_encoded = params[:base64_encoded] == "true"
|
223 |
+
else
|
224 |
+
@base64_encoded = params[:base64_encoded] != "false"
|
225 |
+
end
|
226 |
+
end
|
227 |
+
|
228 |
+
def render_conversion_error(status, token = nil)
|
229 |
+
response_json = {
|
230 |
+
error: "some attributes for this submission cannot be converted to UTF-8, use base64_encoded=true query parameter",
|
231 |
+
}
|
232 |
+
response_json[:token] = token if token
|
233 |
+
|
234 |
+
render json: response_json, status: status
|
235 |
+
end
|
236 |
+
end
|
app/enumerations/status.rb
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class Status < Enumerations::Base
|
2 |
+
values queue: { id: 1, name: 'In Queue' },
|
3 |
+
process: { id: 2, name: 'Processing' },
|
4 |
+
ac: { id: 3, name: 'Accepted' },
|
5 |
+
wa: { id: 4, name: 'Wrong Answer' },
|
6 |
+
tle: { id: 5, name: 'Time Limit Exceeded' },
|
7 |
+
ce: { id: 6, name: 'Compilation Error' },
|
8 |
+
sigsegv: { id: 7, name: 'Runtime Error (SIGSEGV)' },
|
9 |
+
sigxfsz: { id: 8, name: 'Runtime Error (SIGXFSZ)' },
|
10 |
+
sigfpe: { id: 9, name: 'Runtime Error (SIGFPE)' },
|
11 |
+
sigabrt: { id: 10, name: 'Runtime Error (SIGABRT)' },
|
12 |
+
nzec: { id: 11, name: 'Runtime Error (NZEC)' },
|
13 |
+
other: { id: 12, name: 'Runtime Error (Other)' },
|
14 |
+
boxerr: { id: 13, name: 'Internal Error' },
|
15 |
+
exeerr: { id: 14, name: 'Exec Format Error' }
|
16 |
+
|
17 |
+
def self.find_runtime_error_by_status_code(status_code)
|
18 |
+
case status_code.to_i
|
19 |
+
when 11 then Status.sigsegv
|
20 |
+
when 25 then Status.sigxfsz
|
21 |
+
when 8 then Status.sigfpe
|
22 |
+
when 6 then Status.sigabrt
|
23 |
+
else Status.other
|
24 |
+
end
|
25 |
+
end
|
26 |
+
|
27 |
+
def self.model_name
|
28 |
+
@@model_name ||= ActiveModel::Name.new(self)
|
29 |
+
end
|
30 |
+
end
|
app/helpers/config.rb
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module Config
|
2 |
+
# For more info read:
|
3 |
+
# https://github.com/judge0/judge0/blob/master/judge0.conf
|
4 |
+
|
5 |
+
MAINTENANCE_MODE = ENV["MAINTENANCE_MODE"] == "true"
|
6 |
+
ENABLE_WAIT_RESULT = ENV["ENABLE_WAIT_RESULT"] != "false"
|
7 |
+
ENABLE_COMPILER_OPTIONS = ENV["ENABLE_COMPILER_OPTIONS"] != "false"
|
8 |
+
ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS = ENV["ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS"].to_s.strip.split
|
9 |
+
ENABLE_COMMAND_LINE_ARGUMENTS = ENV["ENABLE_COMMAND_LINE_ARGUMENTS"] != "false"
|
10 |
+
ENABLE_SUBMISSION_DELETE = ENV["ENABLE_SUBMISSION_DELETE"] == "true"
|
11 |
+
ENABLE_CALLBACKS = ENV["ENABLE_CALLBACKS"] != "false"
|
12 |
+
CALLBACKS_MAX_TRIES = (ENV["CALLBACKS_MAX_TRIES"].presence || 3).to_i
|
13 |
+
CALLBACKS_TIMEOUT = (ENV["CALLBACKS_TIMEOUT"].presence || 5).to_f
|
14 |
+
ENABLE_ADDITIONAL_FILES = ENV["ENABLE_ADDITIONAL_FILES"] != "false"
|
15 |
+
MAX_QUEUE_SIZE = (ENV["MAX_QUEUE_SIZE"].presence || 100).to_i
|
16 |
+
CPU_TIME_LIMIT = (ENV["CPU_TIME_LIMIT"].presence || 5).to_f
|
17 |
+
MAX_CPU_TIME_LIMIT = (ENV["MAX_CPU_TIME_LIMIT"].presence || 15).to_f
|
18 |
+
CPU_EXTRA_TIME = (ENV["CPU_EXTRA_TIME"].presence || 1).to_f
|
19 |
+
MAX_CPU_EXTRA_TIME = (ENV["MAX_CPU_EXTRA_TIME"].presence || 5).to_f
|
20 |
+
WALL_TIME_LIMIT = (ENV["WALL_TIME_LIMIT"].presence || 10).to_f
|
21 |
+
MAX_WALL_TIME_LIMIT = (ENV["MAX_WALL_TIME_LIMIT"].presence || 20).to_f
|
22 |
+
MEMORY_LIMIT = (ENV["MEMORY_LIMIT"].presence || 128000).to_i # in KB
|
23 |
+
MAX_MEMORY_LIMIT = (ENV["MAX_MEMORY_LIMIT"].presence || 512000).to_i
|
24 |
+
STACK_LIMIT = (ENV["STACK_LIMIT"].presence || 64000).to_i # in KB
|
25 |
+
MAX_STACK_LIMIT = (ENV["MAX_STACK_LIMIT"].presence || 128000).to_i
|
26 |
+
MAX_PROCESSES_AND_OR_THREADS = (ENV["MAX_PROCESSES_AND_OR_THREADS"].presence || 60).to_i
|
27 |
+
MAX_MAX_PROCESSES_AND_OR_THREADS = (ENV["MAX_MAX_PROCESSES_AND_OR_THREADS"].presence || 120).to_i
|
28 |
+
ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT = ENV["ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT"] == "true"
|
29 |
+
ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT = ENV["ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT"] != "false"
|
30 |
+
ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT = ENV["ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT"] == "true"
|
31 |
+
ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT = ENV["ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT"] != "false"
|
32 |
+
MAX_FILE_SIZE = (ENV["MAX_FILE_SIZE"].presence || 1024).to_i
|
33 |
+
MAX_MAX_FILE_SIZE = (ENV["MAX_MAX_FILE_SIZE"].presence || 4096).to_i
|
34 |
+
NUMBER_OF_RUNS = (ENV["NUMBER_OF_RUNS"].presence || 1).to_i
|
35 |
+
MAX_NUMBER_OF_RUNS = (ENV["MAX_NUMBER_OF_RUNS"].presence || 20).to_i
|
36 |
+
REDIRECT_STDERR_TO_STDOUT = ENV["REDIRECT_STDERR_TO_STDOUT"] == "true"
|
37 |
+
MAX_EXTRACT_SIZE = (ENV["MAX_EXTRACT_SIZE"].presence || 10240).to_i
|
38 |
+
ENABLE_BATCHED_SUBMISSIONS = ENV["ENABLE_BATCHED_SUBMISSIONS"] != "false"
|
39 |
+
MAX_SUBMISSION_BATCH_SIZE = (ENV["MAX_SUBMISSION_BATCH_SIZE"].presence || 20).to_i
|
40 |
+
SUBMISSION_CACHE_DURATION = (ENV["SUBMISSION_CACHE_DURATION"].presence || 1).to_f
|
41 |
+
USE_DOCS_AS_HOMEPAGE = ENV["USE_DOCS_AS_HOMEPAGE"] == "true"
|
42 |
+
ALLOW_ENABLE_NETWORK = ENV["ALLOW_ENABLE_NETWORK"] != "false"
|
43 |
+
ENABLE_NETWORK = ENV["ENABLE_NETWORK"] == "true"
|
44 |
+
DISABLE_IMPLICIT_BASE64_ENCODING = ENV["DISABLE_IMPLICIT_BASE64_ENCODING"] == "true"
|
45 |
+
|
46 |
+
def self.config_info
|
47 |
+
@@default_confg ||= {
|
48 |
+
"maintenance_mode": MAINTENANCE_MODE,
|
49 |
+
"enable_wait_result": ENABLE_WAIT_RESULT,
|
50 |
+
"enable_compiler_options": ENABLE_COMPILER_OPTIONS,
|
51 |
+
"allowed_languages_for_compile_options": ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS,
|
52 |
+
"enable_command_line_arguments": ENABLE_COMMAND_LINE_ARGUMENTS,
|
53 |
+
"enable_submission_delete": ENABLE_SUBMISSION_DELETE,
|
54 |
+
"enable_callbacks": ENABLE_CALLBACKS,
|
55 |
+
"callbacks_max_tries": CALLBACKS_MAX_TRIES,
|
56 |
+
"callbacks_timeout": CALLBACKS_TIMEOUT,
|
57 |
+
"enable_additional_files": ENABLE_ADDITIONAL_FILES,
|
58 |
+
"max_queue_size": MAX_QUEUE_SIZE,
|
59 |
+
"cpu_time_limit": CPU_TIME_LIMIT,
|
60 |
+
"max_cpu_time_limit": MAX_CPU_TIME_LIMIT,
|
61 |
+
"cpu_extra_time": CPU_EXTRA_TIME,
|
62 |
+
"max_cpu_extra_time": MAX_CPU_EXTRA_TIME,
|
63 |
+
"wall_time_limit": WALL_TIME_LIMIT,
|
64 |
+
"max_wall_time_limit": MAX_WALL_TIME_LIMIT,
|
65 |
+
"memory_limit": MEMORY_LIMIT,
|
66 |
+
"max_memory_limit": MAX_MEMORY_LIMIT,
|
67 |
+
"stack_limit": STACK_LIMIT,
|
68 |
+
"max_stack_limit": MAX_STACK_LIMIT,
|
69 |
+
"max_processes_and_or_threads": MAX_PROCESSES_AND_OR_THREADS,
|
70 |
+
"max_max_processes_and_or_threads": MAX_MAX_PROCESSES_AND_OR_THREADS,
|
71 |
+
"enable_per_process_and_thread_time_limit": ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT,
|
72 |
+
"allow_enable_per_process_and_thread_time_limit": ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT,
|
73 |
+
"enable_per_process_and_thread_memory_limit": ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT,
|
74 |
+
"allow_enable_per_process_and_thread_memory_limit": ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT,
|
75 |
+
"max_file_size": MAX_FILE_SIZE,
|
76 |
+
"max_max_file_size": MAX_MAX_FILE_SIZE,
|
77 |
+
"number_of_runs": NUMBER_OF_RUNS,
|
78 |
+
"max_number_of_runs": MAX_NUMBER_OF_RUNS,
|
79 |
+
"redirect_stderr_to_stdout": REDIRECT_STDERR_TO_STDOUT,
|
80 |
+
"max_extract_size": MAX_EXTRACT_SIZE,
|
81 |
+
"enable_batched_submissions": ENABLE_BATCHED_SUBMISSIONS,
|
82 |
+
"max_submission_batch_size": MAX_SUBMISSION_BATCH_SIZE,
|
83 |
+
"submission_cache_duration": SUBMISSION_CACHE_DURATION,
|
84 |
+
"use_docs_as_homepage": USE_DOCS_AS_HOMEPAGE,
|
85 |
+
"allow_enable_network": ALLOW_ENABLE_NETWORK,
|
86 |
+
"enable_network": ENABLE_NETWORK,
|
87 |
+
"disable_implicit_base64_encoding": DISABLE_IMPLICIT_BASE64_ENCODING
|
88 |
+
}
|
89 |
+
end
|
90 |
+
end
|
app/helpers/isolate_runner.rb
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module IsolateRunner
|
2 |
+
MAX_WAIT_TIME_S = 600
|
3 |
+
|
4 |
+
INITIAL_WAIT_TIME_S = 2
|
5 |
+
NEXT_WAIT_TIME_S = 1
|
6 |
+
WAIT_TIME_FACTOR_S = 0.5
|
7 |
+
|
8 |
+
WAITING_STATUSES = [Status.queue.id, Status.process.id, nil]
|
9 |
+
|
10 |
+
def self.perform_now(submission)
|
11 |
+
IsolateRunner.perform_later(submission)
|
12 |
+
|
13 |
+
submission_id = submission.id
|
14 |
+
|
15 |
+
total_wait_time = 0
|
16 |
+
(0..).each do |i|
|
17 |
+
break if total_wait_time >= MAX_WAIT_TIME_S
|
18 |
+
|
19 |
+
if i == 0 then
|
20 |
+
wait_time = INITIAL_WAIT_TIME_S
|
21 |
+
elsif i == 1 then
|
22 |
+
wait_time = NEXT_WAIT_TIME_S
|
23 |
+
else
|
24 |
+
wait_time = WAIT_TIME_FACTOR_S * i
|
25 |
+
end
|
26 |
+
|
27 |
+
sleep(wait_time)
|
28 |
+
|
29 |
+
total_wait_time += wait_time
|
30 |
+
|
31 |
+
break if !WAITING_STATUSES.include?(Submission.where(id: submission_id).pluck(:status_id).first)
|
32 |
+
end
|
33 |
+
end
|
34 |
+
|
35 |
+
def self.perform_later(submission)
|
36 |
+
submission.update(status: Status.queue, queued_at: DateTime.now, queue_host: ENV["HOSTNAME"])
|
37 |
+
IsolateJob.perform_later(submission.id)
|
38 |
+
end
|
39 |
+
end
|
app/helpers/nil_value.rb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module NilValue
|
2 |
+
def self.value_or_default(value, default)
|
3 |
+
return value unless value == nil
|
4 |
+
return default
|
5 |
+
end
|
6 |
+
end
|
app/helpers/system_info.rb
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module SystemInfo
|
2 |
+
def self.sys_info
|
3 |
+
@@sys_info ||= self.cpu_info.merge(self.mem_info)
|
4 |
+
end
|
5 |
+
|
6 |
+
def self.cpu_info #sorryforthisline
|
7 |
+
@@cpu_info ||= Hash[`lscpu`.split("\n").collect{|l| l = l.split(":"); [l[0].strip, l[1].strip]}]
|
8 |
+
end
|
9 |
+
|
10 |
+
def self.mem_info #sorryagain #itjustworks
|
11 |
+
@@mem_info ||= Hash[`free -h`.split("\n")[1..-1].collect{|l| l = l.split(":"); [l[0].strip, l[1].split(" ")[0].strip]}].without("-/+ buffers/cache")
|
12 |
+
end
|
13 |
+
end
|
app/jobs/application_job.rb
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
class ApplicationJob < ActiveJob::Base
|
2 |
+
end
|
app/jobs/isolate_job.rb
ADDED
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class IsolateJob < ApplicationJob
|
2 |
+
retry_on RuntimeError, wait: 0.1.seconds, attempts: 100
|
3 |
+
|
4 |
+
queue_as ENV["JUDGE0_VERSION"].to_sym
|
5 |
+
|
6 |
+
STDIN_FILE_NAME = "stdin.txt"
|
7 |
+
STDOUT_FILE_NAME = "stdout.txt"
|
8 |
+
STDERR_FILE_NAME = "stderr.txt"
|
9 |
+
METADATA_FILE_NAME = "metadata.txt"
|
10 |
+
ADDITIONAL_FILES_ARCHIVE_FILE_NAME = "additional_files.zip"
|
11 |
+
|
12 |
+
attr_reader :submission, :cgroups,
|
13 |
+
:box_id, :workdir, :boxdir, :tmpdir,
|
14 |
+
:source_file, :stdin_file, :stdout_file,
|
15 |
+
:stderr_file, :metadata_file, :additional_files_archive_file
|
16 |
+
|
17 |
+
def perform(submission_id)
|
18 |
+
@submission = Submission.find(submission_id)
|
19 |
+
submission.update(status: Status.process, started_at: DateTime.now, execution_host: ENV["HOSTNAME"])
|
20 |
+
|
21 |
+
time = []
|
22 |
+
memory = []
|
23 |
+
|
24 |
+
submission.number_of_runs.times do
|
25 |
+
initialize_workdir
|
26 |
+
if compile == :failure
|
27 |
+
cleanup
|
28 |
+
return
|
29 |
+
end
|
30 |
+
run
|
31 |
+
verify
|
32 |
+
|
33 |
+
time << submission.time
|
34 |
+
memory << submission.memory
|
35 |
+
|
36 |
+
cleanup
|
37 |
+
break if submission.status != Status.ac
|
38 |
+
end
|
39 |
+
|
40 |
+
submission.time = time.inject(&:+).to_f / time.size
|
41 |
+
submission.memory = memory.inject(&:+).to_f / memory.size
|
42 |
+
submission.save
|
43 |
+
|
44 |
+
rescue Exception => e
|
45 |
+
raise e.message unless submission
|
46 |
+
submission.update(message: e.message, status: Status.boxerr, finished_at: DateTime.now)
|
47 |
+
cleanup(raise_exception = false)
|
48 |
+
ensure
|
49 |
+
call_callback
|
50 |
+
end
|
51 |
+
|
52 |
+
private
|
53 |
+
|
54 |
+
def initialize_workdir
|
55 |
+
@box_id = submission.id%2147483647
|
56 |
+
@cgroups = (!submission.enable_per_process_and_thread_time_limit || !submission.enable_per_process_and_thread_memory_limit) ? "--cg" : ""
|
57 |
+
@workdir = `isolate #{cgroups} -b #{box_id} --init`.chomp
|
58 |
+
@boxdir = workdir + "/box"
|
59 |
+
@tmpdir = workdir + "/tmp"
|
60 |
+
@source_file = boxdir + "/" + submission.language.source_file.to_s
|
61 |
+
@stdin_file = workdir + "/" + STDIN_FILE_NAME
|
62 |
+
@stdout_file = workdir + "/" + STDOUT_FILE_NAME
|
63 |
+
@stderr_file = workdir + "/" + STDERR_FILE_NAME
|
64 |
+
@metadata_file = workdir + "/" + METADATA_FILE_NAME
|
65 |
+
@additional_files_archive_file = boxdir + "/" + ADDITIONAL_FILES_ARCHIVE_FILE_NAME
|
66 |
+
|
67 |
+
[stdin_file, stdout_file, stderr_file, metadata_file].each do |f|
|
68 |
+
initialize_file(f)
|
69 |
+
end
|
70 |
+
|
71 |
+
File.open(source_file, "wb") { |f| f.write(submission.source_code) } unless submission.is_project
|
72 |
+
File.open(stdin_file, "wb") { |f| f.write(submission.stdin) }
|
73 |
+
|
74 |
+
extract_archive
|
75 |
+
end
|
76 |
+
|
77 |
+
def initialize_file(file)
|
78 |
+
`sudo touch #{file} && sudo chown $(whoami): #{file}`
|
79 |
+
end
|
80 |
+
|
81 |
+
def extract_archive
|
82 |
+
return unless submission.additional_files?
|
83 |
+
|
84 |
+
File.open(additional_files_archive_file, "wb") { |f| f.write(submission.additional_files) }
|
85 |
+
|
86 |
+
command = "isolate #{cgroups} \
|
87 |
+
-s \
|
88 |
+
-b #{box_id} \
|
89 |
+
--stderr-to-stdout \
|
90 |
+
-t 2 \
|
91 |
+
-x 1 \
|
92 |
+
-w 4 \
|
93 |
+
-k #{Config::MAX_STACK_LIMIT} \
|
94 |
+
-p#{Config::MAX_MAX_PROCESSES_AND_OR_THREADS} \
|
95 |
+
#{submission.enable_per_process_and_thread_time_limit ? (cgroups.present? ? "--no-cg-timing" : "") : "--cg-timing"} \
|
96 |
+
#{submission.enable_per_process_and_thread_memory_limit ? "-m " : "--cg-mem="}#{Config::MAX_MEMORY_LIMIT} \
|
97 |
+
-f #{Config::MAX_EXTRACT_SIZE} \
|
98 |
+
--run \
|
99 |
+
-- /usr/bin/unzip -n -qq #{ADDITIONAL_FILES_ARCHIVE_FILE_NAME} \
|
100 |
+
"
|
101 |
+
|
102 |
+
puts "[#{DateTime.now}] Extracting archive for submission #{submission.token} (#{submission.id}):"
|
103 |
+
puts command.gsub(/\s+/, " ")
|
104 |
+
puts
|
105 |
+
|
106 |
+
`#{command}`
|
107 |
+
|
108 |
+
File.delete(additional_files_archive_file)
|
109 |
+
end
|
110 |
+
|
111 |
+
def compile
|
112 |
+
unless submission.is_project
|
113 |
+
return :success unless submission.language.compile_cmd
|
114 |
+
end
|
115 |
+
|
116 |
+
compile_script = boxdir + "/" + "compile.sh"
|
117 |
+
|
118 |
+
acceptable_project_compile_scripts = [compile_script, boxdir + "/" + "compile"]
|
119 |
+
if submission.is_project
|
120 |
+
compile_file_exists = false
|
121 |
+
acceptable_project_compile_scripts.each do |f|
|
122 |
+
if File.file?(f)
|
123 |
+
compile_script = f
|
124 |
+
compile_file_exists = true
|
125 |
+
break
|
126 |
+
end
|
127 |
+
end
|
128 |
+
|
129 |
+
unless compile_file_exists
|
130 |
+
return :success # If compile script does not exist then this project does not need to be compiled.
|
131 |
+
end
|
132 |
+
else
|
133 |
+
# gsub can be skipped if compile script is used, but is kept for additional security.
|
134 |
+
compiler_options = submission.compiler_options.to_s.strip.encode("UTF-8", invalid: :replace).gsub(/[$&;<>|`]/, "")
|
135 |
+
File.open(compile_script, "w") { |f| f.write("#{submission.language.compile_cmd % compiler_options}") }
|
136 |
+
end
|
137 |
+
|
138 |
+
compile_output_file = workdir + "/" + "compile_output.txt"
|
139 |
+
initialize_file(compile_output_file)
|
140 |
+
|
141 |
+
command = "isolate #{cgroups} \
|
142 |
+
-s \
|
143 |
+
-b #{box_id} \
|
144 |
+
-M #{metadata_file} \
|
145 |
+
--stderr-to-stdout \
|
146 |
+
-i /dev/null \
|
147 |
+
-t #{Config::MAX_CPU_TIME_LIMIT} \
|
148 |
+
-x 0 \
|
149 |
+
-w #{Config::MAX_WALL_TIME_LIMIT} \
|
150 |
+
-k #{Config::MAX_STACK_LIMIT} \
|
151 |
+
-p#{Config::MAX_MAX_PROCESSES_AND_OR_THREADS} \
|
152 |
+
#{submission.enable_per_process_and_thread_time_limit ? (cgroups.present? ? "--no-cg-timing" : "") : "--cg-timing"} \
|
153 |
+
#{submission.enable_per_process_and_thread_memory_limit ? "-m " : "--cg-mem="}#{Config::MAX_MEMORY_LIMIT} \
|
154 |
+
-f #{Config::MAX_MAX_FILE_SIZE} \
|
155 |
+
-E HOME=/tmp \
|
156 |
+
-E PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" \
|
157 |
+
-E LANG -E LANGUAGE -E LC_ALL -E JUDGE0_HOMEPAGE -E JUDGE0_SOURCE_CODE -E JUDGE0_MAINTAINER -E JUDGE0_VERSION \
|
158 |
+
-d /etc:noexec \
|
159 |
+
--run \
|
160 |
+
-- /bin/bash $(basename #{compile_script}) > #{compile_output_file} \
|
161 |
+
"
|
162 |
+
|
163 |
+
puts "[#{DateTime.now}] Compiling submission #{submission.token} (#{submission.id}):"
|
164 |
+
puts command.gsub(/\s+/, " ")
|
165 |
+
puts
|
166 |
+
|
167 |
+
`#{command}`
|
168 |
+
process_status = $?
|
169 |
+
|
170 |
+
compile_output = File.read(compile_output_file)
|
171 |
+
compile_output = nil if compile_output.empty?
|
172 |
+
submission.compile_output = compile_output
|
173 |
+
|
174 |
+
metadata = get_metadata
|
175 |
+
|
176 |
+
reset_metadata_file
|
177 |
+
|
178 |
+
files_to_remove = [compile_output_file]
|
179 |
+
files_to_remove << compile_script unless submission.is_project
|
180 |
+
files_to_remove.each do |f|
|
181 |
+
`sudo rm -rf #{f}`
|
182 |
+
end
|
183 |
+
|
184 |
+
return :success if process_status.success?
|
185 |
+
|
186 |
+
if metadata[:status] == "TO"
|
187 |
+
submission.compile_output = "Compilation time limit exceeded."
|
188 |
+
end
|
189 |
+
|
190 |
+
submission.finished_at = DateTime.now
|
191 |
+
submission.time = nil
|
192 |
+
submission.wall_time = nil
|
193 |
+
submission.memory = nil
|
194 |
+
submission.stdout = nil
|
195 |
+
submission.stderr = nil
|
196 |
+
submission.exit_code = nil
|
197 |
+
submission.exit_signal = nil
|
198 |
+
submission.message = nil
|
199 |
+
submission.status = Status.ce
|
200 |
+
submission.save
|
201 |
+
|
202 |
+
return :failure
|
203 |
+
end
|
204 |
+
|
205 |
+
def run
|
206 |
+
run_script = boxdir + "/" + "run.sh"
|
207 |
+
|
208 |
+
acceptable_project_run_scripts = [run_script, boxdir + "/" + "run"]
|
209 |
+
acceptable_project_run_scripts.each do |f|
|
210 |
+
if File.file?(f)
|
211 |
+
run_script = f
|
212 |
+
break
|
213 |
+
end
|
214 |
+
end
|
215 |
+
|
216 |
+
unless submission.is_project
|
217 |
+
# gsub is mandatory!
|
218 |
+
command_line_arguments = submission.command_line_arguments.to_s.strip.encode("UTF-8", invalid: :replace).gsub(/[$&;<>|`]/, "")
|
219 |
+
File.open(run_script, "w") { |f| f.write("#{submission.language.run_cmd} #{command_line_arguments}")}
|
220 |
+
end
|
221 |
+
|
222 |
+
command = "isolate #{cgroups} \
|
223 |
+
-s \
|
224 |
+
-b #{box_id} \
|
225 |
+
-M #{metadata_file} \
|
226 |
+
#{submission.redirect_stderr_to_stdout ? "--stderr-to-stdout" : ""} \
|
227 |
+
#{submission.enable_network ? "--share-net" : ""} \
|
228 |
+
-t #{submission.cpu_time_limit} \
|
229 |
+
-x #{submission.cpu_extra_time} \
|
230 |
+
-w #{submission.wall_time_limit} \
|
231 |
+
-k #{submission.stack_limit} \
|
232 |
+
-p#{submission.max_processes_and_or_threads} \
|
233 |
+
#{submission.enable_per_process_and_thread_time_limit ? (cgroups.present? ? "--no-cg-timing" : "") : "--cg-timing"} \
|
234 |
+
#{submission.enable_per_process_and_thread_memory_limit ? "-m " : "--cg-mem="}#{submission.memory_limit} \
|
235 |
+
-f #{submission.max_file_size} \
|
236 |
+
-E HOME=/tmp \
|
237 |
+
-E PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" \
|
238 |
+
-E LANG -E LANGUAGE -E LC_ALL -E JUDGE0_HOMEPAGE -E JUDGE0_SOURCE_CODE -E JUDGE0_MAINTAINER -E JUDGE0_VERSION \
|
239 |
+
-d /etc:noexec \
|
240 |
+
--run \
|
241 |
+
-- /bin/bash $(basename #{run_script}) \
|
242 |
+
< #{stdin_file} > #{stdout_file} 2> #{stderr_file} \
|
243 |
+
"
|
244 |
+
|
245 |
+
puts "[#{DateTime.now}] Running submission #{submission.token} (#{submission.id}):"
|
246 |
+
puts command.gsub(/\s+/, " ")
|
247 |
+
puts
|
248 |
+
|
249 |
+
`#{command}`
|
250 |
+
|
251 |
+
`sudo rm #{run_script}` unless submission.is_project
|
252 |
+
end
|
253 |
+
|
254 |
+
def verify
|
255 |
+
submission.finished_at = DateTime.now
|
256 |
+
|
257 |
+
metadata = get_metadata
|
258 |
+
|
259 |
+
program_stdout = File.read(stdout_file)
|
260 |
+
program_stdout = nil if program_stdout.empty?
|
261 |
+
|
262 |
+
program_stderr = File.read(stderr_file)
|
263 |
+
program_stderr = nil if program_stderr.empty?
|
264 |
+
|
265 |
+
submission.time = metadata[:time]
|
266 |
+
submission.wall_time = metadata[:"time-wall"]
|
267 |
+
submission.memory = (cgroups.present? ? metadata[:"cg-mem"] : metadata[:"max-rss"])
|
268 |
+
submission.stdout = program_stdout
|
269 |
+
submission.stderr = program_stderr
|
270 |
+
submission.exit_code = metadata[:exitcode].try(:to_i) || 0
|
271 |
+
submission.exit_signal = metadata[:exitsig].try(:to_i)
|
272 |
+
submission.message = metadata[:message]
|
273 |
+
submission.status = determine_status(metadata[:status], submission.exit_signal)
|
274 |
+
|
275 |
+
# After adding support for compiler_options and command_line_arguments
|
276 |
+
# status "Exec Format Error" will no longer occur because compile and run
|
277 |
+
# is done inside a dynamically created bash script, thus isolate doesn't call
|
278 |
+
# execve directily on submission.language.compile_cmd or submission.langauge.run_cmd.
|
279 |
+
# Consequence of running compile and run through bash script is that when
|
280 |
+
# target binary is not found then submission gets status "Runtime Error (NZEC)".
|
281 |
+
#
|
282 |
+
# I think this is for now O.K. behaviour, but I will leave this if block
|
283 |
+
# here until I am 100% sure that "Exec Format Error" can be deprecated.
|
284 |
+
if submission.status == Status.boxerr &&
|
285 |
+
(
|
286 |
+
submission.message.to_s.match(/^execve\(.+\): Exec format error$/) ||
|
287 |
+
submission.message.to_s.match(/^execve\(.+\): No such file or directory$/) ||
|
288 |
+
submission.message.to_s.match(/^execve\(.+\): Permission denied$/)
|
289 |
+
)
|
290 |
+
submission.status = Status.exeerr
|
291 |
+
end
|
292 |
+
end
|
293 |
+
|
294 |
+
def cleanup(raise_exception = true)
|
295 |
+
fix_permissions
|
296 |
+
`sudo rm -rf #{boxdir}/* #{tmpdir}/*`
|
297 |
+
[stdin_file, stdout_file, stderr_file, metadata_file].each do |f|
|
298 |
+
`sudo rm -rf #{f}`
|
299 |
+
end
|
300 |
+
`isolate #{cgroups} -b #{box_id} --cleanup`
|
301 |
+
raise "Cleanup of sandbox #{box_id} failed." if raise_exception && Dir.exists?(workdir)
|
302 |
+
end
|
303 |
+
|
304 |
+
def reset_metadata_file
|
305 |
+
`sudo rm -rf #{metadata_file}`
|
306 |
+
initialize_file(metadata_file)
|
307 |
+
end
|
308 |
+
|
309 |
+
def fix_permissions
|
310 |
+
`sudo chown -R $(whoami): #{boxdir}`
|
311 |
+
end
|
312 |
+
|
313 |
+
def call_callback
|
314 |
+
return unless submission.callback_url.present?
|
315 |
+
|
316 |
+
serialized_submission = ActiveModelSerializers::SerializableResource.new(
|
317 |
+
submission,
|
318 |
+
{
|
319 |
+
serializer: SubmissionSerializer,
|
320 |
+
base64_encoded: true,
|
321 |
+
fields: SubmissionSerializer.default_fields
|
322 |
+
}
|
323 |
+
).to_json
|
324 |
+
|
325 |
+
Config::CALLBACKS_MAX_TRIES.times do
|
326 |
+
begin
|
327 |
+
response = HTTParty.put(
|
328 |
+
submission.callback_url,
|
329 |
+
body: serialized_submission,
|
330 |
+
headers: {
|
331 |
+
"Content-Type" => "application/json"
|
332 |
+
},
|
333 |
+
timeout: Config::CALLBACKS_TIMEOUT
|
334 |
+
)
|
335 |
+
break
|
336 |
+
rescue Exception => e
|
337 |
+
end
|
338 |
+
end
|
339 |
+
rescue Exception => e
|
340 |
+
end
|
341 |
+
|
342 |
+
def get_metadata
|
343 |
+
metadata = File.read(metadata_file).split("\n").collect do |e|
|
344 |
+
{ e.split(":").first.to_sym => e.split(":")[1..-1].join(":") }
|
345 |
+
end.reduce({}, :merge)
|
346 |
+
return metadata
|
347 |
+
end
|
348 |
+
|
349 |
+
def determine_status(status, exit_signal)
|
350 |
+
if status == "TO"
|
351 |
+
return Status.tle
|
352 |
+
elsif status == "SG"
|
353 |
+
return Status.find_runtime_error_by_status_code(exit_signal)
|
354 |
+
elsif status == "RE"
|
355 |
+
return Status.nzec
|
356 |
+
elsif status == "XX"
|
357 |
+
return Status.boxerr
|
358 |
+
elsif submission.expected_output.nil? || strip(submission.expected_output) == strip(submission.stdout)
|
359 |
+
return Status.ac
|
360 |
+
else
|
361 |
+
return Status.wa
|
362 |
+
end
|
363 |
+
end
|
364 |
+
|
365 |
+
def strip(text)
|
366 |
+
return nil unless text
|
367 |
+
text.split("\n").collect(&:rstrip).join("\n").rstrip
|
368 |
+
rescue ArgumentError
|
369 |
+
return text
|
370 |
+
end
|
371 |
+
end
|
app/mailers/application_mailer.rb
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class ApplicationMailer < ActionMailer::Base
|
2 |
+
default from: '[email protected]'
|
3 |
+
layout 'mailer'
|
4 |
+
end
|
app/models/application_record.rb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
class ApplicationRecord < ActiveRecord::Base
|
2 |
+
self.abstract_class = true
|
3 |
+
end
|
app/models/concerns/.keep
ADDED
File without changes
|
app/models/language.rb
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# == Schema Information
|
2 |
+
#
|
3 |
+
# Table name: languages
|
4 |
+
#
|
5 |
+
# id :integer not null, primary key
|
6 |
+
# name :string
|
7 |
+
# compile_cmd :string
|
8 |
+
# run_cmd :string
|
9 |
+
# source_file :string
|
10 |
+
# is_archived :boolean default(FALSE)
|
11 |
+
#
|
12 |
+
|
13 |
+
class Language < ApplicationRecord
|
14 |
+
validates :name, presence: true
|
15 |
+
validates :source_file, :run_cmd, presence: true, unless: -> { is_project }
|
16 |
+
default_scope { where(is_archived: false).order(name: :asc) }
|
17 |
+
|
18 |
+
def is_project
|
19 |
+
name == "Multi-file program"
|
20 |
+
end
|
21 |
+
end
|
app/models/submission.rb
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# == Schema Information
|
2 |
+
#
|
3 |
+
# Table name: submissions
|
4 |
+
#
|
5 |
+
# id :integer not null, primary key
|
6 |
+
# source_code :text
|
7 |
+
# language_id :integer
|
8 |
+
# stdin :text
|
9 |
+
# expected_output :text
|
10 |
+
# stdout :text
|
11 |
+
# status_id :integer
|
12 |
+
# created_at :datetime
|
13 |
+
# finished_at :datetime
|
14 |
+
# time :decimal(, )
|
15 |
+
# memory :integer
|
16 |
+
# stderr :text
|
17 |
+
# token :string
|
18 |
+
# number_of_runs :integer
|
19 |
+
# cpu_time_limit :decimal(, )
|
20 |
+
# cpu_extra_time :decimal(, )
|
21 |
+
# wall_time_limit :decimal(, )
|
22 |
+
# memory_limit :integer
|
23 |
+
# stack_limit :integer
|
24 |
+
# max_processes_and_or_threads :integer
|
25 |
+
# enable_per_process_and_thread_time_limit :boolean
|
26 |
+
# enable_per_process_and_thread_memory_limit :boolean
|
27 |
+
# max_file_size :integer
|
28 |
+
# compile_output :text
|
29 |
+
# exit_code :integer
|
30 |
+
# exit_signal :integer
|
31 |
+
# message :text
|
32 |
+
# wall_time :decimal(, )
|
33 |
+
# compiler_options :string
|
34 |
+
# command_line_arguments :string
|
35 |
+
# redirect_stderr_to_stdout :boolean
|
36 |
+
# callback_url :string
|
37 |
+
# additional_files :binary
|
38 |
+
# enable_network :boolean
|
39 |
+
# started_at :datetime
|
40 |
+
# queued_at :datetime
|
41 |
+
# updated_at :datetime
|
42 |
+
# queue_host :string
|
43 |
+
# execution_host :string
|
44 |
+
#
|
45 |
+
|
46 |
+
class Submission < ApplicationRecord
|
47 |
+
validates :source_code, presence: true, unless: -> { is_project }
|
48 |
+
validates :source_code, absence: true, if: -> { is_project }
|
49 |
+
validates :additional_files, presence: true, if: -> { is_project }
|
50 |
+
validates :language_id, presence: true
|
51 |
+
validates :number_of_runs,
|
52 |
+
numericality: { greater_than: 0, less_than_or_equal_to: Config::MAX_NUMBER_OF_RUNS }
|
53 |
+
validates :cpu_time_limit,
|
54 |
+
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: Config::MAX_CPU_TIME_LIMIT }
|
55 |
+
validates :cpu_extra_time,
|
56 |
+
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: Config::MAX_CPU_EXTRA_TIME }
|
57 |
+
validates :wall_time_limit,
|
58 |
+
numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: Config::MAX_WALL_TIME_LIMIT }
|
59 |
+
validates :memory_limit,
|
60 |
+
numericality: { greater_than_or_equal_to: 2048, less_than_or_equal_to: Config::MAX_MEMORY_LIMIT }
|
61 |
+
validates :stack_limit,
|
62 |
+
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: Config::MAX_STACK_LIMIT }
|
63 |
+
validates :max_processes_and_or_threads,
|
64 |
+
numericality: { greater_than: 0, less_than_or_equal_to: Config::MAX_MAX_PROCESSES_AND_OR_THREADS }
|
65 |
+
validates :enable_per_process_and_thread_time_limit,
|
66 |
+
inclusion: { in: [false], message: "this option cannot be enabled" },
|
67 |
+
unless: -> { Config::ALLOW_ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT }
|
68 |
+
validates :enable_per_process_and_thread_memory_limit,
|
69 |
+
inclusion: { in: [false], message: "this option cannot be enabled" },
|
70 |
+
unless: -> { Config::ALLOW_ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT }
|
71 |
+
validates :max_file_size,
|
72 |
+
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: Config::MAX_MAX_FILE_SIZE }
|
73 |
+
validates :compiler_options, length: { maximum: 512 }
|
74 |
+
validates :command_line_arguments, length: { maximum: 512 }
|
75 |
+
validate :language_existence, :compiler_options_allowed,
|
76 |
+
:command_line_arguments_allowed, :callbacks_allowed,
|
77 |
+
:additional_files_allowed, :network_allowed
|
78 |
+
|
79 |
+
before_create :generate_token
|
80 |
+
before_validation :set_defaults
|
81 |
+
|
82 |
+
enumeration :status
|
83 |
+
|
84 |
+
default_scope { order(created_at: :desc) }
|
85 |
+
|
86 |
+
self.per_page = 20
|
87 |
+
|
88 |
+
def source_code
|
89 |
+
@decoded_source_code ||= Base64Service.decode(self[:source_code])
|
90 |
+
end
|
91 |
+
|
92 |
+
def source_code=(value)
|
93 |
+
super(value)
|
94 |
+
self[:source_code] = Base64Service.encode(self[:source_code])
|
95 |
+
end
|
96 |
+
|
97 |
+
|
98 |
+
def stdin
|
99 |
+
@decoded_stdin ||= Base64Service.decode(self[:stdin])
|
100 |
+
end
|
101 |
+
|
102 |
+
def stdin=(value)
|
103 |
+
super(value)
|
104 |
+
self[:stdin] = Base64Service.encode(self[:stdin])
|
105 |
+
end
|
106 |
+
|
107 |
+
|
108 |
+
def stdout
|
109 |
+
@decoded_stdout ||= Base64Service.decode(self[:stdout])
|
110 |
+
end
|
111 |
+
|
112 |
+
def stdout=(value)
|
113 |
+
super(value)
|
114 |
+
self[:stdout] = Base64Service.encode(self[:stdout])
|
115 |
+
end
|
116 |
+
|
117 |
+
|
118 |
+
def expected_output
|
119 |
+
@decoded_expected_output ||= Base64Service.decode(self[:expected_output])
|
120 |
+
end
|
121 |
+
|
122 |
+
def expected_output=(value)
|
123 |
+
super(value)
|
124 |
+
self[:expected_output] = Base64Service.encode(self[:expected_output])
|
125 |
+
end
|
126 |
+
|
127 |
+
|
128 |
+
def stderr
|
129 |
+
@decoded_stderr ||= Base64Service.decode(self[:stderr])
|
130 |
+
end
|
131 |
+
|
132 |
+
def stderr=(value)
|
133 |
+
super(value)
|
134 |
+
self[:stderr] = Base64Service.encode(self[:stderr])
|
135 |
+
end
|
136 |
+
|
137 |
+
|
138 |
+
def compile_output
|
139 |
+
@decoded_compile_output ||= Base64Service.decode(self[:compile_output])
|
140 |
+
end
|
141 |
+
|
142 |
+
def compile_output=(value)
|
143 |
+
super(value)
|
144 |
+
self[:compile_output] = Base64Service.encode(self[:compile_output])
|
145 |
+
end
|
146 |
+
|
147 |
+
|
148 |
+
def language
|
149 |
+
@language ||= Language.unscoped.find_by(id: language_id)
|
150 |
+
end
|
151 |
+
|
152 |
+
|
153 |
+
def status
|
154 |
+
Status.find_by(id: status_id)
|
155 |
+
end
|
156 |
+
|
157 |
+
def status=(status)
|
158 |
+
self.status_id = status.id
|
159 |
+
end
|
160 |
+
|
161 |
+
|
162 |
+
def is_project
|
163 |
+
language.try(:is_project) || false
|
164 |
+
end
|
165 |
+
|
166 |
+
private
|
167 |
+
|
168 |
+
def language_existence
|
169 |
+
if not language
|
170 |
+
errors.add(:language_id, "language with id #{language_id} doesn't exist")
|
171 |
+
elsif language.is_archived
|
172 |
+
errors.add(:language_id, "language with id #{language_id} is archived and cannot be used anymore")
|
173 |
+
end
|
174 |
+
end
|
175 |
+
|
176 |
+
def compiler_options_allowed
|
177 |
+
return if compiler_options.blank?
|
178 |
+
|
179 |
+
unless Config::ENABLE_COMPILER_OPTIONS
|
180 |
+
errors.add(:compiler_options, "setting compiler options is not allowed")
|
181 |
+
return
|
182 |
+
end
|
183 |
+
|
184 |
+
if language && language.compile_cmd.nil?
|
185 |
+
errors.add(:compiler_options, "setting compiler options is only allowed for compiled languages")
|
186 |
+
return
|
187 |
+
end
|
188 |
+
|
189 |
+
@@allowed_languages ||= Config::ALLOWED_LANGUAGES_FOR_COMPILER_OPTIONS.collect{ |s| s + " " }
|
190 |
+
if language && @@allowed_languages.present? && !language.name.starts_with?(*@@allowed_languages)
|
191 |
+
@@allowed_languages_message ||= @@allowed_languages.size > 1 ? @@allowed_languages[0..-2].collect{ |s| s.strip }.join(", ") + " and " + @@allowed_languages[-1].strip : @@allowed_languages[0].strip
|
192 |
+
errors.add(:compiler_options, "setting compiler options is only allowed for #{@@allowed_languages_message}")
|
193 |
+
end
|
194 |
+
end
|
195 |
+
|
196 |
+
def command_line_arguments_allowed
|
197 |
+
return if command_line_arguments.blank?
|
198 |
+
|
199 |
+
unless Config::ENABLE_COMMAND_LINE_ARGUMENTS
|
200 |
+
errors.add(:command_line_arguments, "setting command line arguments is not allowed")
|
201 |
+
end
|
202 |
+
end
|
203 |
+
|
204 |
+
def callbacks_allowed
|
205 |
+
return if callback_url.blank?
|
206 |
+
|
207 |
+
unless Config::ENABLE_CALLBACKS
|
208 |
+
errors.add(:callback_url, "setting callback is not allowed")
|
209 |
+
end
|
210 |
+
end
|
211 |
+
|
212 |
+
def additional_files_allowed
|
213 |
+
return if additional_files.blank?
|
214 |
+
|
215 |
+
unless Config::ENABLE_ADDITIONAL_FILES
|
216 |
+
errors.add(:additional_files, "setting additional files is not allowed")
|
217 |
+
end
|
218 |
+
end
|
219 |
+
|
220 |
+
def network_allowed
|
221 |
+
return if enable_network.blank?
|
222 |
+
|
223 |
+
unless Config::ALLOW_ENABLE_NETWORK
|
224 |
+
errors.add(:enable_network, "enabling network is not allowed")
|
225 |
+
end
|
226 |
+
end
|
227 |
+
|
228 |
+
def generate_token
|
229 |
+
begin
|
230 |
+
self.token = SecureRandom.uuid
|
231 |
+
end while self.class.exists?(token: token)
|
232 |
+
end
|
233 |
+
|
234 |
+
def set_defaults
|
235 |
+
self.status ||= Status.queue
|
236 |
+
self.number_of_runs ||= Config::NUMBER_OF_RUNS
|
237 |
+
self.cpu_time_limit ||= Config::CPU_TIME_LIMIT
|
238 |
+
self.cpu_extra_time ||= Config::CPU_EXTRA_TIME
|
239 |
+
self.wall_time_limit ||= Config::WALL_TIME_LIMIT
|
240 |
+
self.memory_limit ||= Config::MEMORY_LIMIT
|
241 |
+
self.stack_limit ||= Config::STACK_LIMIT
|
242 |
+
self.max_processes_and_or_threads ||= Config::MAX_PROCESSES_AND_OR_THREADS
|
243 |
+
self.enable_per_process_and_thread_time_limit = NilValue.value_or_default(
|
244 |
+
self.enable_per_process_and_thread_time_limit,
|
245 |
+
Config::ENABLE_PER_PROCESS_AND_THREAD_TIME_LIMIT
|
246 |
+
)
|
247 |
+
self.enable_per_process_and_thread_memory_limit = NilValue.value_or_default(
|
248 |
+
self.enable_per_process_and_thread_memory_limit,
|
249 |
+
Config::ENABLE_PER_PROCESS_AND_THREAD_MEMORY_LIMIT
|
250 |
+
)
|
251 |
+
self.max_file_size ||= Config::MAX_FILE_SIZE
|
252 |
+
self.redirect_stderr_to_stdout = NilValue.value_or_default(
|
253 |
+
self.redirect_stderr_to_stdout,
|
254 |
+
Config::REDIRECT_STDERR_TO_STDOUT
|
255 |
+
)
|
256 |
+
self.enable_network = NilValue.value_or_default(
|
257 |
+
self.enable_network,
|
258 |
+
Config::ENABLE_NETWORK
|
259 |
+
)
|
260 |
+
end
|
261 |
+
end
|
app/serializers/language_serializer.rb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
class LanguageSerializer < ActiveModel::Serializer
|
2 |
+
attributes :id, :name, :is_archived, :source_file, :compile_cmd, :run_cmd
|
3 |
+
end
|
app/serializers/status_serializer.rb
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class StatusSerializer < ActiveModel::Serializer
|
2 |
+
attribute(:id) { object.id }
|
3 |
+
attribute(:description) { object.name }
|
4 |
+
end
|
app/serializers/submission_serializer.rb
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class SubmissionSerializer < ActiveModel::Serializer
|
2 |
+
attributes((Submission.column_names + ["status", "language"] - ["id"]).collect(&:to_sym))
|
3 |
+
|
4 |
+
def self.default_fields
|
5 |
+
@@default_fields ||= [
|
6 |
+
:token,
|
7 |
+
:time,
|
8 |
+
:memory,
|
9 |
+
:stdout,
|
10 |
+
:stderr,
|
11 |
+
:compile_output,
|
12 |
+
:message,
|
13 |
+
:status
|
14 |
+
]
|
15 |
+
end
|
16 |
+
|
17 |
+
def source_code
|
18 |
+
object_decoder(:source_code)
|
19 |
+
end
|
20 |
+
|
21 |
+
def stdin
|
22 |
+
object_decoder(:stdin)
|
23 |
+
end
|
24 |
+
|
25 |
+
def expected_output
|
26 |
+
object_decoder(:expected_output)
|
27 |
+
end
|
28 |
+
|
29 |
+
def stdout
|
30 |
+
object_decoder(:stdout)
|
31 |
+
end
|
32 |
+
|
33 |
+
def stderr
|
34 |
+
object_decoder(:stderr)
|
35 |
+
end
|
36 |
+
|
37 |
+
def compile_output
|
38 |
+
object_decoder(:compile_output)
|
39 |
+
end
|
40 |
+
|
41 |
+
def message
|
42 |
+
if instance_options[:base64_encoded] and object.message
|
43 |
+
return Base64Service.encode(object.message)
|
44 |
+
end
|
45 |
+
object.message
|
46 |
+
end
|
47 |
+
|
48 |
+
def status
|
49 |
+
{ id: object.status_id, description: object.status.name }
|
50 |
+
end
|
51 |
+
|
52 |
+
def language
|
53 |
+
ActiveModelSerializers::SerializableResource.new(object.language, { serializer: LanguageSerializer, fields: [:id, :name] })
|
54 |
+
end
|
55 |
+
|
56 |
+
def additional_files
|
57 |
+
Base64Service.encode(object.additional_files)
|
58 |
+
end
|
59 |
+
|
60 |
+
private
|
61 |
+
|
62 |
+
def object_decoder(method)
|
63 |
+
instance_options[:base64_encoded] ? object[method] : object.send(method)
|
64 |
+
end
|
65 |
+
end
|
app/services/base64_service.rb
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module Base64Service
|
2 |
+
def self.encode(text)
|
3 |
+
return nil unless text
|
4 |
+
Base64.encode64(text)
|
5 |
+
end
|
6 |
+
|
7 |
+
def self.decode(text)
|
8 |
+
return nil unless text
|
9 |
+
Base64.decode64(text) #.force_encoding("UTF-8").encode
|
10 |
+
end
|
11 |
+
end
|
app/services/fields/submission.rb
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module Fields
|
2 |
+
class Submission
|
3 |
+
UNIVERSAL_FIELD = :*
|
4 |
+
|
5 |
+
attr_reader :requested_fields, :invalid_fields
|
6 |
+
|
7 |
+
def initialize(fields)
|
8 |
+
@invalid_fields = []
|
9 |
+
|
10 |
+
fields = fields.to_s.split(",").collect(&:to_sym)
|
11 |
+
|
12 |
+
fields.each do |field|
|
13 |
+
if field != UNIVERSAL_FIELD && !available_fields.include?(field)
|
14 |
+
@invalid_fields << field
|
15 |
+
end
|
16 |
+
end
|
17 |
+
|
18 |
+
if fields.include?(UNIVERSAL_FIELD)
|
19 |
+
@requested_fields = available_fields
|
20 |
+
else
|
21 |
+
@requested_fields = (fields - @invalid_fields).presence || default_fields
|
22 |
+
end
|
23 |
+
end
|
24 |
+
|
25 |
+
def has_invalid_fields?
|
26 |
+
!@invalid_fields.empty?
|
27 |
+
end
|
28 |
+
|
29 |
+
def available_fields
|
30 |
+
serializer._attributes
|
31 |
+
end
|
32 |
+
|
33 |
+
def default_fields
|
34 |
+
serializer.default_fields
|
35 |
+
end
|
36 |
+
|
37 |
+
def serializer
|
38 |
+
SubmissionSerializer
|
39 |
+
end
|
40 |
+
end
|
41 |
+
end
|
app/views/layouts/mailer.html.erb
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5 |
+
<style>
|
6 |
+
/* Email styles need to be inline */
|
7 |
+
</style>
|
8 |
+
</head>
|
9 |
+
|
10 |
+
<body>
|
11 |
+
<%= yield %>
|
12 |
+
</body>
|
13 |
+
</html>
|
app/views/layouts/mailer.text.erb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<%= yield %>
|
bin/bundle
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
3 |
+
load Gem.bin_path('bundler', 'bundle')
|
bin/rails
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
begin
|
3 |
+
load File.expand_path('../spring', __FILE__)
|
4 |
+
rescue LoadError => e
|
5 |
+
raise unless e.message.include?('spring')
|
6 |
+
end
|
7 |
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
8 |
+
require_relative '../config/boot'
|
9 |
+
require 'rails/commands'
|
bin/rake
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
begin
|
3 |
+
load File.expand_path('../spring', __FILE__)
|
4 |
+
rescue LoadError => e
|
5 |
+
raise unless e.message.include?('spring')
|
6 |
+
end
|
7 |
+
require_relative '../config/boot'
|
8 |
+
require 'rake'
|
9 |
+
Rake.application.run
|
bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
require 'pathname'
|
3 |
+
require 'fileutils'
|
4 |
+
include FileUtils
|
5 |
+
|
6 |
+
# path to your application root.
|
7 |
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8 |
+
|
9 |
+
def system!(*args)
|
10 |
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11 |
+
end
|
12 |
+
|
13 |
+
chdir APP_ROOT do
|
14 |
+
# This script is a starting point to setup your application.
|
15 |
+
# Add necessary setup steps to this file.
|
16 |
+
|
17 |
+
puts '== Installing dependencies =='
|
18 |
+
system! 'gem install bundler --conservative'
|
19 |
+
system('bundle check') || system!('bundle install')
|
20 |
+
|
21 |
+
# puts "\n== Copying sample files =="
|
22 |
+
# unless File.exist?('config/database.yml')
|
23 |
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24 |
+
# end
|
25 |
+
|
26 |
+
puts "\n== Preparing database =="
|
27 |
+
system! 'bin/rails db:setup'
|
28 |
+
|
29 |
+
puts "\n== Removing old logs and tempfiles =="
|
30 |
+
system! 'bin/rails log:clear tmp:clear'
|
31 |
+
|
32 |
+
puts "\n== Restarting application server =="
|
33 |
+
system! 'bin/rails restart'
|
34 |
+
end
|
bin/spring
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
|
3 |
+
# This file loads spring without using Bundler, in order to be fast.
|
4 |
+
# It gets overwritten when you run the `spring binstub` command.
|
5 |
+
|
6 |
+
unless defined?(Spring)
|
7 |
+
require 'rubygems'
|
8 |
+
require 'bundler'
|
9 |
+
|
10 |
+
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
|
11 |
+
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
|
12 |
+
gem 'spring', match[1]
|
13 |
+
require 'spring/binstub'
|
14 |
+
end
|
15 |
+
end
|
bin/telemetry
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:35ae04b727c002b3b95ded0fc9f5009e4d8cc64696f5ab7875efebf0a7fd9fbd
|
3 |
+
size 2499264
|
bin/update
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env ruby
|
2 |
+
require 'pathname'
|
3 |
+
require 'fileutils'
|
4 |
+
include FileUtils
|
5 |
+
|
6 |
+
# path to your application root.
|
7 |
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8 |
+
|
9 |
+
def system!(*args)
|
10 |
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11 |
+
end
|
12 |
+
|
13 |
+
chdir APP_ROOT do
|
14 |
+
# This script is a way to update your development environment automatically.
|
15 |
+
# Add necessary update steps to this file.
|
16 |
+
|
17 |
+
puts '== Installing dependencies =='
|
18 |
+
system! 'gem install bundler --conservative'
|
19 |
+
system('bundle check') || system!('bundle install')
|
20 |
+
|
21 |
+
puts "\n== Updating database =="
|
22 |
+
system! 'bin/rails db:migrate'
|
23 |
+
|
24 |
+
puts "\n== Removing old logs and tempfiles =="
|
25 |
+
system! 'bin/rails log:clear tmp:clear'
|
26 |
+
|
27 |
+
puts "\n== Restarting application server =="
|
28 |
+
system! 'bin/rails restart'
|
29 |
+
end
|