# SOJ-FrontEnd
**Repository Path**: sunist/soj-front-end
## Basic Information
- **Project Name**: SOJ-FrontEnd
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: AGPL-3.0
- **Default Branch**: build
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2020-12-06
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
SOJ: SWU-ACMOJ
SOJ是西南大学ACM实验室维护的开源在线测评系统。
本项目基于[LibreOJ](https://loj.ac)开发,定制化了前端。

# 安装部署 #
## 1. ~~mkdir~~ 环境配置 ##
> 本文档使用环境为腾讯云轻量应用服务器 `Ubuntu 18.04 Server`
**Note: 开始前,请确认您的系统为纯净系统**
需要安装下面的东西:
- [ ] bt面板(可选)
安装这玩意只是为了解放我们的双手,配置数据库与反向代理等,非必选
> 建议访问[宝塔面板Linux版](https://www.bt.cn/download/linux.html)获取最新的安装脚本。
执行(仅限`Ubuntu`)下面的语句:
```console
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
```
然后使用`sudo bt`选取相应的命令来配置您的面板
- [x] nvm + node
我们使用`nvm`来控制`node`的版本,您也可以自行安装`node 10+`
```console
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh
sudo bash install.sh
```
> 如果`curl`失败了,请自行访问该脚本并复制粘贴到目录下的`install.sh`
再执行`sudo bash install.sh`
然后我们使用`nvm`安装`node`:
```console
nvm install 10
```
> 如果没有找到nvm命令,您可以`reboot`再试一次
然后我们将`node`版本切换到10:
```console
nvm use 10
```
- [x] yarn/npm
我们需要使用`yarn`来部署我们的程序,也可以用`npm`来代替。
> `apt`默认的`yarn`版本是`0.22`,不足以满足我们的需求
下面我们来安装 1.22版本的`yarn`
```console
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
```
- [x] 7zip
这玩意用来处理我们上传的压缩文件
```console
apt install p7zip-full
```
- [x] clang-format
这玩意用来格式化代码,让代码提交页面变好康
```console
apt install clang-format
```
- [x] pygmentize
//todo 我也不知道这玩意拿来干啥的
```console
apt-get install python3-pip
python3 -m pip install -U pygame --user
```
- [x] MariaDB
这玩意是数据库,我们直接在宝塔里安装,版本为`10.3`,装完自己搞到`root`密码就行了
- [ ] Nginx(可选)
这玩意是http服务器,我们直接在宝塔里安装,版本为`1.18`。不配反向代理的话就不用了
- [x] Redis
> `apt`会给你安装`4.0.6`的阴间版本,我们需要`5.0+`版本,但是也别用宝塔的,会失败。~~别问我们怎么知道的~~
// todo For jecosine
- [x] Linux沙盒
我们直接下载`LibreOJ`配置好的沙盒文件:
```console
wget https://github.com/syzoj/sandbox-rootfs/releases/download/181202/sandbox-rootfs-181202.tar.gz
```
> 如果下的太慢,建议本地爬上梯子拉下来在上传服务器。~~我不会告诉你我们是这么干的~~
现在下载下来了,我们等一下再进行配置。
- [x] 网站端
选择一个好地方,`git clone`就可以了
> 先确保你有一个`Gitee`账号,下载的慢也可以本地上传
```console
git clone https://gitee.com/sunist/soj-front-end.git
```
- [x] 评测端
选择一个好地方,`git clone`就可以了
> 下载的慢也可以本地上传。~~虽然这个不大~~
```console
git clone https://github.com/syzoj/judge-v3
```
## 2. 系统设置 ##
- [x] 系统沙盒
这玩意要用来跑评测机
```console
sudo vim /etc/default/grub
```
在其中
```txt
GRUB_CMDLINE_LINUX="$something"
```
的最后加上`cgroup_enable=memory swapaccount=1`,变成:
```txt
GRUB_CMDLINE_LINUX="$something cgroup_enable=memory swapaccount=1"
```
然后更新配置并重启服务器:
```console
update-grub
reboot
```