Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
cb65910
Dockerized Faculty Tools
ssilverm Mar 30, 2021
b0031a6
Removing settings.py.template
ssilverm Apr 6, 2021
ea97747
Fixes naming confusion
ssilverm Apr 6, 2021
c5bc16e
CI test
ssilverm Apr 6, 2021
1a1532f
CI test
ssilverm Apr 6, 2021
32300df
CI test
ssilverm Apr 6, 2021
5dd2415
CI test
ssilverm Apr 6, 2021
9c1cb3e
flake8
ssilverm Apr 6, 2021
2601e5d
black
ssilverm Apr 6, 2021
0721d34
CI/CD + black
ssilverm Apr 6, 2021
3d1cee5
README MDL
ssilverm Apr 7, 2021
98ee7b9
Trying with nginx and uwsgi files
ssilverm Apr 7, 2021
a5d3d5f
README
ssilverm Apr 7, 2021
71e6278
README
ssilverm Apr 7, 2021
2ec1f22
Load ENV?
ssilverm Apr 7, 2021
58952fd
.env
ssilverm Apr 7, 2021
8d8cf31
Fixing status test
ssilverm Apr 20, 2021
0851770
Key / Secret env template
ssilverm Apr 20, 2021
d916489
Better dockeriziation
ssilverm Mar 29, 2022
db4b2d4
Fixed linting
ssilverm Mar 30, 2022
30b4620
testing github docker image push
ssilverm Mar 31, 2022
9c523bb
req + on needs
ssilverm Mar 31, 2022
1b56e91
CICD
ssilverm Mar 31, 2022
5c8096a
cicd
ssilverm Mar 31, 2022
912864c
requirements?
ssilverm Mar 31, 2022
52da810
Env?
ssilverm Apr 1, 2022
10629f9
Env?
ssilverm Apr 1, 2022
aaef398
Env?
ssilverm Apr 1, 2022
b4902aa
build args
ssilverm Apr 5, 2022
d87cfa6
adding git hash to ci
ssilverm Apr 12, 2022
4af0af2
sha
ssilverm Apr 12, 2022
e3e1865
sha
ssilverm Apr 12, 2022
f7750fe
sha
ssilverm Apr 12, 2022
11ae104
sha
ssilverm Apr 12, 2022
b6ecd9f
sha
ssilverm Apr 12, 2022
3c3f49d
using tags based on branch
ssilverm Apr 13, 2022
e39ee49
Log handler
ssilverm Apr 13, 2022
be52aeb
flake8 linting
ssilverm Apr 13, 2022
fa30299
changed env to remove https for demo
ssilverm Apr 14, 2022
6c2fd0c
Passing tests
ssilverm Apr 18, 2022
6d80d5d
Tests passing
ssilverm Apr 18, 2022
06d3a24
Fixed formatting
ssilverm Apr 18, 2022
6dc0cd3
First fixes
ssilverm Apr 25, 2022
8fd80ee
Linted
ssilverm Apr 26, 2022
e60651b
MDL
ssilverm Apr 26, 2022
dcd0c27
config comment change
ssilverm Apr 26, 2022
af2863a
Testing ARM
ssilverm May 16, 2022
cd8784d
Testing ARM platforms
ssilverm May 16, 2022
e43eb0f
Testing ARM platforms
ssilverm May 16, 2022
6649bed
Testing ARM platforms
ssilverm May 16, 2022
ef62752
Testing ARM platforms
ssilverm May 16, 2022
b2f2f11
Testing ARM platforms
ssilverm May 16, 2022
64896c8
patch requirements, include makefile, fix typo
dgwn Feb 15, 2024
9b307fd
update make commands
dgwn Feb 15, 2024
4868519
Initial LTI 1.3 migration
dgwn Feb 20, 2024
4343080
move api_key from session to db, update lti_required protector
dgwn Mar 12, 2024
866afcc
remove old decorator comments
dgwn Mar 12, 2024
d1724c9
early expiry check for tokens, make sure new acces tokens are getting…
dgwn Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.dockerignore
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
venv*
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.log
.git
*.template
.env*
fake-s3
16 changes: 16 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TOOL_TITLE=Faculty Tools
THEME_DIR=
BASE_CANVAS_SERVER_URL=https://example.com/
SECRET_KEY=CHANGEME
LTI_KEY=key
LTI_SECRET=secret
OAUTH2_URI=http://127.0.0.1:9001/oauthlogin
OAUTH2_ID=CHANGEME
OAUTH2_KEY=CHANGEME
GOOGLE_ANALYTICS=GA-000000
CONFIG=config.DevelopmentConfig
DATABASE_URI=mysql://root:secret@db/faculty_tools

REQUIREMENTS=test_requirements.txt

WHITELIST_JSON=whitelist.json
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Run Python Tests and Build Image

