Skip to content

Commit

Permalink
Merge pull request #1459 from codalab/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
Didayolo authored May 28, 2024
2 parents a4116d2 + 9b4639d commit bf4b9b5
Show file tree
Hide file tree
Showing 19 changed files with 133 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ MAX_EXECUTION_TIME_LIMIT=600 # time limit for the default queue (in seconds)
DOMAIN_NAME=localhost:80

# SSL style domain definition
TLS_EMAIL=your@email.com
# DOMAIN_NAME=example.com:443
# TLS_EMAIL=your@email.com

RABBITMQ_HOST=rabbit
RABBITMQ_DEFAULT_USER=rabbit-username
Expand Down
30 changes: 18 additions & 12 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
{$DOMAIN_NAME} {
# HTTPS options:
# HTTPS Options
tls {$TLS_EMAIL}


# Test HTTPS setup
# tls {$TLS_EMAIL} {
# ca https://acme-staging-v02.api.letsencrypt.org/directory
# }


# Removing some headers for improved security:
header / -Server
header -Server

# Serves static files, should be the same as `STATIC_ROOT` setting:
root /var/www/django

# Serving dynamic requests:
proxy / django:8000 {
except /static /media
transparent
websocket
root * /var/www/django
file_server

@noStatic {
not path /static/*
not path /media/*
}

# Serving dynamic requests:
reverse_proxy @noStatic django:8000

# Allows to use `.gz` files when available:
gzip
encode gzip

# Logs:
log stdout
errors stdout
log {
output stdout
format console
}
}
39 changes: 20 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ services:
# Web Services
#-----------------------------------------------
caddy:
image: abiosoft/caddy:1.0.3
image: caddy:2.7.6
env_file: .env
environment:
- ACME_AGREE=true
volumes:
- ./Caddyfile:/etc/Caddyfile
- ./Caddyfile:/etc/caddy/Caddyfile
- ./src/staticfiles:/var/www/django/static
- ./certs/caddy:/etc/caddycerts
- ./caddy_data:/data
- ./caddy_config:/config
restart: unless-stopped
ports:
- 80:80
Expand Down Expand Up @@ -42,8 +43,8 @@ services:
tty: true
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"


#-----------------------------------------------
Expand Down Expand Up @@ -99,8 +100,8 @@ services:
restart: unless-stopped
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"


#-----------------------------------------------
Expand All @@ -120,8 +121,8 @@ services:
restart: unless-stopped
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"

#-----------------------------------------------
# Rabbitmq & Flower monitoring tool
Expand All @@ -148,8 +149,8 @@ services:
restart: unless-stopped
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"

flower:
# image: mher/flower
Expand All @@ -166,8 +167,8 @@ services:
- rabbit
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"

#-----------------------------------------------
# Redis
Expand All @@ -179,8 +180,8 @@ services:
restart: unless-stopped
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"

#-----------------------------------------------
# Celery Service
Expand All @@ -200,8 +201,8 @@ services:
restart: unless-stopped
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"
deploy:
resources:
limits:
Expand Down Expand Up @@ -230,5 +231,5 @@ services:
- CODALAB_IGNORE_CLEANUP_STEP=1
logging:
options:
max-size: "20k"
max-file: "10"
max-size: "20m"
max-file: "5"
2 changes: 2 additions & 0 deletions src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ def save(self, *args, **kwargs):
pass
elif not self.logo_icon:
self.make_logo_icon()
self.save()
elif os.path.dirname(self.logo.name) != os.path.dirname(self.logo_icon.name):
self.make_logo_icon()
self.save()
to_create = User.objects.filter(
Q(id=self.created_by_id) | Q(id__in=self.collaborators.all().values_list('id', flat=True))
).exclude(id__in=self.participants.values_list('user_id', flat=True)).distinct()
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/competitions/detail/_tabs.tag
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
data-tab="_tab_page_term">
Terms
</div>
<div class="{active: _.get(competition.pages, 'length') === 0} item" data-tab="files">
<div if={competition.files.length != 0} class="{active: _.get(competition.pages, 'length') === 0} item" data-tab="files">
Files
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/competitions/detail/submission_upload.tag
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<select name="organizations" id="organization_dropdown" class="ui dropdown">
<option value="None">Yourself</option>
<option each="{org in organizations}" value="{org.id}">{org.name}</option>
<option if="{_.size(organizations) === 0}" value="add_organization">+ Add New Organizaiton</option>
<option if="{_.size(organizations) === 0}" value="add_organization">+ Add New Organization</option>
</select>

</div>
Expand Down
46 changes: 30 additions & 16 deletions src/templates/emails/base_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@
<title></title>

<style>
/*

text: #666666
links: #739cb9

palette medium: #7A8D92
palette light: #A6C6D1
palette teal: #67B8C7
*/
html, body {
font-size: 18px;
line-height: 28px;
background-color: #f7f7f7;
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
}
body {
/*padding: 20px;*/
.container {
width: 100%;
max-width: 600px;
margin: auto;
border: 1px solid #dddddd;
background-color: #ffffff;
}
.header_img {
width: 40%;
}
.header {
width: 100%;
background-color: #2D3E4C;
min-height: 110px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 10px;
}
.content{
padding: 20px;
}
h1 {
font-size: 41px;
Expand Down Expand Up @@ -57,6 +67,7 @@
color: #ccc;
font-size: 11px;
line-height: 18px;
text-align: center;
}
blockquote {
color: #555555;
Expand All @@ -78,10 +89,10 @@
</style>
</head>
<body>
<div class = "container">
<div class = "content">
<h3>Hello{% if user %} {{ user.username }}{% endif %},</h3>

<div id="header">
<h1>Hello{% if user %} {{ user.username }}{% endif %},</h1>
</div>

{% block title %}
{% endblock %}
Expand All @@ -92,13 +103,16 @@ <h1>Hello{% if user %} {{ user.username }}{% endif %},</h1>
{% if not mass_email %}
<div id="signature">
<p>Thanks,</p>

<p>Codabench Team</p>
<div class = "header">
<img class = "header_img" src = "../../static/img/codabench.png" alt = "codabench_logo" />
</div>
</div>
{% endif %}

</div>
<div id="footer">
<p><a href="http://{{ site.domain }}">Unsubscribe or manage notification settings</a> | <a href="https://github.com/codalab/codalab-competitions/wiki/Privacy">Privacy policy</a></p>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% extends 'emails/base_email.html' %}

{% block content %}
<p>The user {{ participant.user.username }} was accepted into your competition:</p>
<a href="http://
{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>

<p>Participants can be managed from the admin tab of your competition</p>
<p>We're writing to inform you that user {{ participant.user.username }} has been accepted into your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'emails/base_email.txt' %}
{% extends 'emails/base_email.html' %}

{% block content %}
The user {{ participant.user.username }} was accepted into your competition:
{{ participant.competition.title }} -> http://{{ site.domain }}{{ participant.competition.get_absolute_url }}

Participants can be managed from the admin tab of your competition
<p>We're writing to inform you that user {{ participant.user.username }} has been accepted into your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% extends 'emails/base_email.html' %}

{% block content %}
<p>The user {{ participant.user.username }} was denied permission to your competition:</p>
<a href="http://
{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>

<p>Participants can be managed from the admin tab of your competition.</p>
<p>We're writing to inform you that user {{ participant.user.username }} has been denied to your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'emails/base_email.txt' %}
{% extends 'emails/base_email.html' %}

{% block content %}
The user {{ participant.user.username }} was revoked permission to your competition:
{{ participant.competition.title }} -> http://{{ site.domain }}{{ participant.competition.get_absolute_url }}

Participants can be managed from the admin tab of your competition
<p>We're writing to inform you that user {{ participant.user.username }} has been denied to your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'emails/base_email.html' %}

{% block content %}
<p>The user {{ participant.user.username }} requested access to your competition:</p>
<a href="http://
{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>
<p>Participants can be managed from the admin tab of your competition</p>
<p>We're writing to inform you that user {{ participant.user.username }} has requested access to your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'emails/base_email.txt' %}
{% extends 'emails/base_email.html' %}

{% block content %}
The user {{ participant.user.username }} requested access to your competition:
{{ participant.competition.title }} -> http://{{ site.domain }}{{ participant.competition.get_absolute_url }}

Participants can be managed from the admin tab of your competition
<p>We're writing to inform you that user {{ participant.user.username }} has requested access to your competition
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>.You can manage all participants from the admin panel of your competition.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{% extends 'emails/base_email.html' %}

{% block content %}
<p>This is a message updating your access to the competition:</p>
<p>We're thrilled to inform you that your application for the
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>

<p>Your status has been accepted!</p>
competition has been <b>accepted</b>. Get ready to showcase your skills and compete with other talented individuals.</p>
<p>We look forward to seeing your participation.</p>
{% endblock %}



Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% extends 'emails/base_email.txt' %}
{% extends 'emails/base_email.html' %}

{% block content %}
This is a message updating your access to the competition:
{{ participant.competition.title }} -> http://{{ site.domain }}{{ participant.competition.get_absolute_url }}
<p>We're thrilled to inform you that your application for the
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>
competition has been <b>accepted</b>. Get ready to showcase your skills and compete with other talented individuals.</p>
<p>We look forward to seeing your participation.</p>
{% endblock %}


Your status has been accepted!

{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{% extends 'emails/base_email.html' %}

{% block content %}
<p>This is a message updating your access to the competition:</p>
<p>We're writing to inform you about your application for the
<a href="http://{{ site.domain }}{{ participant.competition.get_absolute_url }}">{{ participant.competition.title }}</a>

<p>Your participation privileges have been denied.</p>
competition. While your application was carefully considered, we regret to inform you that your participation privileges
have been denied. We encourage you to review the competition details and rules to see if there are areas where you can
improve your application for future competitions. </p>
<p>Thank you for your interest in the competition. We wish you the best of luck in your future endeavors.
</p>

{% endblock %}


Loading

0 comments on commit bf4b9b5

Please sign in to comment.