mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 15:28:41 +00:00
style(web,install): change judge_client work path
When move out judger from bundle, no need to create judger account. So these work paths will no longer exist. Prepare for future.
This commit is contained in:
parent
2156cdffef
commit
6cd6f10f6e
@ -16,7 +16,7 @@ fi\n\
|
|||||||
service ntp start\n\
|
service ntp start\n\
|
||||||
service mysql start\n\
|
service mysql start\n\
|
||||||
service apache2 start\n\
|
service apache2 start\n\
|
||||||
su local_main_judger -c \"~/judge_client/judge_client start\"\n\
|
su local_main_judger -c \"/opt/UOJ-System/judger/judge_client start\"\n\
|
||||||
exec bash\n" >/root/up && chmod +x /root/up
|
exec bash\n" >/root/up && chmod +x /root/up
|
||||||
|
|
||||||
ENV LANG=C.UTF-8 TZ=Asia/Shanghai
|
ENV LANG=C.UTF-8 TZ=Asia/Shanghai
|
||||||
|
@ -58,7 +58,7 @@ setLAMPConf(){
|
|||||||
XSendFile On
|
XSendFile On
|
||||||
XSendFilePath /var/uoj_data
|
XSendFilePath /var/uoj_data
|
||||||
XSendFilePath /var/www/uoj/app/storage
|
XSendFilePath /var/www/uoj/app/storage
|
||||||
XSendFilePath /home/local_main_judger/judge_client/uoj_judger/include
|
XSendFilePath /opt/UOJ-System/judger/uoj_judger/include
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
UOJEOF
|
UOJEOF
|
||||||
#Enable modules and make UOJ site conf enabled
|
#Enable modules and make UOJ site conf enabled
|
||||||
@ -106,23 +106,23 @@ setJudgeConf(){
|
|||||||
chown -R www-data /var/uoj_data && chgrp -R www-data /var/uoj_data
|
chown -R www-data /var/uoj_data && chgrp -R www-data /var/uoj_data
|
||||||
#Compile judge_client and set runtime
|
#Compile judge_client and set runtime
|
||||||
su local_main_judger <<EOD
|
su local_main_judger <<EOD
|
||||||
cp -r ../../judge_client/1 ~/judge_client
|
cp -r ../../judge_client/1 /opt/UOJ-System/judger
|
||||||
ln -s /var/uoj_data ~/judge_client/uoj_judger/data
|
ln -s /var/uoj_data /opt/UOJ-System/judger/uoj_judger/data
|
||||||
cd ~/judge_client && chmod +x judge_client
|
cd /opt/UOJ-System/judger && chmod +x judge_client
|
||||||
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
|
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
|
||||||
#define UOJ_WORK_PATH "/home/local_main_judger/judge_client/uoj_judger"
|
#define UOJ_WORK_PATH "/opt/UOJ-System/judger/uoj_judger"
|
||||||
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
|
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
|
||||||
#define UOJ_JUDGER_PYTHON3_VERSION "3.6"
|
#define UOJ_JUDGER_PYTHON3_VERSION "3.6"
|
||||||
#define UOJ_JUDGER_FPC_VERSION "3.0.4"
|
#define UOJ_JUDGER_FPC_VERSION "3.0.4"
|
||||||
UOJEOF
|
UOJEOF
|
||||||
cd uoj_judger && make -j$(($(grep -c ^processor /proc/cpuinfo) + 1))
|
cd uoj_judger && make -j$(($(grep -c ^processor /proc/cpuinfo) + 1))
|
||||||
mkdir ~/judge_client/uoj_judger/run/runtime && cd ~/judge_client/uoj_judger/run/runtime
|
mkdir /opt/UOJ-System/judger/uoj_judger/run/runtime && cd /opt/UOJ-System/judger/uoj_judger/run/runtime
|
||||||
mv ~/jdkdist.list ~/jdk-*-linux-x64.tar.gz .
|
mv ~/jdkdist.list ~/jdk-*-linux-x64.tar.gz .
|
||||||
tar -xzf jdk-7*-linux-x64.tar.gz && tar -xzf jdk-8*-linux-x64.tar.gz
|
tar -xzf jdk-7*-linux-x64.tar.gz && tar -xzf jdk-8*-linux-x64.tar.gz
|
||||||
mv jdk1.7* jdk1.7.0 && mv jdk1.8* jdk1.8.0
|
mv jdk1.7* jdk1.7.0 && mv jdk1.8* jdk1.8.0
|
||||||
EOD
|
EOD
|
||||||
#Set judge_client config file
|
#Set judge_client config file
|
||||||
cat >/home/local_main_judger/judge_client/.conf.json <<UOJEOF
|
cat >/opt/UOJ-System/judger/.conf.json <<UOJEOF
|
||||||
{
|
{
|
||||||
"uoj_protocol": "http",
|
"uoj_protocol": "http",
|
||||||
"uoj_host": "127.0.0.1",
|
"uoj_host": "127.0.0.1",
|
||||||
@ -132,14 +132,14 @@ EOD
|
|||||||
"socket_password": "_judger_socket_password_"
|
"socket_password": "_judger_socket_password_"
|
||||||
}
|
}
|
||||||
UOJEOF
|
UOJEOF
|
||||||
chmod 600 /home/local_main_judger/judge_client/.conf.json
|
chmod 600 /opt/UOJ-System/judger/.conf.json
|
||||||
chown local_main_judger /home/local_main_judger/judge_client/.conf.json
|
chown local_main_judger /opt/UOJ-System/judger/.conf.json
|
||||||
}
|
}
|
||||||
|
|
||||||
initProgress(){
|
initProgress(){
|
||||||
printf "\n\n==> Doing initial config and start service\n"
|
printf "\n\n==> Doing initial config and start service\n"
|
||||||
#Replace password placeholders
|
#Replace password placeholders
|
||||||
sed -i -e "s/_main_judger_password_/$_main_judger_password_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /home/local_main_judger/judge_client/.conf.json
|
sed -i -e "s/_main_judger_password_/$_main_judger_password_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /opt/UOJ-System/judger/.conf.json
|
||||||
sed -i -e "s/salt0/$(genRandStr 32)/g" -e "s/salt1/$(genRandStr 16)/g" -e "s/salt2/$(genRandStr 16)/g" -e "s/salt3/$(genRandStr 16)/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php
|
sed -i -e "s/salt0/$(genRandStr 32)/g" -e "s/salt1/$(genRandStr 16)/g" -e "s/salt2/$(genRandStr 16)/g" -e "s/salt3/$(genRandStr 16)/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php
|
||||||
#Import judge_client to MySQL database
|
#Import judge_client to MySQL database
|
||||||
service mysql start
|
service mysql start
|
||||||
@ -150,7 +150,7 @@ initProgress(){
|
|||||||
service ntp restart
|
service ntp restart
|
||||||
service mysql restart
|
service mysql restart
|
||||||
service apache2 restart
|
service apache2 restart
|
||||||
su local_main_judger -c '~/judge_client/judge_client start'
|
su local_main_judger -c '/opt/UOJ-System/judger/judge_client start'
|
||||||
#Touch SetupDone flag file
|
#Touch SetupDone flag file
|
||||||
printf "\n\n***Installation complete. Enjoy!***\n"
|
printf "\n\n***Installation complete. Enjoy!***\n"
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
$download_name = "problem_$id.zip";
|
$download_name = "problem_$id.zip";
|
||||||
break;
|
break;
|
||||||
case 'testlib.h':
|
case 'testlib.h':
|
||||||
$file_name = "/home/local_main_judger/judge_client/uoj_judger/include/testlib.h";
|
$file_name = "/opt/UOJ-System/judger/uoj_judger/include/testlib.h";
|
||||||
$download_name = "testlib.h";
|
$download_name = "testlib.h";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
global $uojSupportedLanguages, $uojMainJudgerWorkPath;
|
global $uojSupportedLanguages, $uojMainJudgerWorkPath;
|
||||||
$uojSupportedLanguages = array('C', 'C++', 'C++11', 'Java8', 'Java11', 'Pascal', 'Python2', 'Python3');
|
$uojSupportedLanguages = array('C', 'C++', 'C++11', 'Java8', 'Java11', 'Pascal', 'Python2', 'Python3');
|
||||||
$uojMainJudgerWorkPath = "/home/local_main_judger/judge_client/uoj_judger";
|
$uojMainJudgerWorkPath = "/opt/UOJ-System/judger/uoj_judger";
|
||||||
|
|
||||||
function authenticateJudger() {
|
function authenticateJudger() {
|
||||||
if (!is_string($_POST['judger_name']) || !is_string($_POST['password'])) {
|
if (!is_string($_POST['judger_name']) || !is_string($_POST['password'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user