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

Add mailhog and ngrok descriptions #281

Merged
merged 9 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions docs/developer/running-saleor/debugging-emails.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Debugging emails
sidebar_label: Debugging emails
---

[Saleor platform](https://github.com/mirumee/saleor-platform) uses [Mailhog](https://github.com/mailhog/MailHog) for catching all the emails sent by the Saleor.

![Mailhog user interface](../screenshots/mailhog.png)

Pros of using Mailhog during development:
krzysztofwolski marked this conversation as resolved.
Show resolved Hide resolved
- live preview of rendered emails.
- no need to send emails to external services.
- test emails will be caught in the local environment, so there is no possibility of sending test data to actual customers.
krzysztofwolski marked this conversation as resolved.
Show resolved Hide resolved
- eliminates possibility of sending emails to non existing address, which can hurt email reputation.

## Configuration

### Saleor Platform

There is no need for additional configuration. Everything works out of the box.

### Local development environment

1. Follow [the installation guide](https://github.com/mailhog/MailHog#installation).
2. Set Mailhog SMTP server address (`smtp://localhost:1025`) at plugins configuration page for [AdminEmails](developer/available-plugins/admin-emails.mdx) and [UserEmails](developer/available-plugins/user-emails.mdx)

## Access to the interface

Visit [http://localhost:8025](http://localhost:8025).
21 changes: 21 additions & 0 deletions docs/developer/running-saleor/exposing-instance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Exposing local instance
sidebar_label: Exposing instance
---

There are situations when you would like to expose your local environment to external clients, for example:

- show your project to the manager.
- integrate with the new payment gateway, which requires a return URL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work. There is a settings.ALLOWED_CLIENT_HOSTS which defines where user can be redirected. If you don't overwrite this variable, the allowed redirect URL will be 127.0.0.1 and localhost. Any different than this will raise an error. The same case is for the situation when you're hosting storefront somewhere, and you use ngrok to connect it to your backend (all mutation like, reset password, send activation URL will raise an exception, afair).

- testing app deployed in the cloud.

To achieve that, you need a service for redirecting the traffic. Such service is delivered by [ngrok](https://ngrok.com) and [localtunnel](https://localtunnel.me). Both are great for our use case, and you can choose any of those services.

## Using ngrok

1. Append ngrok URL to `ALLOWED_CLIENT_HOSTS` environment varible
2. Start Saleor on your machine
3. Follow [ngrok installation guide](https://ngrok.com/product)
4. Start a tunnel in your command line `ngrok http 8000`
5. Your server is now exposed under ngrok domain (for example: http://92832de0.ngrok.io). Copy that address.
6. Enter ngrok URL at [Site Settings](dashboard/configuration/site.md) configuration.
Binary file added docs/developer/screenshots/mailhog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ module.exports = {
"developer/running-saleor/s3",
"developer/running-saleor/gcs",
"developer/running-saleor/emails",
"developer/running-saleor/debugging-emails",
"developer/running-saleor/exposing-instance",
"developer/running-saleor/monitoring",
"developer/running-saleor/background-tasks"
]
Expand Down