Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
577b880
track users' last_login
hcientist Sep 21, 2024
c4dbe96
Merge pull request #22 from Lab-Lab-Lab/main
hcientist Sep 21, 2024
c68a544
Merge branch 'Lab-Lab-Lab:main' into main
hcientist Sep 21, 2024
245301f
commit vscode settings
hcientist Sep 21, 2024
2cbeb40
Merge pull request #23 from Lab-Lab-Lab/main
hcientist Sep 21, 2024
e9891bf
feat: Add PartInstrumentSample model and serializer
Zamua Oct 25, 2024
115b095
Merge pull request #24 from Zamua/zamua/add-partinstrumentsample-model
hcientist Oct 27, 2024
eb83aeb
don't use wildcard
hcientist Oct 27, 2024
84838bc
add migration for partinstrumentsample, add partinstrumentsample to a…
hcientist Oct 28, 2024
e94ca8a
Merge pull request #25 from Lab-Lab-Lab/main
hcientist Oct 28, 2024
8435483
add github action to format with black with thanks to @JoshuaAHairston
hcientist Oct 28, 2024
3f58c48
add dashboards app
hcientist Jun 13, 2024
59b8a5c
this resulted in 1250 SQL queries https://capture.dropbox.com/uiyeHXX…
hcientist Jun 13, 2024
97f960a
pause to change tasks
hcientist Jun 26, 2024
63a2f53
render compose submissions
hcientist Jul 8, 2024
df4cd5d
implemented most of the functionality of the csv button
JoshuaAHairston Aug 24, 2024
239c979
the csv export and proof of concept for the png export
JoshuaAHairston Sep 6, 2024
b8c41dd
try to trigger the github action
hcientist Oct 28, 2024
277ddad
Merge branch 'Lab-Lab-Lab:main' into main
hcientist Oct 28, 2024
8856d6c
Merge pull request #26 from Lab-Lab-Lab/main
hcientist Oct 28, 2024
2f1746b
trigger pr when this is pr'ed back to og
hcientist Oct 28, 2024
b45ef3b
Merge branch 'Lab-Lab-Lab:main' into main
hcientist Oct 28, 2024
f75c2d0
get right with formatting
hcientist Oct 28, 2024
f24977d
Merge pull request #27 from Lab-Lab-Lab/main
hcientist Oct 28, 2024
b49fb1c
Add Dockerfile
Adamv27 Mar 5, 2025
35e1c47
Dockerfile typo
Adamv27 Mar 5, 2025
d0031ea
Dockerfile update
Adamv27 Mar 5, 2025
6dd9fc2
Change container internal socket creation
Adamv27 Mar 5, 2025
fabddca
New Dockerfile
Adamv27 Mar 5, 2025
b3ee1f6
Fix copying requirements
Adamv27 Mar 5, 2025
0e9929c
3.13 was not happy with current requirements
Adamv27 Mar 5, 2025
0b29eaa
Install production requirements in container
Adamv27 Mar 19, 2025
216e6e9
Specify which settings to use to django
Adamv27 Mar 19, 2025
c287721
Add dev-api.musiccpr.org to allowed hosts
Adamv27 Mar 19, 2025
e0775b7
Add deployment workflow
Adamv27 Mar 19, 2025
b656ebd
Test commit
Adamv27 Mar 19, 2025
1c7643c
Fix indent
Adamv27 Mar 19, 2025
ec66690
Debug port
Adamv27 Mar 19, 2025
22f5610
Fix typo in port var
Adamv27 Mar 19, 2025
b06c159
Unindent EOF
Adamv27 Mar 19, 2025
92eaab5
Add main branch to workflow...
Adamv27 Mar 19, 2025
be83b35
Add api.musiccpr.org to allowed hosts
Adamv27 Mar 19, 2025
f262198
Fix typo in deployment script
Adamv27 Mar 19, 2025
849b5bb
restart on reboot
hcientist Apr 23, 2025
55fac09
Update README to replace MailHog with mailpit
OutboundSpade Oct 9, 2025
85ad72e
Add devcontainer for better developer experience
OutboundSpade Oct 9, 2025
2885aa5
initial pass at scaffolding/designing DAWn_EE activity
mfwolffe Oct 17, 2025
98bffe0
more contrived activity things, migrations
mfwolffe Oct 17, 2025
0c26a44
fix race condition, transaction locking, audio state fields, update s…
mfwolffe Oct 17, 2025
5393b0f
switch to laptop
mfwolffe Oct 17, 2025
de6a054
Merge pull request #44 from OutboundSpade/main
hcientist Oct 20, 2025
7a76420
better admin panel things for logs, fixes to logging
espadonne Dec 2, 2025
02325e9
fixes
espadonne Dec 2, 2025
8cbd606
set up for railway
espadonne Dec 2, 2025
30f59f8
Explicitly set DJANGO_SETTINGS_MODULE in Procfile
espadonne Dec 2, 2025
7da2a7e
Fix Railway deployment: rename Dockerfile, use nixpacks
espadonne Dec 2, 2025
2823d91
fix railway deployment: use autodetected python,set railway requirements
espadonne Dec 2, 2025
4673dbf
Add media files temporarily for Railway volume seeding
espadonne Dec 2, 2025
911676b
Add debug output to start command
espadonne Dec 2, 2025
d00b4f8
Add debug output to Procfile
espadonne Dec 2, 2025
992fdf5
Fix Procfile parsing - remove colons
espadonne Dec 2, 2025
5648c7c
Add nixpacks.toml to force custom start command
espadonne Dec 2, 2025
04d6252
Disable nixpacks auto-detection
espadonne Dec 2, 2025
5a27c72
Simplify media setup - use teleband/media directly
espadonne Dec 3, 2025
7be1333
Override only start phase in nixpacks, use volume for media
espadonne Dec 3, 2025
9225bc8
Fix media file serving in production (use serve() instead of static())
espadonne Dec 3, 2025
23197a6
Use shell script for startup with debug output
espadonne Dec 3, 2025
4625de2
Add debug-media endpoint to check file locations
espadonne Dec 3, 2025
928aca1
Remove media files from git (now persisted in Railway volume)
espadonne Dec 3, 2025
ae3cc32
Clean up start.sh - only seed media if needed
espadonne Dec 3, 2025
0b6d9b3
Update deployment docs - terse guide
espadonne Dec 3, 2025
2a77428
Update psycopg to version 3 to support pooling
OutboundSpade Dec 4, 2025
bb0a5cb
Enable connection pooling by default
OutboundSpade Dec 4, 2025
1c8f652
Fix formatting for settings
OutboundSpade Dec 4, 2025
82d2f23
Merge pull request #47 from OutboundSpade/main
OutboundSpade Dec 4, 2025
7689625
Merge branch 'Lab-Lab-Lab:main' into main
mfwolffe Feb 20, 2026
99495eb
Change requirements file to reference local.txt
hcientist Feb 20, 2026
858360e
Merge pull request #48 from mfwolffe/main
hcientist Feb 20, 2026
968e7c6
Refactor GitHub Actions workflow for building and deploying Docker im…
OutboundSpade Feb 24, 2026
7e3562e
Update caching configuration to use Redis if available, fallback to l…
OutboundSpade Mar 3, 2026
b436383
Update GitHub Actions to use Ubuntu 24.04 ARM and adjust Docker platf…
OutboundSpade Mar 3, 2026
06f7eee
Set AWS_DEFAULT_ACL to None for S3 storage configurations
OutboundSpade Mar 3, 2026
e5f4703
Add AlbHealthcheckMiddleware for ALB health checks
OutboundSpade Mar 3, 2026
b28fe00
add save as new to course enrollment
hcientist Apr 10, 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
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000],
"runArgs": ["--network=host"]

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
__pycache__/


