Skip to content

Commit 505f1a8

Browse files
authored
Merge pull request #62 from pennlabs/aag/predeploy-backend-fixes
Aag/predeploy backend fixes
2 parents 640d5d3 + 829a075 commit 505f1a8

File tree

96 files changed

+338
-3333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+338
-3333
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM --platform=linux/amd64 ubuntu:22.04
2+
ARG IMAGE_NAME=pennlabs/courses-devcontainer
3+
RUN apt-get update && apt-get install -y wget curl gcc python3-dev libpq-dev

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "Penn Courses",
3+
"build": { "dockerfile": "Dockerfile" },
4+
"containerUser": "otis",
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
7+
"ghcr.io/devcontainers/features/python:1": {
8+
"version": "3.11"
9+
},
10+
"ghcr.io/devcontainers/features/node:1": {},
11+
"ghcr.io/devcontainers/features/common-utils:2": {
12+
"configureZshAsDefaultShell": true,
13+
"username": "otis"
14+
},
15+
"git-lfs": "latest",
16+
"terraform": {
17+
"version": "latest",
18+
"tflint": "latest",
19+
"terragrunt": "latest"
20+
}
21+
},
22+
"customizations": {
23+
"vscode": {
24+
"extensions": ["esbenp.prettier-vscode"]
25+
}
26+
}
27+
}

.github/workflows/shared-build-deploy.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
path: backend
1616
flake: true
1717
black: true
18-
pythonVersion: 3.10-buster
18+
pythonVersion: 3.11-buster
1919

2020
publish-backend:
2121
uses: pennlabs/shared-actions/.github/workflows/[email protected]
@@ -55,6 +55,7 @@ jobs:
5555
product: [review, plan, alert]
5656
with:
5757
path: frontend/${{ matrix.product }}
58+
nodeVersion: 18.19.0
5859

5960
publish-frontend:
6061
uses: pennlabs/shared-actions/.github/workflows/[email protected]

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
.env*
2-
.yarn/build-state.yml
3-
.yarn/unplugged
4-
.yarn/install-state.gz
52
.vscode
63
.idea/
74
.DS_Store
@@ -26,4 +23,4 @@ pcr-backup*
2623
./Pipfile
2724
./Pipfile.lock
2825
./package.json
29-
./yarn.lock
26+
./yarn.lock

Pipfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Penn Courses with Penn Degree Plan
1+
# Penn Courses
22
![Workflow](https://github.com/pennlabs/penn-courses/workflows/Workflow/badge.svg)
33
[![Coverage Status](https://codecov.io/gh/pennlabs/penn-courses/branch/master/graph/badge.svg)](https://codecov.io/gh/pennlabs/penn-courses)
44

@@ -10,6 +10,27 @@ This is the unified home of all [Penn Courses](https://penncourses.org) products
1010

1111
Note that you need the backend to run the frontend.
1212

13+
### Using Dev Containers
14+
15+
This repository has a built-in dev container that you can use to develop the project. To use it, you need to have [Docker](https://www.docker.com/products/docker-desktop) and [VSCode](https://code.visualstudio.com/) installed.
16+
17+
Press the remote container button in the bottom left of the window and select "Reopen in Container". This will build the dev container and open the project in a new window.
18+
19+
This container is designed to work with both backend and frontend development. Some additional steps are required, like installing `pipenv` dependencies and setting up the database and running the frontend server. Please read and follow the instructions in the backend and frontend READMEs.
20+
21+
For more information, visit dev container [documentation](https://code.visualstudio.com/docs/remote/containers).
22+
23+
#### Pushing Code
24+
25+
You can use `ssh-add` to make your SSH keys available to the dev container. This will allow you to push code to GitHub.
26+
27+
```
28+
ssh-add ~/.ssh/id_rsa
29+
```
30+
31+
32+
33+
1334
## API Documentation
1435
API Docs can be found at `/api/documentation` on the back-end server. Also check out the code for more explanations
1536
and documentation! We've tried to keep it up-to-date.

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM pennlabs/django-base:9c4f31bf1af44219d0f9019271a0033a222291c2-3.10.1
1+
FROM pennlabs/django-base:b269ea1613686b1ac6370154debbb741b012de1a-3.11
22

33
LABEL maintainer="Penn Labs"
44

backend/PennCourses/docs_settings.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,7 @@ def update_tag(old_tag, new_tag):
664664
all_list = all([("list" in v["operationId"].lower()) for v in tag_to_dicts[tag]])
665665
if all_list: # if all views in tag are lists, pluralize tag name
666666
tag = update_tag(
667-
tag,
668-
" ".join(tag.split(" ")[:-1] + [pluralize_word(tag.split(" ")[-1])]),
667+
tag, " ".join(tag.split(" ")[:-1] + [pluralize_word(tag.split(" ")[-1])])
669668
)
670669
if tag in custom_tag_names.keys(): # rename custom tags
671670
tag = update_tag(tag, custom_tag_names[tag])
@@ -852,10 +851,7 @@ def fail(param, hint):
852851
fail(param_name, f"The {param_name} kwarg must be a dict.")
853852
for dictionary in param_dict.values():
854853
if not isinstance(dictionary, dict):
855-
fail(
856-
param_name,
857-
f"All values of the {param_name} dict must be dicts.",
858-
)
854+
fail(param_name, f"All values of the {param_name} dict must be dicts.")
859855
for nested_dictionary in dictionary.values():
860856
if param_name == "custom_parameters":
861857
if not isinstance(nested_dictionary, list):

backend/PennCourses/settings/base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"options.apps.OptionsConfig",
5050
"django.contrib.admindocs",
5151
"django_extensions",
52-
"django_filters",
5352
"alert",
5453
"courses",
5554
"plan",
@@ -201,11 +200,6 @@
201200
"rest_framework.authentication.BasicAuthentication",
202201
"accounts.authentication.PlatformAuthentication",
203202
],
204-
"DEFAULT_PARSER_CLASSES": (
205-
"rest_framework.parsers.JSONParser",
206-
"rest_framework.parsers.FormParser",
207-
"rest_framework.parsers.MultiPartParser",
208-
),
209203
}
210204

211205
STATS_WEBHOOK = os.environ.get("STATS_WEBHOOK", None)

backend/PennCourses/settings/production.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"LOCATION": REDIS_URL,
3232
"OPTIONS": {
3333
"CLIENT_CLASS": "django_redis.client.DefaultClient",
34+
"IGNORE_EXCEPTIONS": True, # ignore Redis connection errors
35+
"SOCKET_CONNECT_TIMEOUT": 1,
36+
"SOCKET_TIMEOUT": 1,
3437
},
3538
}
3639
}

0 commit comments

Comments
 (0)