Skip to content

Commit

Permalink
Merge pull request #215 from compute-tooling/email-cleanup
Browse files Browse the repository at this point in the history
Email cleanup
  • Loading branch information
hdoupe authored Oct 3, 2019
2 parents 383214f + 0e7694d commit 207e4d1
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 43 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ services:
- WORKERS=${WORKERS}:5050
- LOCAL=True
- BUCKET=cs-outputs-dev-1
- MAILGUN_API_KEY=${MAILGUN_API_KEY}
- USE_STRIPE=${USE_STRIPE}
- STRIPE_SECRET=${STRIPE_SECRET}
- WEBHOOK_SECRET=${WEBHOOK_SECRET}
ports:
- "8000:8000"
container_name: web
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/publish/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

This guide describes how to publish a model on Compute Studio. The Compute Studio framework depends on model interfaces meeting several Compute Studio criteria, and we walk you through how to meet those criteria, either by modifying your model's interface or building a new wrapper interface around your model. The great part is that you don't have to deal with any web technology to build your Compute Studio app.

If you have any questions as you proceed through this guide, send Hank an email at [email protected].
If you have any questions as you proceed through this guide, send Hank an email at [email protected].

The documentation is split into three parts.
The documentation is split into three parts.

- The first part documents the [inputs](/publish/inputs) and [outputs](/publish/outputs/) JSON schemas that your model will need to adopt for Compute Studio to be able to generate input forms representing your model's default specification, validate user adjustments, and display model outputs.
- The [second part](/publish/functions/) documents the python functions that will be used by Compute Studio to get data from and submit data to your model.
- The first part documents the [inputs](/publish/inputs) and [outputs](/publish/outputs/) JSON schemas that your model will need to adopt for Compute Studio to be able to generate input forms representing your model's default specification, validate user adjustments, and display model outputs.
- The [second part](/publish/functions/) documents the python functions that will be used by Compute Studio to get data from and submit data to your model.
- The third part is a [publish form](https://compute.studio/publish) that asks you to provide a title and overview for your new Compute Studio app, code snippets for the three python functions, and information describing your app's resource requirements and installation directions. If you would like to see a publishing template that has already been completed, you can view the Matchups template [here](https://compute.studio/hdoupe/Matchups/detail).

Once you've submitted the publishing form, Hank will review it and get back to you within 24 hours to inform you whether the model is ready to be published or if there are criteria that have not been satisfied. Your model will be deployed to Compute Studio once it has met all of the critera. You will have the opportunity to test it out after it has been deployed.
4 changes: 2 additions & 2 deletions old-docs/PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

This guide describes how to publish a model on Compute Studio. The Compute Studio framework depends on model interfaces meeting several Compute Studio criteria, and we walk you through how to meet those criteria, either by modifying your model's interface or building a new wrapper interface around your model. The great part is that you don't have to deal with any web technology to build your Compute Studio app.

If you have any questions as you proceed through this guide, send Hank an email at [email protected].
If you have any questions as you proceed through this guide, send Hank an email at [email protected].

The documentation is split into three parts. The [first part](IOSCHEMA.md) documents the inputs and outputs JSON schemas that your model will need to adopt for Compute Studio to be able to generate input forms representing your model's default specification, validate user adjustments, and display model outputs. The [second part](ENDPOINTS.md) documents the python functions that will be used by Compute Studio to get data from and submit data to your model. The third part is a [publish form](https://www.compute.studio/publish) that asks you to provide a title and overview for your new Compute Studio app, code snippets for the three python functions, and information describing your app's resource requirements and installation directions. If you would like to see a publishing template that has already been completed, you can view the Matchups template [here](https://www.compute.studio/hdoupe/Matchups/detail).

Once you've submitted the publishing form, Hank will review it and get back to you within 24 hours to inform you whether the model is ready to be published or if there are criteria that have not been satisfied. Your model will be deployed to Compute Studio once it has met all of the critera. You will have the opportunity to test it out after it has been deployed.

For those who are interested in a more detailed explanation of the additional steps we take to publish your model on Compute Studio, feel free to checkout the [Technical Publishing Guide](technical/TECHNICALPUBLISH.md), and, since Compute Studio is an open-source website, you can even follow along.
For those who are interested in a more detailed explanation of the additional steps we take to publish your model on Compute Studio, feel free to checkout the [Technical Publishing Guide](technical/TECHNICALPUBLISH.md), and, since Compute Studio is an open-source website, you can even follow along.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dataclasses
whitenoise
gunicorn
stripe
sendgrid-django
django-anymail[mailgun]
pytest
pytest-django
django-widget-tweaks
Expand Down
2 changes: 1 addition & 1 deletion src/ErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class ErrorBoundary extends React.Component {
issue
</a>{" "}
in the Compute Studio source code repository or{" "}
<a href="mailto:[email protected]">emailing Hank</a>.
<a href="mailto:[email protected]">emailing Hank</a>.
</Card.Text>
</Card.Body>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const specialRequests = (
<div>
<p>
You may contact the Compute Studio admin at
<a href="mailto:[email protected]"> [email protected]</a> to
<a href="mailto:[email protected]"> [email protected]</a> to
discuss:
</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion static/js/inputs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/js/publish.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/comp/app_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="card card-body card-outer">
<h1 class="card-title text-center">There was an error with your simulation.</h1>
<p class="lead">Compute Studio developers have already been notified about this failure. You are welcome to email me at <a href="mailto:[email protected]">[email protected]</a> if you would like to get in touch about this error.</p>
<p class="lead">Compute Studio developers have already been notified about this failure. You are welcome to email me at <a href="mailto:[email protected]">[email protected]</a> if you would like to get in touch about this error.</p>
{% include 'comp/diagnostic_collapse.html' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion templates/comp/failed.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="card card-body card-outer">
<h1 class="card-title text-center">Your calculation failed. You may re-enter your parameters and try again.</h1>
<p class="lead">Compute Studio developers have already been notified about this failure. You are welcome to email me at <a href="mailto:[email protected]">[email protected]</a> if you would like to get in touch about this error.</p>
<p class="lead">Compute Studio developers have already been notified about this failure. You are welcome to email me at <a href="mailto:[email protected]">[email protected]</a> if you would like to get in touch about this error.</p>
{% include 'comp/diagnostic_collapse.html' %}
</div>

Expand Down
20 changes: 7 additions & 13 deletions webapp/apps/billing/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@

def invoice_payment_failed(event, link="test"):
print("processing invoice.payment_failed event...")
print("sending mail...")
user = event.customer.user
if hasattr(user, "email"):
target_email = user.email
else:
target_email = "[email protected]"
send_mail(
"Your Payment Failed",
f"Please pay the invoice at: {link}",
"[email protected]",
[target_email],
"Compute Studio",
"Payment failed",
"Compute Studio <[email protected]>",
["[email protected]"],
fail_silently=False,
)

Expand All @@ -33,9 +27,9 @@ def customer_created(event):
print("processing customer.created event...")
customer = Customer.objects.get(stripe_id=event.data["object"]["id"])
send_mail(
"Welcome to Compute Studio",
"Thanks for joining!",
"[email protected]",
"Compute Studio",
"Your payment method was set successfully! Please write back if you have any questions.",
"Compute Studio <[email protected]>",
[customer.user.email],
fail_silently=False,
)
Expand Down
4 changes: 2 additions & 2 deletions webapp/apps/comp/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def post(self, request, *args, **kwargs):
f"{ae.traceback}\n user:{request.user.username}\n "
f"project: {project.app_url}."
),
"[email protected]",
["[email protected]"],
"[email protected]",
["[email protected]"],
fail_silently=True,
)
# Http 401 exception if mail credentials are not set up.
Expand Down
4 changes: 2 additions & 2 deletions webapp/apps/comp/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def fail(self, model_pk, username, title):
send_mail(
f"Compute Studio Sim fail",
f"An error has occurred at {username}/{title}/{model_pk}",
"[email protected]",
["[email protected]"],
"[email protected]",
["[email protected]"],
fail_silently=True,
)
# Http 401 exception if mail credentials are not set up.
Expand Down
8 changes: 4 additions & 4 deletions webapp/apps/publish/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def put(self, request, *args, **kwargs):
f"the next 24 hours. Check the status of the update at "
f"{status_url}."
),
"[email protected]",
list({request.user.email, "[email protected]"}),
"[email protected]",
list({request.user.email, "[email protected]"}),
fail_silently=False,
)
# Http 401 exception if mail credentials are not set up.
Expand Down Expand Up @@ -122,8 +122,8 @@ def post(self, request, *args, **kwargs):
f"the next 24 hours. Check the status of the submission at "
f"{status_url}."
),
"[email protected]",
list({request.user.email, "[email protected]"}),
"[email protected]",
list({request.user.email, "[email protected]"}),
fail_silently=False,
)
# Http 401 exception if mail credentials are not set up.
Expand Down
8 changes: 4 additions & 4 deletions webapp/apps/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def save(self, commit=True):
f"from Compute Studio. We value your feedback. Please let us know why "
f"you unsubscribed and how we can win you back in the future."
),
"[email protected]",
set([user.email, "[email protected]"]),
"[email protected]",
set([user.email, "[email protected]"]),
fail_silently=True,
)
return user
Expand All @@ -101,8 +101,8 @@ def save(self, commit=True):
f"mistake, please let us know why you deleted your account "
f"and how we can win you back in the future."
),
"[email protected]",
set([user.email, "[email protected]"]),
"[email protected]",
set([user.email, "[email protected]"]),
fail_silently=True,
)
return user
2 changes: 1 addition & 1 deletion webapp/apps/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_profile_from_user(user):
f"questions or there is anything else we "
f"can do to help you get up and running."
),
from_email="[email protected]",
from_email="[email protected]",
to=[user.email],
bcc=["[email protected]"],
)
Expand Down
14 changes: 10 additions & 4 deletions webapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

WEBAPP_VERSION = "0.1.0"

ADMINS = [("Hank", "[email protected]")]
SERVER_EMAIL = "[email protected]"
ADMINS = [("Hank", "[email protected]")]

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
Expand Down Expand Up @@ -75,6 +74,7 @@ def get_salt(env_var, dev_value):
"allauth.account",
"rest_auth.registration",
"allauth.socialaccount",
"anymail",
# 'allauth.socialaccount.providers.github', # new
]

Expand Down Expand Up @@ -182,5 +182,11 @@ def get_salt(env_var, dev_value):
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]


EMAIL_BACKEND = "sgbackend.SendGridBackend"
SENDGRID_API_KEY = os.environ.get("SENDGRID_API_KEY", "dne")
ANYMAIL = {
# (exact settings here depend on your ESP...)
"MAILGUN_API_KEY": os.environ.get("MAILGUN_API_KEY"),
"MAILGUN_SENDER_DOMAIN": "mg.compute.studio", # your Mailgun domain, if needed
}
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
DEFAULT_FROM_EMAIL = "[email protected]"
SERVER_EMAIL = "[email protected]"

0 comments on commit 207e4d1

Please sign in to comment.