diff --git a/.env.sample b/.env.sample index e93f2ac9..5364b26e 100644 --- a/.env.sample +++ b/.env.sample @@ -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= ######################################################## diff --git a/README.md b/README.md index 21ebed52..1110178a 100644 --- a/README.md +++ b/README.md @@ -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) ``` diff --git a/docker-compose.yml b/docker-compose.yml index 366d7ec8..22a4589d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/sndev b/sndev index a3aa56e0..9de1fd73 100755 --- a/sndev +++ b/sndev @@ -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 "$@"