# Django stuff
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
static

# Environment
.env
.env*
.venv
venv/
117 changes: 117 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build and Deploy

on:
push:
branches:
- main
release:
types:
- published

permissions:
contents: read
packages: write
id-token: write

jobs:
build-and-push:
runs-on: ubuntu-24.04-arm

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Compute image tags
id: image
env:
EVENT_NAME: ${{ github.event_name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
image="ghcr.io/${REPOSITORY,,}"
short_sha="${SHA::12}"

tags=""

if [[ "$EVENT_NAME" == "push" ]]; then
tags="${image}:nightly"
tags+=$'\n'"${image}:sha-${short_sha}"
elif [[ "$EVENT_NAME" == "release" ]]; then
tags="${image}:${RELEASE_TAG}"
if [[ "$RELEASE_PRERELEASE" != "true" ]]; then
tags+=$'\n'"${image}:latest"
fi
else
echo "Unsupported event: $EVENT_NAME" >&2
exit 1
fi

{
echo "image=$image"
echo "tags<<EOF"
echo "$tags"
echo "EOF"
} >> "$GITHUB_OUTPUT"

- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.aws
push: true
platforms: ${{ vars.DOCKER_PLATFORMS != '' && vars.DOCKER_PLATFORMS || 'linux/arm64' }}
tags: ${{ steps.image.outputs.tags }}

deploy-dev:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build-and-push
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ vars.AWS_REGION }}

- name: Trigger ECS deployment (dev)
run: |
aws ecs update-service \
--cluster "${{ vars.ECS_DEV_CLUSTER }}" \
--service "${{ vars.ECS_DEV_SERVICE }}" \
--force-new-deployment

deploy-prod:
if: github.event_name == 'release' && github.event.release.prerelease == false
needs: build-and-push
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ vars.AWS_REGION }}

