Purpose
Current limitations of the DO UI and IAM pose issues to educators trying to use DO in the classroom. This tool aims to be an API Proxy between the DO Infrastructure and students to give the teacher/professor more control of the resources students use.
This is in Development/Alpha phase and has no guarantee to work
Dev Notes
- Run
export $(grep -v '^#' env | xargs)
to set env vars from an env file
Getting Started with Development
- Create a Python virtual environment in your home directory
python3 -m venv ~/do-classroom
- Activate the environment
source ~/do-classroom/bin/activate
- Install Python requirements
pip install -r do_classroom/requirements.txt
- Create an
env
file for environment variables as shown inenv.example
- If you're developing this on your local system set
DEVELOPMENT_MODE=True
- Set
DEBUG=True
- Add a DigitalOcean API key to the file as
DO_TOKEN
- Generate a secret key using
python generate_secret_key.py
and add it to the env file as DJANGO_SECRET_KEY - If you plan on accessing from an IP address or DNS name that isn't localhost add that to DJANGO_ALLOWED_HOSTS
- If you're developing this on your local system set
- Export the env vars
export $(grep -v '^#' env | xargs)
- Setup DB by making migrations
python do_classroom/manage.py migrate
- Create a superuser for testing
python do_classroom/manage.py createsuperuser
- Run the server
python do_classroom/manage.py runserver 0.0.0.0:8000
Issues this solves
- Removes the need for every student to have an account to use the resources
- Collegiate - Not all students have credit cards. This could be a barrier
- Primary to Secondary School - Age requirements to legally be able to create a contract, hence a DO account.
- Allows for resource restrictions on accounts.
Proposed Workflow
- Professor/teacher creates DO account, inputs institution/personal card, and generates API token (can potentially be given credits)
- Professor/teacher spins up API proxy via Marketplace one click
- Professor/teacher creates student accounts. Can be CSV import
- Professor/teacher sets up rules determining resource constraints. E.g. Can only spin up a $5 droplet, has to be Fedora, only one droplet per student
- Student is emailed from app with username and password. Student logs in and changes password. Uploads SSH key
- Student generates API Proxy token (possibly? Do we want this?)
- Student can either make API request or spin up droplet from Proxy API UI
- Jamon mentioned something like tty.js or something for a better terminal experience in the browser.
Spec
- For now, just use Django Admin for portal
- nginx for proxying to app
- github.internal project using Python image
- Two roles, Admin/Teach & Student
- Admin/Teacher role
- Full droplet admin
- Change API key
- Create Student users (might want to write CSV uploader for)
- Create API token
- Set policy on student access
- Student role
- Spin up and delete droplet
- Create API token for REST
- Admin/Teacher role
- Create full REST API for complete functionality
- Option to secure with Let’s Encrypt or self signed cert
- Setup droplet username and password
- Use student password from django admin?
- Let professor set username & password?
- Docker container for local support and Marketplace image
- Swagger documentation
- v2
- Configure via Ansible
- Oauth support?