Skip to content

Commit bc087a3

Browse files
Merge pull request #70 from FSU-ACM/dev
flower task monitoring + dependency updates + email quarantine mitigation
2 parents b030bdc + 5fa0589 commit bc087a3

File tree

12 files changed

+303
-289
lines changed

12 files changed

+303
-289
lines changed

Pipfile

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ mysqlclient = "*"
99
django-redis = "*"
1010
django-import-export = "*"
1111
celery = "*"
12-
flower = "*"
1312
gunicorn = "*"
1413
six = "*"
1514

Pipfile.lock

+193-213
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/dev/docker-compose.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ services:
5858
- redis
5959
- rabbitmq
6060
- mariadb
61+
flower:
62+
image: mher/flower:latest
63+
command: celery --broker=amqp://rabbitmq:5672// flower --broker_api=http://guest:guest@rabbitmq:15672/api/vhost
64+
ports:
65+
- 5555:5555
66+
networks:
67+
- contestsuite-dev
68+
depends_on:
69+
- redis
70+
- rabbitmq
71+
- celery_worker
6172
mariadb:
6273
image: mariadb:10.5-focal
6374
volumes:
@@ -76,7 +87,10 @@ services:
7687
networks:
7788
- contestsuite-dev
7889
rabbitmq:
79-
image: rabbitmq:3
90+
image: rabbitmq:3-management-alpine
91+
ports:
92+
- 5672:5672
93+
- 15672:15672
8094
volumes:
8195
- rabbit_data:/var/lib/rabbitmq
8296
networks:

deploy/prod/contestsuite/config/nginx.conf

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
upstream contestsuite_django {
22
server django:8000;
33
}
4+
upstream contestsuite_flower {
5+
server flower:5555;
6+
}
47