- name: Trigger ECS deployment (prod)
run: |
aws ecs update-service \
--cluster "${{ vars.ECS_PROD_CLUSTER }}" \
--service "${{ vars.ECS_PROD_SERVICE }}" \
--force-new-deployment
25 changes: 25 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check Python Code Formatting

on:
pull_request:
branches:
- main

jobs:
format-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12.x"

- name: Install Black
run: pip install black

- name: Run Black
run: black . --check
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ typings/


### VisualStudioCode template
.vscode/
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.11.6
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"args": [
"runserver"
],
"django": true,
"autoStartBrowser": false,
"program": "${workspaceFolder}/manage.py"
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"editor.formatOnPaste": true,
"editor.formatOnSave": true
}
35 changes: 35 additions & 0 deletions Dockerfile.aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM python:3.10-slim AS builder

RUN mkdir /app

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

COPY requirements.txt /app/
COPY requirements/ /app/requirements/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r /app/requirements/production.txt

FROM python:3.10-slim

RUN useradd -m -r appuser && \
mkdir /app && \
chown -R appuser /app

COPY --from=builder /usr/local/lib/python3.10/site-packages/ /usr/local/lib/python3.10/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin

WORKDIR /app

COPY --chown=appuser:appuser . .

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

RUN chmod +x /app/entrypoint.prod.sh

EXPOSE 8000

CMD ["/app/entrypoint.prod.sh"]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bash start.sh
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ Moved to [Live reloading and SASS compilation](http://cookiecutter-django.readth

### Email Server

In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use [MailHog](https://github.com/mailhog/MailHog) when generating the project a local SMTP server with a web interface will be available.
In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use [mailpit](https://github.com/axllent/mailpit) when generating the project a local SMTP server with a web interface will be available.

1. [Download the latest MailHog release](https://github.com/mailhog/MailHog/releases) for your OS.
1. [Download the latest mailpit release](https://github.com/axllent/mailpit/releases) for your OS.

2. Rename the build to `MailHog`.
2. Rename the build to `mailpit`.

3. Copy the file to the project root.

4. Make it executable:

$ chmod +x MailHog
$ chmod +x mailpit

5. Spin up another terminal window and start it there:

./MailHog
./mailpit

6. Check out <http://127.0.0.1:8025/> to see how it goes.

Expand Down Expand Up @@ -128,7 +128,7 @@ The following details how to deploy this application.

# Renewing SSL Certs (requires creating DNS TXT Entries rn 😕)
1. maybe this is the command?
* `sudo certbot certonly --manual --server https://acme-v02.api.letsencrypt.org/directory --preferred-challenges dns-01 -d "*.musiccpr.org,musiccpr.org"`
* `sudo certbot certonly --manual --server https://acme-v02.api.letsencrypt.org/directory --preferred-challenges dns-01 -d "musiccpr.org,dev-api.musiccpr.org,dev.musiccpr.org,api.musiccpr.org"`
# Deploying to Prod first time
Prefer to have:
1. same ec2 instance as dev
Expand Down
2 changes: 2 additions & 0 deletions config/api_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
SubmissionViewSet,
AttachmentViewSet,
TeacherSubmissionViewSet,
ActivityProgressViewSet,
)
from teleband.musics.api.views import PieceViewSet
from teleband.instruments.api.views import InstrumentViewSet
Expand Down Expand Up @@ -45,6 +46,7 @@

assignments_router = nested_cls(courses_router, "assignments", lookup="assignment")
assignments_router.register("submissions", SubmissionViewSet)
assignments_router.register("activity-progress", ActivityProgressViewSet, basename="activity-progress")

attachments_router = nested_cls(assignments_router, "submissions", lookup="submission")
attachments_router.register("attachments", AttachmentViewSet)
Expand Down
4 changes: 4 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"default": env.db("DATABASE_URL", default="postgres:///teleband"),
}
DATABASES["default"]["ATOMIC_REQUESTS"] = True
DATABASES["default"]["OPTIONS"] = {"pool": True}

# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

Expand Down Expand Up @@ -90,6 +92,7 @@
"teleband.instruments",
"teleband.musics",
"teleband.submissions",
"teleband.dashboards",
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
Expand Down Expand Up @@ -137,6 +140,7 @@
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
MIDDLEWARE = [
"teleband.utils.health_check.AlbHealthcheckMiddleware",
"django.middleware.security.SecurityMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down
11 changes: 10 additions & 1 deletion config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
"default": env.db("DATABASE_URL", default="sqlite:///db.sqlite"),
}
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["localhost", "0.0.0.0", "127.0.0.1"])
ALLOWED_HOSTS = env.list(
"ALLOWED_HOSTS",
default=[
"localhost",
"0.0.0.0",
"127.0.0.1",
"dev-api.musiccpr.org",
"api.musiccpr.org",
],
)

# CACHES
# ------------------------------------------------------------------------------
Expand Down
Loading
Loading