- CentOS 8 x86_64
- Install prerequisites
# root directory
./prerequisites
- Start Apache Web Server & MariaDB Server
sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl enable mariadb
sudo systemctl start mariadb
- gpg
# CodeSensor/tools
./init_gpg
- Database
- Create database database_name
- Add user user_name (pwd: user_password ) to database database_name
# CodeSensor/tools
sudo /usr/bin/mysql_secure_installation
mysql -h localhost -u root -p;
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_password';
CREATE DATABASE database_name;
GRANT ALL PRIVILEGES ON database_name .* TO 'user_name'@'localhost';
FLUSH PRIVILEGES;
- Initialze tables for database_name
# CodeSensor/tools
sudo mysql -u user_name -p database_name < db_schema.sql
python3 init_mysql.py database_name user_name user_password
- Edit CodeSensor/tools/DBLoader_nodejs/student_roster.txt to add user accounts for CodeSensor
- Each row contains an ID, NAME pair for each account
- Load user accounts to DB
# Codesensor/tools/DBLoader_nodejs
sudo npm install npm -g
npm install
node dbloader.js
- The default password is 'algo'+ID
- Password hash can be manually generated by the tool
*Codesensor/tools/DBLoader_nodejs/gen_password_hash.js*
- Selinux
# CodeSensor/selinux policy
ln -sf /usr/share/selinux/devel/Makefile
make
sudo semodule -i codesensor.pp
- Firewall
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
- https support
- Follow the instructions in https://certbot.eff.org/lets-encrypt/centosrhel8-apache
Path | Files |
---|---|
/usr/bin/HomeworkInspector/<HW_NAME> | Executables and scripts are put here |
/homeworks_workplace | Working directory for the compilation and execution of submitted code |
/var/homeworks/<HW_NAME> | Submitted source code and analysis result are put here |
/var/www/html/<HW_NAME> | Webpages for the homework |
- Homework config & data
- go to CodeSensor/HomeworkCodes
- make a folder <HW_NAME> and follow the structure below
<HW_NAME>
│ homework_inspector_config
│
└── skeleton
│ data.hpp
│ input.txt
│ output.txt.gold
│ verifier.py
│ verify.sh
│ hidden_data.hpp (optional)
│ hidden_input.txt (optional)
│ hidden_output.txt.gold (optional)
- modify homework_inspector_config to change the deadline, illegal headers, homework title and description
- input.txt and output.txt.gold are the input and correct output for the homework
- verifier.py checks the correctness of the answer
- data.hpp has struct for storing the input data, load_data(...) function to read in the input data and store it in the struct, and SHM_NAME to distinguish the names of shared memory in the OS
- hidden_data.hpp, hidden_input.txt and hidden_output.txt.gold are for code re-evaluation, they have the same purposes as the non-hidden ones, but have different test data
- be sure to change hidden_data.hpp's SHM_NAME if it's copied from data.hpp
- check out 2021_hw0_copy_paste or 2021_hw1_sort_text for some examples
- Upload to website
- install homework
# root directory
sudo ./install <HW_NAME>
- change the links in CodeSensor/web_frontpage/index.html
- install webpage
# root directory
sudo ./install_webpage
- make the submitted code public
sudo /usr/bin/HomeworkInspector/<HW_NAME>/TextToImage.php
- uninstall homework
# root directory
sudo ./uninstall <HW_NAME>
- log in to the website using baseline account
- click "re-evaluation link" in Submit tab
- click "Re-eval All" button to re-evaluate all the codes using hidden test data, or click "Re-eval <ID>" button for individual user
- "move results" button to replace all the old results with the newly generated results