The Peer++ evaluation system ensures quality evaluations by matching students with high-level evaluators.
Read more about it in ABOUT.md.
The bot reads its secrets from the environment variables listed in .env-example.
- For development, copy
.env-exampleto.envin the repository root and fill in the secret data. - In Docker, pass them through
env_fileindocker-compose.yml(see Production).
By default port 8080 is used for the webhooks express server.
The slackbot runs over Websockets instead of HTTP Requests, so it does not listen on a port.
- Install NodeJS 20.x or higher (the production container runs NodeJS 26).
- Install dependencies:
npm install - Initialize the database:
npm run init-db(requires thesqlite3CLI). - Use
npm run devfor development mode.
In production environments, use Docker.
Copy .env-example to .env next to your compose file and fill in the secret
data. Docker's env file format takes no quotes or spaces around the =, so
write SLACK_TOKEN=xoxb-....
The container runs as the unprivileged node user (uid 1000), so the
bind-mounted db and logs directories must be writable by that uid. Run this
once, before the first make up:
mkdir -p db logs
chown -R 1000:1000 db logs
- Use
make upto run in a docker container. - Use
make downto shut down the docker container.
Or, if you're confident in your Docker skills, you can just use the docker compose command directly.
To run the published image, a compose service looks similar to this:
services:
peerpp-bot:
container_name: peerpp-bot
restart: unless-stopped
image: ghcr.io/codam-coding-college/peerpp-bot:latest
pull_policy: always
volumes:
- ./data/config.json:/app/config.json
- ./data/logs:/app/logs
- ./data/db:/app/db
env_file:
- ./.env
ports:
- "8080:8080"In production, we recommend setting up a logrotate in the logs directory.
Create a logrotate config in the /etc/logrotate.d folder.
You can use or modify the configuration below. Note that the replacement log file is created for uid 1000, matching the user inside the container:
/root/peer-bot/logs/log.txt {
weekly
missingok
rotate 4
compress
delaycompress
shred
ifempty
create 644 1000 1000
}
- Go to the
peer-botdirectory. - Run
node src/scripts/manageuser.js add <login>where<login>is the login of the user you want to add to the Peer++ group.
- Go to the
peer-botdirectory. - Run
node src/scripts/manageuser.js remove <login>where<login>is the login of the user you want to remove from the Peer++ group.
- Go to the
peer-botdirectory. - Run
node src/scripts/getusers.js.
- Go to the
peer-botdirectory. - Run
node src/scripts/bookeval.js <scaleID> <teamID> <userID>where<scaleID>is the scaleID of the scale you want to use for the evaluation,<teamID>is the teamID of the team you want to schedule an evaluation for and<userID>is the userID of the evaluator (the one evaluating the team).
- Go to the
peer-botdirectory. - Run
sqlite3 db/peerdb.sqlite. - Run
INSERT INTO expiredTeam(teamID) VALUES ('<teamID>');in the sqlite3 shell, where<teamID>is the teamID of the team you want to cancel the evaluation for. - Run
.exitto exit the sqlite3 shell. - Tell the team that they can now cancel the evaluation (make them press x next to the evaluation on the Intranet).
- Run
node src/scripts/addpoint.js <login>where<login>is the login of the student who lost a correction point for the cancellation. This will refund the point to the student.
