What is the Peer++ system?
The Peer++ evaluation system ensures quality evaluations by matching students with high-level evaluators.
Read more about it in ABOUT.md.
Installation
The bot reads its secrets from the environment variables listed in .env-example.
- For development, copy
.env-example to .env in the repository root and fill in the secret data.
- In Docker, pass them through
env_file in docker-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.
Development
- Install NodeJS 20.x or higher (the production container runs NodeJS 26).
- Install dependencies:
npm install
- Initialize the database:
npm run init-db (requires the sqlite3 CLI).
- Use
npm run dev for development mode.
Production
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 up to run in a docker container.
- Use
make down to 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"
Logrotate
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
}
Useful how-tos
Add a user to the Peer++ group
- Go to the
peer-bot directory.
- Run
node src/scripts/manageuser.js add <login> where <login> is the login of the user you want to add to the Peer++ group.
Remove a user from the Peer++ group
- Go to the
peer-bot directory.
- Run
node src/scripts/manageuser.js remove <login> where <login> is the login of the user you want to remove from the Peer++ group.
List all users in the Peer++ group
- Go to the
peer-bot directory.
- Run
node src/scripts/getusers.js.
Manually schedule a Peer++ evaluation
- Go to the
peer-bot directory.
- 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).
Allow cancellation of a Peer++ evaluation
- Go to the
peer-bot directory.
- 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
.exit to 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.