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

Question: How to integrate the project in Docker Compose? #7

Closed
svachmic opened this issue Feb 26, 2018 · 2 comments
Closed

Question: How to integrate the project in Docker Compose? #7

svachmic opened this issue Feb 26, 2018 · 2 comments

Comments

@svachmic
Copy link

Hi, thanks for sharing your project! I just seem to be having some issues integrating it into our dev environment. We have an application consisting of various Spring Boot micro services, all deployed in containers, locally deployed via docker compose. Logically there should be no need to use production e-mails on localhost and that's why we wanted to mock the SMTP server.

We tried to integrate your project into our docker-compose file, but we keep getting "Connection refused".

This is the docker-compose file (edited to remove sensitive info):

version: '3'
services:
  fakesmtp:
    image: gessnerfl/fake-smtp-server
    ports:
      - "5025:5025"
      - "5080:5080"
      - "5081:5081"
    environment:
      - FAKESMTP_AUTHENTICATION_USERNAME=noreply@myapp.com
      - FAKESMTP_AUTHENTICATION_PASSWORD=password
    volumes:
      - ./email:/var/mail
  app-auth:
    image: app-auth:latest
    ports:
     - "9000:9000"
    environment:
     - SPRING_PROFILES_ACTIVE=development
     - SPRING_MAIL_HOST=127.0.0.1
     - SPRING_MAIL_PORT=5025
     - SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE=false
     - SPRING_MAIL_USERNAME=noreply@myapp.com
     - SPRING_MAIL_PASSWORD=password

Any hint what I'm doing wrong? Thanks a lot!

@svachmic
Copy link
Author

Actually, just figured it out - it was only a matter of finding the right configuration to get it running. Adding it here for completeness, should anyone ever find it hard to integrate:

version: '3'
services:
  fakesmtp:
    image: gessnerfl/fake-smtp-server
    ports:
      - "5025:5025"
      - "5080:5080"
      - "5081:5081"
    volumes:
      - ./email:/var/mail
  app-auth:
    image: app-auth:latest
    ports:
     - "9000:9000"
    environment:
     - SPRING_PROFILES_ACTIVE=development
     - SPRING_MAIL_HOST=fakesmtp
     - SPRING_MAIL_PORT=5025
     - SPRING_MAIL_PROPERTIES_MAIL_SMTP_AUTH=false
     - SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE=false
     - SPRING_MAIL_FROM=noreply@localhost
     - SPRING_MAIL_USERNAME=
     - SPRING_MAIL_PASSWORD=

@gessnerfl
Copy link
Owner

Yes this is exactly how spring boot works. Each configuration property you can just pass as environment variable. Thereby you have to capitalize the property names and e.g. replace . or - with an_.
But great that you were already able to fix the issue by yourself ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants