Skip to content

Commit

Permalink
v3.0.0 Anubis LMS (#84)
Browse files Browse the repository at this point in the history
* CHG course aware admin utilities

* ADD professor and TA management components

* ADD basic permission and crash checks

* CHG rename pytest.sh

* CHG lint

* ADD TODO on all places in api that need docs

* CHG document a huge amount of the api

* FIX debug message target

* CHG move nav items into Components subfolder

* CHG set the DH_HOST for testing data seed

* CHG significantly reduce course context checks

* FIX spacing issue in design doc and add management ide auth notes

* CHG more graceful course context checks in the frontend

* FIX theia admin network policy

* CHG simplify theia proxy LRU cache

* CHG more clear error message on course action permission

* FIX remove is_admin check from public submission

* FIX remove is_admin check from auth user create

* CHG increment version on about page
  • Loading branch information
wabscale authored May 3, 2021
1 parent 1c2e1d1 commit d0c284e
Show file tree
Hide file tree
Showing 135 changed files with 4,023 additions and 1,452 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

33 changes: 12 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ BUILT_IMAGES := $(shell \
2> /dev/null \
)
RUNNING_CONTAINERS := $(shell docker-compose ps -q)
API_IP := $(shell docker network inspect anubis_default | \
jq '.[0].Containers | .[] | select(.Name == "anubis_api_1") | .IPv4Address' -r | \
awk '{print substr($$0, 1, index($$0, "/")-1)}' \
2> /dev/null \
)
VOLUMES := $(shell docker volume ls | awk '{if (match($$2, /^anubis_.*$$/)) {print $$2}}')


Expand All @@ -45,6 +40,14 @@ push:
docker-compose build --parallel --pull $(PUSH_SERVICES)
docker-compose push $(PUSH_SERVICES)

startup-links:
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/superuser'
@echo 'auth: http://localhost/api/admin/auth/token/ta'
@echo 'auth: http://localhost/api/admin/auth/token/professor'
@echo 'site: http://localhost/'

.PHONY: debug # Start the cluster in debug mode
debug:
docker-compose up -d $(PERSISTENT_SERVICES)
Expand All @@ -55,10 +58,7 @@ debug:
sleep 3
@echo 'running migrations'
make -C api migrations
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/jmc1283'
@echo 'site: http://localhost/'
make startup-links

.PHONY: mindebug # Start the minimal cluster in debug mode
mindebug:
Expand All @@ -70,26 +70,17 @@ mindebug:
sleep 3
@echo 'running migrations'
make -C api migrations
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/jmc1283'
@echo 'site: http://localhost/'
make startup-links

.PHONY: mkdebug # Start minikube debug
mkdebug:
./k8s/debug/provision.sh
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/jmc1283'
@echo 'site: http://localhost/'
make startup-links

.PHONY: mkrestart # Restart minikube debug
mkrestart:
./k8s/debug/restart.sh
@echo ''
@echo 'seed: http://localhost/api/admin/seed/'
@echo 'auth: http://localhost/api/admin/auth/token/jmc1283'
@echo 'site: http://localhost/'
make startup-links

yeetdb:
docker-compose kill db
Expand Down
7 changes: 3 additions & 4 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ all: venv

venv:
virtualenv -p `which python3` venv
./venv/bin/pip install -r ./requirements.txt -r ./requirements-dev.txt
./venv/bin/pip install -r ./requirements.txt
./venv/bin/pip install -U black pytest

debug:
make -C .. debug
Expand All @@ -25,10 +26,8 @@ cleanyeetdb:
migrations: venv
./venv/bin/alembic upgrade head

.PHONY: lint # Run autopep8 then black on lint directories
.PHONY: lint # Run black on lint directories
lint: venv
@echo 'autopep to check and fix un-python things'
./venv/bin/autopep8 --in-place --aggressive --aggressive $(LINT_FILES)
@echo 'black to stylize'
./venv/bin/black $(LINT_FILES)

Expand Down
2 changes: 1 addition & 1 deletion api/anubis/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def create_pipeline_app():
# Initialize app with all the extra services
init_services(app)

# register blueprints
# register views
register_pipeline_views(app)

return app
58 changes: 17 additions & 41 deletions api/anubis/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,47 @@


class Config:
SECRET_KEY = None
STATS_REAP_DURATION = timedelta(days=60)

# sqlalchemy
SQLALCHEMY_DATABASE_URI = None
SQLALCHEMY_POOL_PRE_PING = True
SQLALCHEMY_POOL_SIZE = 100
SQLALCHEMY_POOL_RECYCLE = 280
SQLALCHEMY_TRACK_MODIFICATIONS = False

# OAuth
OAUTH_CONSUMER_KEY = ""
OAUTH_CONSUMER_SECRET = ""

# Cache config
CACHE_REDIS_HOST = "redis-master"
CACHE_REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD", default="anubis")

# Logger config
LOGGER_NAME = os.environ.get("LOGGER_NAME", default="anubis-api")

# Theia config
THEIA_DOMAIN = ""
THEIA_TIMEOUT = timedelta(hours=6)

def __init__(self):
# General flask config
self.DEBUG = os.environ.get("DEBUG", default="0") == "1"

self.SECRET_KEY = os.environ.get("SECRET_KEY", default="DEBUG")

# sqlalchemy
self.SQLALCHEMY_DATABASE_URI = None
self.SQLALCHEMY_POOL_PRE_PING = True
self.SQLALCHEMY_POOL_SIZE = 100
self.SQLALCHEMY_POOL_RECYCLE = 280
self.SQLALCHEMY_TRACK_MODIFICATIONS = False
self.SQLALCHEMY_DATABASE_URI = os.environ.get(
"DATABASE_URI",
default="mysql+pymysql://anubis:anubis@{}/anubis".format(
os.environ.get("DB_HOST", "db")
),
)

# Elasticsearch
self.DISABLE_ELK = os.environ.get("DISABLE_ELK", default="0") == "1"

# OAuth
self.OAUTH_CONSUMER_KEY = os.environ.get("OAUTH_CONSUMER_KEY", default="DEBUG")
self.OAUTH_CONSUMER_SECRET = os.environ.get(
"OAUTH_CONSUMER_SECRET", default="DEBUG"
)
self.OAUTH_CONSUMER_SECRET = os.environ.get("OAUTH_CONSUMER_SECRET", default="DEBUG")

# Redis
self.CACHE_REDIS_HOST = os.environ.get(
"CACHE_REDIS_HOST", default="redis-master"
)

self.CACHE_REDIS_PASSWORD = os.environ.get(
"REDIS_PASS", default="anubis"
)
self.CACHE_REDIS_HOST = os.environ.get("CACHE_REDIS_HOST", default="redis-master")
self.CACHE_REDIS_PASSWORD = os.environ.get("REDIS_PASS", default="anubis")

# Logger
self.LOGGER_NAME = os.environ.get("LOGGER_NAME", default="anubis-api")

# Theia
self.THEIA_DOMAIN = os.environ.get(
"THEIA_DOMAIN", default="ide.anubis.osiris.services"
)
self.THEIA_DOMAIN = os.environ.get("THEIA_DOMAIN", default="ide.anubis.osiris.services")
self.THEIA_TIMEOUT = timedelta(hours=6)

logging.info(
"Starting with DATABASE_URI: {}".format(self.SQLALCHEMY_DATABASE_URI)
)
# autograding specific config
self.STATS_REAP_DURATION = timedelta(days=60)

logging.info("Starting with DATABASE_URI: {}".format(self.SQLALCHEMY_DATABASE_URI))
logging.info("Starting with SECRET_KEY: {}".format(self.SECRET_KEY))
logging.info("Starting with DEBUG: {}".format(self.DEBUG))

Expand Down
Loading

0 comments on commit d0c284e

Please sign in to comment.