on:
push:
branches:
- issue/21-dockerize
- develop
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
REQUIREMENTS: requirements.txt

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Python 3
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install coveralls
- name: Setup Repo
run: |
cp whitelist.json.template whitelist.json
cp .env.template .env
- name: Run flake8
run: flake8
- name: Run black
run: black --check .
- name: Lint markdown files
uses: bewuethr/mdl-action@v1
# - name: Load dotenv
# uses: falti/dotenv-action@v0.2.5
- name: Environment Variables from Dotenv
uses: c-py/action-dotenv-to-setenv@v3
# - name: Print Repo
# run: |
# env
- name: Run unittests
run: coverage run -m unittest discover


- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Print Buildx
run: |
docker buildx ls

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: REQUIREMENTS=${{ env.REQUIREMENTS }}
platforms: linux/amd64

- name: Build and push ARM64 Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: REQUIREMENTS=${{ env.REQUIREMENTS }}
platforms: linux/arm64

- name: Build and push ARMv7 Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: REQUIREMENTS=${{ env.REQUIREMENTS }}
platforms: linux/arm/v7

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# config/settings
logs
settings.py
whitelist.json
.env

# local theming
themes/*
Expand Down
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### General

- Implement LTI 1.3 standard for tool launch
- Move refresh and access tokens from session storage to db storage
- add Makefile for easier docker and utility commands

## [1.2.0] - 2019-09-10

### General
Expand All @@ -18,8 +22,7 @@

### Bugfixes

- Fixed an issue where switching browsers would cause Faculty Tools to ask the
user to reauthorize with Canvas, leading to multiple access tokens.
- Fixed an issue where switching browsers would cause Faculty Tools to ask the user to reauthorize with Canvas, leading to multiple access tokens.

## [1.0.0] - 2018-08-29

Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.12 as base
ARG REQUIREMENTS
COPY requirements.txt /app/
COPY test_requirements.txt /app/
# RUN pip install --upgrade pip
RUN pip install -r /app/$REQUIREMENTS
WORKDIR /app
COPY ./ /app/
EXPOSE 9001
CMD ["gunicorn", "--conf", "gunicorn_conf.py", "--bind", "0.0.0.0:9001", "lti:app"]
83 changes: 83 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
COMPOSE_FILE=docker-compose.yml
DOCKER_COMPOSE=docker compose -f $(COMPOSE_FILE)

BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)

default: build

#==============================================
# Building and cleaning the Docker environment
#==============================================
build: ## Build all Docker images
@echo "Building Faculty Tools' Docker images"
@$(DOCKER_COMPOSE) build

build-no-cache: ## Build all Docker images
@echo "Building Faculty Tools' Docker images"
@$(DOCKER_COMPOSE) build --no-cache

clean: stop-lti remove-lti-volumes build-no-cache ## Stops and removes existing existing containers before rebuilding images

nuke: ## Stops and removes existing existing containers and volumes, including the database
@echo "${YELLOW}Stopping running containers and purging existing volumes${RESET}"
$(DOCKER_COMPOSE) down -v

#================================================================================
# Managing the Docker environment (e.g. starting, stopping, deleting containers)
#================================================================================
start: start-daemon ## Start Faculty Tools (default: daemon mode)

start-attached: ## Start Faculty Tools in attached mode
@echo "${GREEN}Starting Faculty Tools in attached mode${RESET}"
$(DOCKER_COMPOSE) up

start-daemon: ## Start Faculty Tools in daemon mode
@echo "${GREEN}Starting Faculty Tools in daemon mode${RESET}"
@echo "Run \`make start-attached\` to run in attached mode, or view container logs with \`make logs\`"
$(DOCKER_COMPOSE) up -d

stop: ## Stop Faculty Tools
@echo "${YELLOW}Stopping Faculty Tools${RESET}"
$(DOCKER_COMPOSE) down

logs: ## View container logs (optionally specifying a service name, like `lti`)
$(DOCKER_COMPOSE) logs -f

#=================================
# Application management commands
#=================================

# TODO ensure the new way using `db-init` covers same actions
# create-db:
# @echo "Initializing the database"
# docker-compose up -d lti
# docker-compose exec lti python -c "from lti import app, db; app.app_context().push(); db.create_all()"

db-init: ## Initialize the database
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask db init

makemigrations: ## Create a new DB migration
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask db migrate

migrate-run: ## Run an existing DB migration
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask db upgrade

downgrade: ## Downgrade the database
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask db downgrade

generate-keys: ## Create new public and private keys and assign them to a keyset
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask generate_keys

register: ## Add a new registration for Zapt in a platform
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask register

deploy: ## Add a new deployment for Zapt to an existing registration
${DOCKER_COMPOSE} run --rm -e FLASK_APP=lti.py lti flask deploy
Loading