update deploy

This commit is contained in:
virusdefender 2017-06-14 15:59:22 +08:00
parent b1793d29a2
commit 4054dfa41c
8 changed files with 70 additions and 16 deletions

1
.gitignore vendored
View File

@ -68,4 +68,3 @@ custom_settings.py
docker-compose.yml
*.zip
rsyncd.passwd
oj.conf

View File

@ -7,5 +7,4 @@ ADD . /code
WORKDIR /code
RUN pip install -i https://pypi.douban.com/simple -r dockerfiles/oj_web_server/requirements.txt
RUN python tools/release_static.py
EXPOSE 80
CMD bash /code/dockerfiles/oj_web_server/run.sh

View File

@ -0,0 +1,56 @@
worker_processes 1;
user www-data;
error_log /dev/stderr warn;
daemon off;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# access_log /dev/stdout main;
access_log off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_types application/javascript text/css;
upstream backend {
server 127.0.0.1:8080;
keepalive 32;
}
server {
listen 80 default_server;
server_name _;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
client_max_body_size 200M;
location /static/upload {
expires max;
alias /code/upload;
}
location /static {
etag off;
expires max;
alias /code/static/release;
}
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
}
}
}

View File

@ -2,7 +2,7 @@ django==1.9.6
MySQL-python
redis
django-redis-sessions
djangorestframework
djangorestframework==3.2.5
django-rest-swagger
gunicorn
coverage

View File

@ -6,7 +6,7 @@ from .models import JudgeServer
class CreateJudgesSerializer(serializers.Serializer):
name = serializers.CharField(max_length=30)
ip = serializers.IPAddressField()
ip = serializers.CharField(max_length=128)
port = serializers.IntegerField()
# 这个服务器最大可能运行的判题实例数量
max_instance_number = serializers.IntegerField()
@ -16,7 +16,7 @@ class CreateJudgesSerializer(serializers.Serializer):
class EditJudgesSerializer(serializers.Serializer):
id = serializers.IntegerField()
name = serializers.CharField(max_length=30)
ip = serializers.IPAddressField()
ip = serializers.CharField(max_length=128)
port = serializers.IntegerField()
# 这个服务器最大可能运行的判题实例数量
max_instance_number = serializers.IntegerField()

View File

@ -47,8 +47,8 @@
</div>
<div class="col-md-4">
<div class="form-group">
<label>IP</label>
<input name="ip" type="text" class="form-control" ms-duplex="ipAddress" placeholder="IP" required data-error="请填写合法的IP地址">
<label>地址</label>
<input name="ip" type="text" class="form-control" ms-duplex="ipAddress" placeholder="IP 或域名" required data-error="请填写合法的地址">
<div class="help-block with-errors"></div>
</div>
</div>
@ -100,8 +100,8 @@
</div>
<div class="col-md-4">
<div class="form-group">
<label>IP</label>
<input name="ip" type="text" class="form-control" id="ipAddress" placeholder="IP" required data-error="请填写合法的IP地址">
<label>地址</label>
<input name="ip" type="text" class="form-control" id="ipAddress" placeholder="IP 或域名" required data-error="请填写合法的地址">
<div class="help-block with-errors"></div>
</div>
</div>

View File

@ -2,13 +2,13 @@
<label>选择语言</label>
<div>
<label class="radio-inline">
<input type="radio" name="language" value="1" checked> C (GCC 4.8)
<input type="radio" name="language" value="1" checked> C (GCC 5.4)
</label>
<label class="radio-inline">
<input type="radio" name="language" value="2"> C++ (G++ 4.3)
<input type="radio" name="language" value="2"> C++ (G++ 5.4)
</label>
<label class="radio-inline">
<input type="radio" name="language" value="3"> Java (Oracle JDK 1.7)
<input type="radio" name="language" value="3"> Java (Oracle JDK 1.8)
</label>
</div>
</div>
@ -22,4 +22,4 @@
提交代码
</button>
<img src="/static/img/loading.gif" id="loading-gif">
</div>
</div>

View File

@ -25,11 +25,11 @@
<h4>编译参数</h4>
<ul>
<li>CGCC 4.8</li>
<li>CGCC 5.4</li>
<pre>gcc -DONLINE_JUDGE -O2 -w -std=c99 {src_path} -lm -o {exe_path}main</pre>
<li>C++G++ 4.3</li>
<li>C++G++ 5.4</li>
<pre>g++ -DONLINE_JUDGE -O2 -w -std=c++11 {src_path} -lm -o {exe_path}main</pre>
<li>JavaOracle JDK 1.7</li>
<li>JavaOracle JDK 1.8</li>
<pre>
//编译
javac {src_path} -d {exe_path}