2016-10-10 12:22:49 +00:00
|
|
|
# Deploy
|
|
|
|
|
2016-10-10 12:21:44 +00:00
|
|
|
Reuqirements:
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2016-10-10 12:21:44 +00:00
|
|
|
- docker >= 1.12
|
|
|
|
- docker-compose >= 1.8
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2016-10-29 08:55:03 +00:00
|
|
|
Docker images:
|
|
|
|
|
2017-12-06 04:02:01 +00:00
|
|
|
- docker pull registry.cn-hangzhou.aliyuncs.com/onlinejudge/judge_server
|
2016-10-29 08:55:03 +00:00
|
|
|
|
|
|
|
Three environment variables below must be set manually in `docker-compose.yml`
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2017-12-06 04:02:01 +00:00
|
|
|
- `SERVICE_URL`
|
|
|
|
- `BACKEND_URL`
|
|
|
|
- `TOKEN`
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2017-12-06 04:02:01 +00:00
|
|
|
`judge_server` will send heartbeat request to `backend_url` every five seconds.
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2016-10-10 12:21:44 +00:00
|
|
|
`service_url` is used to tell server to send task to this url(`judge_server`).
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2016-10-07 12:41:27 +00:00
|
|
|
# Heartbeat request
|
2016-10-05 05:46:57 +00:00
|
|
|
|
2016-10-18 02:16:40 +00:00
|
|
|
- `Method`: `POST`
|
2017-12-06 04:02:01 +00:00
|
|
|
- `X-JUDGE-SERVER-TOKEN`: `sha256(token).hex`
|
2016-10-10 12:21:44 +00:00
|
|
|
- `Content-Type`: `application/json`
|
2016-10-05 05:46:57 +00:00
|
|
|
|
|
|
|
Request data
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
"judger_version": "2.0.1",
|
|
|
|
"hostname": "c45acd557074",
|
2016-10-22 13:37:21 +00:00
|
|
|
"running_task_number": 2,
|
2016-10-05 05:46:57 +00:00
|
|
|
"cpu_core": 1,
|
|
|
|
"memory": 30.3,
|
|
|
|
"action": "heartbeat",
|
|
|
|
"cpu": 0,
|
|
|
|
"service_url": null or "http://1.2.3.4:8005"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
If everything is OK, you should give a JSON response as follows
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
"data": "success",
|
2017-12-21 16:41:48 +00:00
|
|
|
"error": null
|
2016-10-05 05:46:57 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|