Skip to content
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

Merge webinfra 1/1 #179

Merged
merged 91 commits into from
Jan 2, 2021
Merged
Show file tree
Hide file tree
Changes from 89 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
eebb473
added score to set_outcome endpoint
opheez Dec 26, 2020
3a556f6
update db with score val, score is now winscore
opheez Dec 27, 2020
39bb8ef
add score to frontend, migration file
opheez Dec 27, 2020
d5d69cb
frontend update
opheez Dec 27, 2020
efe6cb4
added losescore
opheez Dec 27, 2020
a71dbb0
correctly handle null/error
opheez Dec 27, 2020
9c60872
Simplify a line
n8kim1 Dec 25, 2020
62340a4
Note that submissions should be enabled
n8kim1 Dec 25, 2020
080fe91
TODO write up cors things
n8kim1 Dec 25, 2020
79f6e00
Listing more TODOs
n8kim1 Dec 25, 2020
a13ccdb
Add bucket CORS setup notes
n8kim1 Dec 27, 2020
3e4562d
Notes about CORS, Google App creds
n8kim1 Dec 27, 2020
0fd11d5
Improve setting google app creds env in deployment
n8kim1 Dec 27, 2020
9fc6f52
Set upload origin for proper cors
n8kim1 Dec 28, 2020
edd752f
Format json
n8kim1 Dec 28, 2020
084f146
Extra header tha t might be necessary
n8kim1 Dec 28, 2020
f03b249
Move compilation update callback to on success
n8kim1 Dec 28, 2020
463919f
Better error logging/formatting
n8kim1 Dec 28, 2020
428fa51
Add a bunch of TODOs for in this branch
n8kim1 Dec 28, 2020
7aac8ac
moar TODOs
n8kim1 Dec 28, 2020
d9ed64e
Even more TODOs
n8kim1 Dec 28, 2020
9f8f272
Add newline at end of file
n8kim1 Dec 28, 2020
61ea088
THIS_URL setting improve, use in cors origin
n8kim1 Dec 28, 2020
c4cee49
Add call to compile pub/sub
n8kim1 Dec 28, 2020
80d2670
In-progress Endpoint to call compilation pubsub
n8kim1 Dec 28, 2020
bdb5ff6
New compile statuses
n8kim1 Dec 28, 2020
e606db9
Implement use of new status codes
n8kim1 Dec 28, 2020
2fa0fa9
Put the pub-sub call where it should be
n8kim1 Dec 28, 2020
0304c5f
Serializer, data needed
n8kim1 Dec 28, 2020
a2e05c0
Properly get submission id
n8kim1 Dec 28, 2020
7dd9393
Frontend pokes the new endpoint
n8kim1 Dec 28, 2020
fd42b25
Explanatory notes
n8kim1 Dec 28, 2020
6b835e1
remove some completed TODOs
n8kim1 Dec 28, 2020
e0895ee
More explanatory notes
n8kim1 Dec 28, 2020
1b2a08b
Updates to TODOs (revisions, better places for them)
n8kim1 Dec 28, 2020
e8d6430
Merge pull request #172 from battlecode/webinfra-submit-better
n8kim1 Dec 29, 2020
ab21914
Show table for latest submission
n8kim1 Dec 29, 2020
1999400
Remove resolved TODOs
n8kim1 Dec 29, 2020
84a8e9f
Placeholder for current submission status
n8kim1 Dec 29, 2020
584e1dd
Add compilation status display for most recent submission
n8kim1 Dec 29, 2020
263b9d5
Fix current submission's comp status messages
n8kim1 Dec 29, 2020
9e18418
Properly handle the first successful submission
n8kim1 Dec 29, 2020
5132e0a
Simplify messages shown with no prev submissions
n8kim1 Dec 29, 2020
7ba5c74
Remove obsolete code
n8kim1 Dec 29, 2020
81e79a7
Remove a cluttered header
n8kim1 Dec 29, 2020
628a966
Hide download button if code not downloadable
n8kim1 Dec 29, 2020
e679b52
Track submission upload process; show errors in frontend
n8kim1 Dec 29, 2020
e5a1d4f
Make sure to refresh all tables when necessary
n8kim1 Dec 29, 2020
484e1e1
Manual safeguard for upload process
n8kim1 Dec 29, 2020
77e5d0d
Better name / use for upload status code
n8kim1 Dec 29, 2020
22782d0
Remove unused/possibly buggy methods
n8kim1 Dec 29, 2020
0847452
Better explanation of having to refresh to see table update
n8kim1 Dec 29, 2020
70be42a
Add explanatory notes
n8kim1 Dec 29, 2020
08989bd
Extra explanation about polling
n8kim1 Dec 29, 2020
5295d0c
Remove debug prints, etc
n8kim1 Dec 29, 2020
7be74a9
Instructions on changing instance template
n8kim1 Dec 29, 2020
db39781
Merge pull request #166 from battlecode/webinfra-scrim-score
opheez Dec 29, 2020
4bded2a
Merge pull request #177 from battlecode/webinfra-submit-better-2
n8kim1 Dec 29, 2020
dfe8fda
Add notes about .env files
n8kim1 Dec 30, 2020
36d563d
Note about updating .env.production
n8kim1 Dec 30, 2020
5b01cf7
Explain access.txt
n8kim1 Dec 30, 2020
e50f353
Align some stuff, for #179
n8kim1 Dec 30, 2020
659c955
More style fixes for #179
n8kim1 Dec 30, 2020
d2e10f9
Remove pub.py
n8kim1 Dec 30, 2020
7a8ba10
Add explanatory notes
n8kim1 Dec 30, 2020
0acc96f
Change code to match updated examples
n8kim1 Dec 30, 2020
dabaff4
Make data mandatory to pass in for pub method
n8kim1 Dec 30, 2020
0233ff3
Remove debug
n8kim1 Dec 30, 2020
354216c
Explanatory comments for #179
n8kim1 Dec 30, 2020
6d63034
More explanatory notes for #179
n8kim1 Dec 30, 2020
ff4c42f
Simplify math for checking invalid score (for #179)
n8kim1 Dec 30, 2020
28365be
rename sub_status -> upload_status for #179
n8kim1 Dec 30, 2020
fbbc5a0
submission_upload_status -> upload_status_cookie for clarity for #179
n8kim1 Dec 30, 2020
964013f
Change upload_status values to be distinct from compilation_status
n8kim1 Dec 30, 2020
be275f5
Add documentation, some headers
n8kim1 Dec 31, 2020
5f7e350
Add some content
n8kim1 Jan 1, 2021
0c5f24e
Fix headers
n8kim1 Jan 1, 2021
a669696
More notes
n8kim1 Jan 1, 2021
dd65547
Switch to mailman, mmblanche
n8kim1 Jan 1, 2021
0f1a65c
More mmblanche notes
n8kim1 Jan 1, 2021
2fd6f36
More create list notes
n8kim1 Jan 1, 2021
240e736
Update notes
j-mao Jan 1, 2021
15444a8
Merge pull request #188 from battlecode/mass-emails
j-mao Jan 1, 2021
fb24952
Add more notes about access.txt
n8kim1 Jan 1, 2021
96d7657
Allow superuser to call compilation pubsub (for #179)
n8kim1 Jan 1, 2021
1747633
Re-queueing only open to superuser (#179)
n8kim1 Jan 1, 2021
bd51a81
Re-add actual pub sending
n8kim1 Jan 1, 2021
a1f2ee9
Merge pull request #180 from battlecode/frontend-readmes
j-mao Jan 2, 2021
6f84077
Merge pull request #183 from battlecode/webinfra-remove-pubpy
j-mao Jan 2, 2021
8c6b3c9
Add pubsub is not queue note (#179)
n8kim1 Jan 2, 2021
d6d2846
Simplify setting state to cookie value (#179)
n8kim1 Jan 2, 2021
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
60 changes: 60 additions & 0 deletions EMAILS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Mass Emails

## MIT Systems

We're using mailman -- in particular, it handles unsubscribing for us.

### Lists we maintain

We currently maintain the following lists on Mailman:
- `battlecode-interest-mm` is the general interest mailing list, linked to by the website homepage. This should be used for announcing new Battlecode contests.
- `battlecode-competitors-2020-mm` is an empty mailing list created by accident. It can be used for testing.
- `battlecode-competitors-2021-mm` contains all registered competitors of Battlecode 2021.

### Creating a list

1. Create a list at https://listmaker.mit.edu/lc/ and navigate to the admin page. You will receive an email containing the admin password.
1. Update the administrator to the Battlecode contact email (this is the publicly viewable list owner), and set yourself and others to be moderators.
After doing this, you will need to re-authenticate (you're no longer the admin), using the password that was emailed to you.
1. Set list parameters. Below are some examples.
- Description: MIT Battlecode 2021
- Subject prefix: [battlecode-21]
- Hide sender = Yes. All sent emails will appear to come from the list, not you.
- Strip Reply-To header = Yes, explicit Reply-To = the battlecode address. This configures replies to not go back to the list.
- In the privacy menu:
- Only list admin should view subscription list.
- In sender submenu, new members should be moderated. This prevents random subscribers from sending unmoderated mail.
- In recipient submenu, ceiling should be zero. This allows us to send mail even if the subscription list is huge.

### Adding to a list

Before doing this, turn off welcome messages in the general menu (`send_welcome_msg`). This ensures we don't spam people when they're added.

We use mmblanche for this. It's easiest to use it installed on Athena. SSH in, then run:
```
bash # if your default shell is not bash
add consult
mmblanche
```
to be able to use it. (`add consult` only works when running through bash, for some reason.)

Get a list of emails, and convert it to the format as specified by mmblanche's `-f` argument: one email per line. (For example, if you're working with a Google Form, you can get a Google Sheet of responses. Create a new tab -- **not** the tab where form responses are being collected!. Convert it into only one column of values such that all the values are emails -- strip out timestamps, header row, and the like. Then download this as a csv. If you'd like to export emails from our database, you can use a nice interface to download a table as a csv, and work with it.)

Move this file to your Athena locker; you can use `scp` for this (example [here](https://unix.stackexchange.com/questions/106480/how-to-copy-files-from-one-machine-to-another-using-ssh)).

Finally run mmblanche! For example, `mmblanche [mailman-list-name] -al [path/to/file]`. Likely you'll want to use `-al`, as it simply adds any emails in the file to the list, skips over duplicates for you, and doesn't delete anything otherwise.

You'll be prompted for the list admin password; find this somehow. You may wanna use the `-S` setting too, which will save admin passwords so you don't have to keep typing them.

### Sending to a list

If the set of emails you're trying to reach is continually growing (e.g. if you're messaging a large interest list through a gsheet that a keeps growing), then you'll probably want to update the lists first. Follow the instructions in the above section.

Send mail to the list as you would normally.
- Ensure that you (yes, you specifically, not the Battlecode address) are a member of the list. Mark yourself as not-moderated in the Members list, or make sure you have a mod ready to release your email.
- Do not use Bcc. Bcc'd mail will be blocked by the list.
- Include trailing newlines. Mail without trailing newlines may show the message footer in the same line as your email signature.

## Sendgrid

(TODO dump some convos that I had w nate in Slack, as well as some messages that he sent in some channel.)
18 changes: 18 additions & 0 deletions backend/api/migrations/0019_scrimmage_winscore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.13 on 2020-12-27 02:03

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0018_auto_20200416_2354'),
]

operations = [
migrations.AddField(
model_name='scrimmage',
name='winscore',
field=models.IntegerField(null=True),
),
]
18 changes: 18 additions & 0 deletions backend/api/migrations/0020_scrimmage_losescore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.13 on 2020-12-27 17:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0019_scrimmage_winscore'),
]

operations = [
migrations.AddField(
model_name='scrimmage',
name='losescore',
field=models.IntegerField(null=True),
),
]
2 changes: 2 additions & 0 deletions backend/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class Scrimmage(models.Model):

# Match-running (completed by match runner)
status = models.TextField(choices=SCRIMMAGE_STATUS_CHOICES, default='pending')
winscore = models.IntegerField(null=True)
losescore = models.IntegerField(null=True)
replay = models.TextField(blank=True)

# Metadata
Expand Down
76 changes: 0 additions & 76 deletions backend/api/pub.py

This file was deleted.

2 changes: 1 addition & 1 deletion backend/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ScrimmageSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Scrimmage
fields = ('url', 'id', 'league', 'red_team', 'red_mu', 'blue_team', 'blue_mu', 'ranked',
'status', 'replay', 'requested_by', 'requested_at', 'started_at', 'updated_at', 'tournament_id')
'status', 'winscore', 'losescore', 'replay', 'requested_by', 'requested_at', 'started_at', 'updated_at', 'tournament_id')
read_only_fields = ('url', 'requested_at', 'started_at', 'updated_at')


Expand Down
Loading