Skip to content

Commit f0a79d0

Browse files
committed
edit for muti contest
1 parent a43487d commit f0a79d0

File tree

15 files changed

+1706
-13
lines changed

15 files changed

+1706
-13
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2828
libpq-dev
2929
libyaml-dev
3030
mono-mcs
31+
nginx
32+
nano
3133
php-cli
3234
postgresql-client
3335
pypy3

config-data/cms-devdb.toml

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
[global]
2+
# Whether to have a backdoor (see doc for the risks).
3+
backdoor = false
4+
# Whether to print debug-level messages into the per-service log file.
5+
file_log_debug = false
6+
# Whether to print more detailed logs on stdout.
7+
# The detailed log contains the thread name, file and function name, in
8+
# addition to the operation, if present.
9+
stream_log_detailed = false
10+
11+
# Directories used by CMS. The default values are shown in the comments,
12+
# with INSTALL_DIR representing the path of the virtual env that CMS was
13+
# installed into.
14+
# Short-lived temporary files.
15+
temp_dir = "/tmp"
16+
# Log files.
17+
#log_dir = "INSTALL_DIR/log"
18+
# Cached files.
19+
#cache_dir = "INSTALL_DIR/cache"
20+
# Miscellaneous files generated by CMS.
21+
#data_dir = "INSTALL_DIR/lib"
22+
# Run-time data (e.g. socket files).
23+
#run_dir = "INSTALL_DIR/run"
24+
25+
[services]
26+
# Each service has some number of shards, defined in this table. For
27+
# most services, it only makes sense to have one shard, but there should
28+
# be one ResourceService per host, and it's possible to have muliple
29+
# Workers and ContestWebServers.
30+
31+
# For each shard of a service, the first element of the list specifies
32+
# the hostname it will run on, and the second one its port for RPC
33+
# communication with the rest of CMS. Each ResourceService will manage
34+
# services with the same hostname. If you run services on different
35+
# hosts, make sure they can connect to each other using the specified
36+
# hostnames and ports.
37+
38+
LogService = [["localhost", 29000]]
39+
ResourceService = [["localhost", 28000]]
40+
ScoringService = [["localhost", 28500]]
41+
Checker = [["localhost", 22000]]
42+
EvaluationService = [
43+
["localhost", 25000],
44+
["localhost", 25001],
45+
["localhost", 25002],
46+
["localhost", 25003],
47+
["localhost", 25004],
48+
["localhost", 25005],
49+
["localhost", 25006],
50+
["localhost", 25007],
51+
["localhost", 25008],
52+
["localhost", 25009]
53+
]
54+
Worker = [
55+
["localhost", 26000],
56+
["localhost", 26001],
57+
["localhost", 26002],
58+
["localhost", 26003],
59+
["localhost", 26004],
60+
["localhost", 26005],
61+
["localhost", 26006],
62+
["localhost", 26007],
63+
["localhost", 26008],
64+
["localhost", 26009],
65+
["localhost", 26010],
66+
["localhost", 26011],
67+
["localhost", 26012],
68+
["localhost", 26013],
69+
["localhost", 26014],
70+
["localhost", 26015],
71+
]
72+
ContestWebServer = [
73+
["localhost", 21000],
74+
["localhost", 21001],
75+
["localhost", 21002],
76+
["localhost", 21003],
77+
["localhost", 21004],
78+
["localhost", 21005],
79+
["localhost", 21006],
80+
["localhost", 21007],
81+
["localhost", 21008],
82+
["localhost", 21009]
83+
]
84+
AdminWebServer = [["localhost", 21100]]
85+
ProxyService = [
86+
["localhost", 28600],
87+
["localhost", 28601],
88+
["localhost", 28602],
89+
["localhost", 28603],
90+
["localhost", 28604],
91+
["localhost", 28605],
92+
["localhost", 28606],
93+
["localhost", 28607],
94+
["localhost", 28608],
95+
["localhost", 28609],
96+
]
97+
PrintingService = [["localhost", 25123]]
98+
PrometheusExporter = []
99+
TelegramBot = []
100+
101+
102+
[database]
103+
# Connection string for the database.
104+
url = "postgresql+psycopg2://postgres@devdb:5432/cmsdb"
105+
106+
# Whether SQLAlchemy prints DB queries on stdout.
107+
debug = false
108+
109+
# Whether to use two-phase commit.
110+
twophase_commit = false
111+
112+
113+
[worker]
114+
# Don't delete the sandbox directory under /tmp/ when they are not
115+
# needed anymore. Warning: this can easily eat GB of space very soon.
116+
keep_sandbox = false
117+
118+
119+
[sandbox]
120+
# Which sandbox implementation to use. Currently only isolate is
121+
# supported.
122+
sandbox_implementation = "isolate"
123+
# Do not allow contestants' solutions to write files bigger than this
124+
# size (expressed in KB; defaults to 1 GB).
125+
max_file_size = 1_048_576
126+
127+
# Max processes, CPU time (s), memory (KiB) for compilation runs.
128+
compilation_sandbox_max_processes = 1000
129+
compilation_sandbox_max_time_s = 10.0
130+
compilation_sandbox_max_memory_kib = 524_288 # 512 MiB
131+
# Max processes, CPU time (s), memory (KiB) for trusted (e.g. checker)
132+
# runs.
133+
trusted_sandbox_max_processes = 1000
134+
trusted_sandbox_max_time_s = 10.0
135+
trusted_sandbox_max_memory_kib = 4_194_304 # 4 GiB
136+
137+
138+
[web_server]
139+
# This key is used to encode information that can be seen by the user,
140+
# namely cookies and auto-incremented numbers. It should be changed for
141+
# each contest. Particularly, you should not use this example for other
142+
# than testing. It must be a 16 bytes long hexadecimal number. You can
143+
# easily create a key calling:
144+
# python -c 'from cmscommon import crypto; print(crypto.get_hex_random_key())'
145+
secret_key = "8e045a51e4b102ea803c06f92841a1fb"
146+
147+
# Whether Tornado prints debug information on stdout.
148+
tornado_debug = false
149+
150+
151+
[contest_web_server]
152+
# Listening HTTP addresses and ports for the CWSs listed above in
153+
# [services]. By default only listens on localhost, meaning you need a
154+
# separate reverse proxy to access it from the web. Set to empty string
155+
# to allow connecting from anywhere.
156+
listen_address = [
157+
"127.0.0.1",
158+
"127.0.0.1",
159+
"127.0.0.1",
160+
"127.0.0.1",
161+
"127.0.0.1",
162+
"127.0.0.1",
163+
"127.0.0.1",
164+
"127.0.0.1",
165+
"127.0.0.1",
166+
"127.0.0.1"
167+
]
168+
listen_port = [9501, 9502, 9503, 9504, 9505, 9506, 9507, 9508, 9509, 9510]
169+
170+
# Login cookie duration in seconds. The duration is refreshed on every
171+
# manual request.
172+
cookie_duration = 10800
173+
174+
# The number of proxies that will be crossed before CWSs get the
175+
# request. This is used to decide whether to assume that the real source
176+
# IP address is the one listed in the request headers or not. For
177+
# example, if you're using nginx as a load balancer, you will likely
178+
# want to set this value to 1.
179+
num_proxies_used = 0
180+
181+
# If CWSs write submissions to disk before storing them in the DB, and
182+
# where to save them. %s = DATA_DIR.
183+
submit_local_copy = true
184+
submit_local_copy_path = "%s/submissions/"
185+
# Same for user tests.
186+
tests_local_copy = true
187+
tests_local_copy_path = "%s/tests/"
188+
189+
# Maximum size of a submission in bytes. If you use a proxy and set
190+
# these sizes to large values remember to change client_max_body_size in
191+
# nginx.conf too.
192+
max_submission_length = 100_000
193+
# Maximum size of an input file for an user test.
194+
max_input_length = 5_000_000
195+
196+
# Path to the documentation exposed by CWS. To show a documentation link
197+
# add a folder for each language with index.html inside. For example for
198+
# C++ add 'cpp/index.html', for Java 'java/index.html'.
199+
docs_path = "/usr/share/cms/docs"
200+
201+
# An authentication token that can be used by the administrator to
202+
# impersonate an arbitrary user and bypass submit restrictions.
203+
#contest_admin_token = "CHANGE-ME"
204+
205+
206+
[admin_web_server]
207+
# Listening HTTP address and port for the AWS. By default only listens
208+
# on localhost, meaning you need a separate reverse proxy to access it
209+
# from the web. Set to empty string to allow connecting from anywhere.
210+
listen_address = "0.0.0.0"
211+
listen_port = 8889
212+
213+
# Login cookie duration for admins in seconds.
214+
# The duration is refreshed on every manual request.
215+
cookie_duration = 36000
216+
217+
# The number of proxies that will be crossed before AWS gets
218+
# the request. This is used to determine the request's real
219+
# source IP address. For example, if you're using nginx as
220+
# a proxy, you will likely want to set this value to 1.
221+
num_proxies_used = 0
222+
223+
224+
[proxy_service]
225+
# List of URLs (with embedded username and password) of the RWSs where
226+
# the scores are to be sent. Don't include the load balancing proxy (if
227+
# any), just the backends.
228+
rankings = ["http://usern4me:passw0rd@localhost:8890/"]
229+
# If any ranking uses HTTPS, specify a file with the certificates you
230+
# trust. (this string is passed as the "verify" option to requests.put,
231+
# see the documentation of requests for more info.)
232+
#https_certfile = "..."
233+
234+
235+
[printing]
236+
# Maximum size of a print job in bytes.
237+
max_print_length = 10_000_000
238+
239+
# Printer name (can be found out using 'lpstat -p'; if missing, printing
240+
# is disabled)
241+
#printer = "..."
242+
243+
# Output paper size (probably A4 or Letter)
244+
paper_size = "A4"
245+
246+
# Maximum number of pages a user can print per print job (excluding the
247+
# title page). Text files are cropped to this length. Too long pdf files
248+
# are rejected.
249+
max_pages_per_job = 10
250+
max_jobs_per_user = 10
251+
pdf_printing_allowed = false
252+
253+
254+
[prometheus]
255+
# Listening HTTP address and port for the exporter. If exposed this may
256+
# leak private information, make sure to secure this endpoint.
257+
listen_address = "0.0.0.0"
258+
listen_port = 8811
259+
260+
261+
# Bot token and chat ID for the telegram bot. The Telegram bot will sync
262+
# all questions with this chat, if present.
263+
#[telegram_bot]
264+
#bot_token = "..."
265+
#chat_id = "..."
266+
267+

0 commit comments

Comments
 (0)