====== p5 Editor Fork Notes ======
This page records my personal "cheat sheet" for the p5-editor [[https://github.com/UChicago-PL/p5-editor|fork]] maintained by Andrew McNutt.
===== Development =====
This [[https://wiki.nixos.org/wiki/Docker|link]] has useful information about running Docker under NixOS.
If this is the first time starting the container, it is necessary to copy ''.env.example'' to ''.env'', and fill-in the required fields.
At a minimum, the required fields are:
* ''GITLAB_URL''
* ''GITLAB_ID''
* This can be found by adding the editor as a GitLab Application.
* The callback URL (for development) is ''http://localhost:8000/auth/gitlab/callback'' (''server/routes/passport.routes.js'')
* The ''api'' scope must be granted.
* ''GITLAB_SECRET''
* This value can also be found once a GitLab application has been registered.
To start the web server and the database:
$ docker compose -f docker-compose-development.yml up
When you're done, run the following to shut down the services:
$ docker compose -f docker-compose-development.yml down
==== Removing the Database Volume ====
The docker compose configuration defines a named volume, ''dbdata'', which contains the database.
To drop this database, you can delete this persistent volume:
$ docker volume rm p5-editor_dbdata
===== Adding a Course Edition =====
There are some useful scripts which add course editions, assignments, etc. in ''/server/scripts''.
For example, to add a new course edition, you could run:
$ ./server/scripts/add-course-edition.sh \
--name "test-edition" \
--password 1234 \
--project-name-template "sbcohen/p5-assignments-OWNER"
The ''--project-name-template'' flag tells the server how to construct project/repository names.
In the case of the above example, the gitlab repository URL was ''%%https://gitlab.taila5f9fc.ts.net/sbcohen/p5-assignments-sbcohen%%''.
The string ''OWNER'' stands in for the gitlab username of the repository owner (it is replaced dynamically at runtime with the actual username).
===== Adding an Assignment =====
Example:
$ ./server/scripts/add-assignment.sh \
--name "Test Assignment" \
--urlName "test-assignment" \
--dueDate 2026-11-30 \
--edition test-edition
===== TODO =====
* Update dependencies to avoid passing ''--legacy-peer-deps'' (See ''/Dockerfile'')