Merge pull request #948 from felipebueno/mailhog

Add MailHog container to provide login with email without extra config
This commit is contained in:
Keyan 2024-03-25 17:54:57 -05:00 committed by GitHub
commit 2f818fc968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 4 deletions

View File

@ -12,8 +12,8 @@ TWITTER_ID=
TWITTER_SECRET=
# email
LOGIN_EMAIL_SERVER=
LOGIN_EMAIL_FROM=
LOGIN_EMAIL_SERVER=smtp://mailhog:1025
LOGIN_EMAIL_FROM=sndev@mailhog.dev
LIST_MONK_AUTH=
########################################################

View File

@ -98,7 +98,7 @@ COMMANDS
#### Running specific services
By default all services will be run. If you want to exclude specific services from running, set `COMPOSE_PROFILES` to use one or more of `minimal|images|search|payments`. To only run mininal services without images, search, or payments:
By default all services will be run. If you want to exclude specific services from running, set `COMPOSE_PROFILES` to use one or more of `minimal|images|search|payments|email`. To only run mininal services without images, search, or payments:
```sh
$ COMPOSE_PROFILES=minimal ./sndev start
@ -350,6 +350,19 @@ You can login to test features like posting, replying, tipping, etc with `./snde
### Login with Email
#### MailHog
- The app is already prepared to send emails through [MailHog](https://github.com/mailhog/MailHog) so no extra configuration is needed
- Click "sign up" and enter any email address (remember, it's not going anywhere beyond your workstation)
- Access MailHog's web UI on http://localhost:8025
- Click the link (looks like this):
```
http://localhost:3000/api/auth/callback/email?email=satoshi%40gmail.com&token=110e30a954ce7ca643379d90eb511640733de405f34a31b38eeda8e254d48cd7
```
#### Sendgrid
- Create a Sendgrid account (or other smtp service)
```

View File

@ -377,6 +377,23 @@ services:
command: daemon --docker -f label=com.docker.compose.project=${COMPOSE_PROJECT_NAME}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
mailhog:
image: mailhog/mailhog:latest
container_name: mailhog
profiles:
- email
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8025"]
interval: 10s
timeout: 10s
retries: 10
start_period: 1m
ports:
- "8025:8025"
- "1025:1025"
links:
- app
volumes:
db:
os:

2
sndev
View File

@ -10,7 +10,7 @@ docker__compose() {
fi
if [ -z "$COMPOSE_PROFILES" ]; then
COMPOSE_PROFILES="images,search,payments"
COMPOSE_PROFILES="images,search,payments,email"
fi
CURRENT_UID=$(id -u) CURRENT_GID=$(id -g) COMPOSE_PROFILES=$COMPOSE_PROFILES command docker compose --env-file .env.development "$@"