58
server {
69
listen 80;
@@ -13,6 +16,15 @@ server {
1316
proxy_redirect off;
1417
}
1518

19+
location ~ ^/flower/? {
20+
proxy_pass http://contestsuite_flower;
21+
proxy_set_header Host $host;
22+
proxy_http_version 1.1;
23+
proxy_set_header Upgrade $http_upgrade;
24+
proxy_set_header Connection "upgrade";
25+
proxy_redirect off;
26+
}
27+
1628
location /static {
1729
aio on;
1830
autoindex off;

deploy/prod/contestsuite/docker-compose.yaml

+49-38
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ services:
66
environment:
77
LETSENCRYPT_HOST: contest.cs.fsu.edu
88
VIRTUAL_HOST: contest.cs.fsu.edu
9+
VIRTUAL_PATH: /
910
volumes:
1011
- ./config/nginx.conf:/etc/nginx/conf.d/nginx.conf:ro
1112
- django_static_data:/usr/share/nginx/html/static:ro
@@ -60,6 +61,53 @@ services:
6061
parallelism: 1
6162
delay: 5s
6263
failure_action: rollback
64+
celery_worker:
65+
image: acmfsu/contestsuite:latest
66+
command: /app/start-celeryworker
67+
environment:
68+
- DEBUG=False
69+
- ALLOWED_HOSTS=contest.cs.fsu.edu,0.0.0.0
70+
- SECRET_KEY=86@j2=z!=&1r_hoqboog1#*mb$jx=9mf0uw#hrs@lw&7m34sqz
71+
72+
- CACHE_TIMEOUT=300
73+
- CACHE_LOCATION=redis://redis:6379/0
74+
- CELERY_BACKEND=redis://redis:6379/1
75+
- CELERY_BROKER=amqp://rabbitmq:5672
76+
77+
- MAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
78+
- MAIL_HOST=smtpsubdomain.example.com
79+
- MAIL_PORT=465
80+
- MAIL_USER=user@example.com
81+
- MAIL_PASSWORD=examplepass
82+
83+
- SQL_HOST=mariadb
84+
- SQL_PORT=3306
85+
- SQL_DATABASE=contestsuite
86+
- SQL_USER=contestadmin
87+
- SQL_PASSWORD=seminoles
88+
volumes:
89+
- django_app_data:/app/media
90+
networks:
91+
- mariadb-backend
92+
- redis-backend
93+
- rabbitmq-backend
94+
deploy:
95+
rollback_config:
96+
parallelism: 0
97+
update_config:
98+
parallelism: 1
99+
delay: 5s
100+
failure_action: rollback
101+
flower:
102+
image: mher/flower:latest
103+
command: celery --broker=amqp://rabbitmq:5672// flower --broker_api=http://guest:guest@rabbitmq:15672/api/vhost --url_prefix=flower --basic_auth=contestadmin:seminoles1!
104+
environment:
105+
- CELERY_TIMEZONE=America/New_York
106+
volumes:
107+
- flower_data:/data
108+
networks:
109+
- nginx_backend
110+
- rabbitmq-backend
63111
mariadb:
64112
image: mariadb:10.6-focal
65113
volumes:
@@ -92,7 +140,7 @@ services:
92140
delay: 5s
93141
failure_action: rollback
94142
rabbitmq:
95-
image: rabbitmq:3
143+
image: rabbitmq:3-management-alpine
96144
volumes:
97145
- rabbit_data:/var/lib/rabbitmq
98146
networks:
@@ -104,43 +152,6 @@ services:
104152
parallelism: 1
105153
delay: 5s
106154
failure_action: rollback
107-
celery_worker:
108-
image: acmfsu/contestsuite:latest
109-
command: /app/start-celeryworker
110-
environment:
111-
- DEBUG=False
112-
- ALLOWED_HOSTS=contest.cs.fsu.edu,0.0.0.0
113-
- SECRET_KEY=86@j2=z!=&1r_hoqboog1#*mb$jx=9mf0uw#hrs@lw&7m34sqz
114-
115-
- CACHE_TIMEOUT=300
116-
- CACHE_LOCATION=redis://redis:6379/0
117-
- CELERY_BACKEND=redis://redis:6379/1
118-
- CELERY_BROKER=amqp://rabbitmq:5672
119-
120-
- MAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
121-
- MAIL_HOST=smtpsubdomain.example.com
122-
- MAIL_PORT=465
123-
- MAIL_USER=user@example.com
124-
- MAIL_PASSWORD=examplepass
125-
126-
- SQL_HOST=mariadb
127-
- SQL_PORT=3306
128-
- SQL_DATABASE=contestsuite
129-
- SQL_USER=contestadmin
130-
- SQL_PASSWORD=seminoles
131-
volumes:
132-
- django_app_data:/app/media
133-
networks:
134-
- mariadb-backend
135-
- redis-backend
136-
- rabbitmq-backend
137-
deploy:
138-
rollback_config:
139-
parallelism: 0
140-
update_config:
141-
parallelism: 1
142-
delay: 5s
143-
failure_action: rollback
144155
volumes:
145156
django_app_data:
146157
django_db_data:

requirements-dev.txt

+16-17
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,52 @@
99
# requirements. To emit only development requirements, pass "--dev-only".
1010

1111
-i https://pypi.python.org/simple
12-
amqp==5.0.9; python_version >= '3.6'
12+
amqp==5.1.0; python_version >= '3.6'
1313
asgiref==3.5.0; python_version >= '3.7'
14-
astroid==2.9.3; python_full_version >= '3.6.2'
14+
astroid==2.11.2; python_full_version >= '3.6.2'
15+
async-timeout==4.0.2; python_version >= '3.6'
1516
autopep8==1.6.0
1617
billiard==3.6.4.0
17-
celery==5.2.3
18+
celery==5.2.5
1819
click-didyoumean==0.3.0; python_full_version >= '3.6.2' and python_full_version < '4.0.0'
1920
click-plugins==1.1.1
2021
click-repl==0.2.0
21-
click==8.0.3; python_version >= '3.6'
22+
click==8.1.2; python_version >= '3.7'
2223
defusedxml==0.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
2324
deprecated==1.2.13; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
2425
diff-match-patch==20200713; python_version >= '2.7'
26+
dill==0.3.4; python_version >= '2.7' and python_version != '3.0'
2527
django-debug-toolbar==3.2.4
26-
django-import-export==2.7.1
28+
django-import-export==2.8.0
2729
django-redis==5.2.0
2830
django==3.2.12
2931
et-xmlfile==1.1.0; python_version >= '3.6'
30-
flower==1.0.0
3132
gunicorn==20.1.0
32-
humanize==4.0.0; python_version >= '3.7'
3333
isort==5.10.1; python_version < '4.0' and python_full_version >= '3.6.1'
34-
kombu==5.2.3; python_version >= '3.7'
34+
kombu==5.2.4; python_version >= '3.7'
3535
lazy-object-proxy==1.7.1; python_version >= '3.6'
3636
markuppy==1.14
37-
mccabe==0.6.1
37+
mccabe==0.7.0; python_version >= '3.6'
3838
mysqlclient==2.1.0
3939
odfpy==1.4.1
4040
openpyxl==3.0.9
4141
packaging==21.3; python_version >= '3.6'
42-
platformdirs==2.5.0; python_version >= '3.7'
43-
prometheus-client==0.13.1; python_version >= '3.6'
44-
prompt-toolkit==3.0.28; python_full_version >= '3.6.2'
42+
platformdirs==2.5.1; python_version >= '3.7'
43+
prompt-toolkit==3.0.29; python_full_version >= '3.6.2'
4544
pycodestyle==2.8.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
46-
pylint==2.12.2
45+
pylint==2.13.4
4746
pyparsing==3.0.7; python_version >= '3.6'
48-
pytz==2021.3
47+
pytz==2022.1
4948
pyyaml==6.0
50-
redis==4.1.4; python_version >= '3.6'
49+
redis==4.2.2; python_version >= '3.6'
5150
six==1.16.0
5251
sqlparse==0.4.2; python_version >= '3.5'
5352
tablib[html,ods,xls,xlsx,yaml]==3.2.0; python_version >= '3.7'
5453
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
55-
tornado==6.1; python_version >= '3.5'
54+
tomli==2.0.1; python_version < '3.11'
5655
typing-extensions==4.1.1; python_version < '3.10'
5756
vine==5.0.0; python_version >= '3.6'
5857
wcwidth==0.2.5
59-
wrapt==1.13.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
58+
wrapt==1.14.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
6059
xlrd==2.0.1
6160
xlwt==1.3.0

requirements.txt

+10-13
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,39 @@
66
#
77

88
-i https://pypi.python.org/simple
9-
amqp==5.0.9; python_version >= '3.6'
9+
amqp==5.1.0; python_version >= '3.6'
1010
asgiref==3.5.0; python_version >= '3.7'
11+
async-timeout==4.0.2; python_version >= '3.6'
1112
billiard==3.6.4.0
12-
celery==5.2.3
13+
celery==5.2.5
1314
click-didyoumean==0.3.0; python_full_version >= '3.6.2' and python_full_version < '4.0.0'
1415
click-plugins==1.1.1
1516
click-repl==0.2.0
16-
click==8.0.3; python_version >= '3.6'
17+
click==8.1.2; python_version >= '3.7'
1718
defusedxml==0.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
1819
deprecated==1.2.13; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
1920
diff-match-patch==20200713; python_version >= '2.7'
20-
django-import-export==2.7.1
21+
django-import-export==2.8.0
2122
django-redis==5.2.0
2223
django==3.2.12
2324
et-xmlfile==1.1.0; python_version >= '3.6'
24-
flower==1.0.0
2525
gunicorn==20.1.0
26-
humanize==4.0.0; python_version >= '3.7'
27-
kombu==5.2.3; python_version >= '3.7'
26+
kombu==5.2.4; python_version >= '3.7'
2827
markuppy==1.14
2928
mysqlclient==2.1.0
3029
odfpy==1.4.1
3130
openpyxl==3.0.9
3231
packaging==21.3; python_version >= '3.6'
33-
prometheus-client==0.13.1; python_version >= '3.6'
34-
prompt-toolkit==3.0.28; python_full_version >= '3.6.2'
32+
prompt-toolkit==3.0.29; python_full_version >= '3.6.2'
3533
pyparsing==3.0.7; python_version >= '3.6'
36-
pytz==2021.3
34+
pytz==2022.1
3735
pyyaml==6.0
38-
redis==4.1.4; python_version >= '3.6'
36+
redis==4.2.2; python_version >= '3.6'
3937
six==1.16.0
4038
sqlparse==0.4.2; python_version >= '3.5'
4139
tablib[html,ods,xls,xlsx,yaml]==3.2.0; python_version >= '3.7'
42-
tornado==6.1; python_version >= '3.5'
4340
vine==5.0.0; python_version >= '3.6'
4441
wcwidth==0.2.5
45-
wrapt==1.13.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
42+
wrapt==1.14.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
4643
xlrd==2.0.1
4744
xlwt==1.3.0

src/checkin/tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def send_credentials(username):
1313
user = User.objects.get(username=username)
1414

15-
subject = 'Your DOMjudge Credentials'
15+
subject = user.first_name+', you are checked-in!'
1616
message = render_to_string('checkin/team_credentials_email.html', {'user': user})
1717
user.email_user(subject, message)
1818

src/checkin/templates/checkin/team_credentials_email.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
username: {{ user.profile.team.contest_id }}
1313
password: {{ user.profile.team.contest_password }}
1414

15-
IMPORTANT: Do NOT select 'Leave' in the Team panel of your account dashboard. This will check you out of the contest and make you ineligible for extra credit.
15+
IMPORTANT: Do NOT select 'Leave' in the Team panel of your account dashboard. This will check you out of the contest and make you ineligible for extra credit.
1616

1717
Cheers,
1818
The Programming Contest Team

src/checkin/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def checkin(request):
8282
messages.success(request, str(user.first_name) +
8383
', you are checked in!', fail_silently=True)
8484
messages.info(
85-
request, 'Check your registered email or account dashboard for DOMJudge credentials.', fail_silently=True)
85+
request, 'Check your registered email or account dashboard for DOMjudge credentials.', fail_silently=True)
8686
else:
8787
messages.error(
8888
request, 'Invalid card read. Please try again.', fail_silently=True)
@@ -117,7 +117,7 @@ def checkin(request):
117117
# Email user DOMjudge credentials
118118
tasks.send_credentials.delay(user.username)
119119
messages.success(request, str(user.first_name) + ', you are checked in!', fail_silently=True)
120-
messages.info(request, 'Check your registered email or account dashboard for DOMJudge credentials.', fail_silently=True)
120+
messages.info(request, 'Check your registered email or account dashboard for DOMjudge credentials.', fail_silently=True)
121121

122122
else:
123123
messages.error(request, 'Invalid form submission. Please resubmit your information.', fail_silently=True)

src/core/templates/core/base.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@
8888
<a class="nav-link dropdown-toggle active" href="#" id="navbardrop" data-toggle="dropdown">{{ user.first_name }}</a>
8989
<div class="dropdown-menu dropdown-menu-right">
9090
{% if user.is_superuser %}
91-
<a class="dropdown-item" href="{% url 'admin:index' %}">Django Admin</a>
91+
<a class="dropdown-item" href="{% url 'admin:index' %}" target="_blank">Django Admin</a>
9292
<a class="dropdown-item" href="{% url 'admin_dashboard' %}">Contest Dashboard</a>
93+
<a class="dropdown-item" href="https://contest.cs.fsu.edu/flower/" target="_blank">Flower Dashboard</a>
9394
<hr>
9495
<a class="dropdown-item" href="{% url 'checkin' %}">Contest Check-in</a>
9596
<a class="dropdown-item" href="{% url 'volunteer_checkin' %}">Volunteer Check-in</a>
9697
<hr>
9798
{% elif user.profile.is_volunteer %}
9899
{% if user.profile.role == 4%}
99100
<a class="dropdown-item" href="{% url 'admin_dashboard' %}">Contest Dashboard</a>
101+
<a class="dropdown-item" href="https://contest.cs.fsu.edu/flower/" target="_blank">Flower Dashboard</a>
100102
<hr>
101103
{% endif %}
102104
<a class="dropdown-item" href="{% url 'checkin' %}">Contest Check-in</a>

src/core/templates/core/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h4 class="card-title mb-0">{{ announcement.title }}</h4>
4949
</div>
5050
</div>
5151

52-
<p class="lead text-center mb-1">An <a href="https://icpc.global" target="_blank" rel="external">ICPC</a> style contest hosted semesterly by the Association for Computing Machinery Florida State University Student Chapter.</p>
52+
<p class="lead text-center mb-1">An <a href="https://icpc.global" target="_blank" rel="external">ICPC</a> style contest hosted semesterly by the Florida State University Association for Computing Machinery Student Chapter.</p>
5353

5454
<hr>
5555
<div class="row justify-content-center">

0 commit comments

Comments
 (0)