-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Https server #2
base: master
Are you sure you want to change the base?
Https server #2
Changes from 9 commits
1762629
84a1941
f884af5
8842a12
011b308
124e222
e44e4e2
e18b2ae
09f123c
a825edf
2eadd2b
99d7233
d80ae5b
d5e6b35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
default_language_version: | ||
python: python3.8 | ||
python: python3.9 | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 # not a "beta"; just weird versioniong | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
args: | ||
# don't actually format, just exit with 0 (no changes) or 1 (changes needed) | ||
- --check | ||
- casdemoserver | ||
- hkey | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to get changed to pull from github. the gitlab url makes me authenticate and is a known "bug". https://www.reddit.com/r/Python/comments/yvfww8/flake8_took_down_the_gitlab_repository_in_favor/ |
||
rev: 3.7.9 | ||
hooks: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ ENV PYTHONUNBUFFERED 1 | |
# update the base OS packages | ||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache bash \ | ||
&& apk add --no-cache --update sqlite | ||
|
||
RUN mkdir /app | ||
|
@@ -20,8 +21,15 @@ RUN pip install --no-cache-dir -U pip pip-tools \ | |
ADD . /app | ||
|
||
WORKDIR /app | ||
RUN python manage.py makemigrations hkey | ||
RUN python manage.py migrate | ||
RUN demo_data/import.sh | ||
|
||
EXPOSE 9000 | ||
CMD python manage.py runserver 0.0.0.0:9000 | ||
# Load fixture data | ||
RUN python manage.py loaddata fixtures/auth_group.json | ||
RUN python manage.py loaddata fixtures/hkey_grouper.json | ||
RUN python manage.py loaddata fixtures/hkey_huser.json | ||
RUN python manage.py loaddata fixtures/hkey_memberof.json | ||
# RUN demo_data/import.sh | ||
|
||
# HTTPS version | ||
EXPOSE 9001 | ||
CMD python manage.py runsslserver 0.0.0.0:9001 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can expose more than one port but you can't have multiple |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,31 +12,54 @@ pre-commit install | |
## Run locally using docker | ||
|
||
```bash | ||
docker build -t demo-cas-server . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example image tag really should be |
||
docker-compose up | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's no docker compose config here so not sure where this came from |
||
``` | ||
|
||
## Run locally the old way | ||
## Run locally | ||
|
||
``` | ||
python manage.py migrate | ||
./demo_data/import.sh | ||
# HTTP | ||
python manage.py runserver 9000 | ||
|
||
# HTTPS | ||
python manage.py runsslserver 127.0.0.1:9001 & | ||
``` | ||
|
||
## Default user/passwd combos | ||
|
||
| username | password | | ||
| -------- | -------- | | ||
| admin | testinstructor | | ||
| admin | rivendel | | ||
| dr_fauci | testinstructor | ||
| producer | | | ||
| nancy | | | ||
| joe | teststudent | | ||
| dokiadmin| okaydoki | | ||
| dokistaff| okaydoki | | ||
| dokiuser | okaydoki | | ||
|
||
(dr_fauci has 2 courses) | ||
|
||
|
||
|
||
## Test | ||
|
||
Open `http://127.0.0.1:9000/cas/login` | ||
|
||
--- | ||
or | ||
|
||
Open `https://127.0.0.1:9001/cas/login` | ||
|
||
## To use the https service as a demo cas server (in porta or doki) | ||
|
||
Add these settings to .env or to <project>/settings.py | ||
|
||
# Point to the service using https | ||
CAS_SERVER_URL=https://localhost:9001/cas/ | ||
|
||
# Turn off ssl VERIFICATION to use self signed certs | ||
CAS_VERIFY_SSL_CERTIFICATE=False | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
"django.contrib.staticfiles", | ||
"hkey", | ||
"mama_cas", | ||
"sslserver", | ||
] | ||
|
||
MIDDLEWARE = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,9 @@ | |
2,pbkdf2_sha256$100000$vpLqcspQX5JY$FkmPtG7d7AbKZRwXwEwnIr5MF7Ti5Nh2bdavIqRTBFk=,"2020-07-20 21:49:03.312501",0,nancy,nancy,gray,[email protected],0,1,"2020-06-15 19:00:13",123456789,123456789 | ||
3,pbkdf2_sha256$100000$BBlXz2KTGLEl$QW5HJcJ71LXJl/LCrljS2qLYeYPCfuc3irdZBh/dBX8=,"2021-04-12 17:35:51.676268",0,joe,Joe,Blow,[email protected],0,1,"2020-06-15 19:11:06",123xid567, | ||
4,pbkdf2_sha256$100000$0vnPFeuunzAP$EjQYw+mJtM2xiDZmaY2ify3XLwbiHmEFl1UGeM23VTs=,"2021-04-12 17:35:09.763324",0,dr_fauci,Anthony,Fauci,[email protected],0,1,"2020-06-17 23:16:43",7778889999,7778889999 | ||
5,pbkdf2_sha256$100000$tfuAvIbn11g5$ndX/mlBaoelMOtY/pTIyE4I9sxqtwS/j1DiWpt2zux0=,"2020-07-31 20:52:20.446621",0,producer,The,Producer,[email protected],1,1,"2020-07-17 16:19:58",1234556,1234556 | ||
5,pbkdf2_sha256$100000$tfuAvIbn11g5$ndX/mlBaoelMOtY/pTIyE4I9sxqtwS/j1DiWpt2zux0=,"2020-07-31 20:52:20.446621",0,producer,The,Producer,[email protected],1,1,"2020-07-17 16:19:58",12345567,12345567 | ||
6,pbkdf2_sha256$100000$IIBHRthVIi5O$tAfAxWwhldheReyIqA6XR64vbUvwJULQfh68gG8SRAI=,"2020-07-28 21:22:35.093330",0,dr_birx,Deborah,Birx,[email protected],0,1,"2020-07-24 22:40:19",66613369,66613369 | ||
7,pbkdf2_sha256$150000$gokOBrztYYha$Cbefreo0TC13zKWNXRRPWYwKuLfPK+q3F5O+1t3T0QQ=,"2023-02-27 21:24:21.665202",0,support,Tech,Support,,0,1,"2022-10-14 19:48:05",11223344,11223344 | ||
8,pbkdf2_sha256$150000$1RhoRzwzI1Jd$M7UXl93tY1vk5ryey7LOcAFnTgbeQ2LFaQXp/UEAAEM=,,0,dokiadmin,Admin,Doki,,0,1,2023-11-14 23:09:33,56785678,56785678 | ||
9,pbkdf2_sha256$150000$RNU2zu9sY5Zb$wzXdehfW1cmeJETo5bcXvRC3tm644yEF/9CZXR25jjA=,,0,dokistaff,Producer,Doki,,0,1,2023-11-14 23:12:16,567891234,567891234 | ||
10,pbkdf2_sha256$150000$TnW5Niqjb931$WdmLN/G1jocJ1nE5olNZ6sm6/Ze7DcncSbfwSftqJ/o=,,0,dokiworker,Worker,Doki,,0,1,2023-11-14 23:13:02,567891233,567891233 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
4,1,3 | ||
5,5,3 | ||
4,1,1 | ||
5,5,1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,10 @@ | |
20,35,5 | ||
21,35,1 | ||
22,46,4 | ||
23,48,5 | ||
25,50,4 | ||
26,49,7 | ||
27,50,4 | ||
28,51,8 | ||
29,52,9 | ||
30,53,10 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/bin/sh | ||
|
||
SCRIPTDIR=$(dirname $(readlink -f $0)) | ||
#SCRIPTDIR=$(dirname $(readlink -f $0)) | ||
SCRIPTDIR=./demo_data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the point of the command to figure out the |
||
|
||
for f in ${SCRIPTDIR}/*.csv; do | ||
tablename=$(basename $f .csv) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"model": "auth.group", | ||
"pk": 1, | ||
"fields": { | ||
"name": "harvard:ref:courses:ext:2021:fall:589764-staff", | ||
"permissions": [] | ||
} | ||
}, | ||
{ | ||
"model": "auth.group", | ||
"pk": 2, | ||
"fields": { | ||
"name": "ChangeGrouper", | ||
"permissions": [ | ||
26 | ||
] | ||
} | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have been switching to the
local
repo config method for pre-commit. Instead of having to specify a version and repo url for black and flake it just uses whatever you currently have installed in the virtualenv. It's soooo much easier and I cannot understand why it isn't the default. AFAICT there's no downside.See my recent PR for the porta package updates for an example.