FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    How to set SMTP server configuration from docker-compose

    Scheduled Pinned Locked Moved
    Comments & Feedback
    0
    3
    2.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      skocur10
      last edited by skocur10

      Hello,

      Is it possible to set up a configuration for SMTP server via docker-compose? For example we can do such thing (code below) for connection to database, but I cannot find solution for mailing server.

      version: "3.3"
      
      services:
        auth-db:
          image: postgres:11.9-alpine
          environment:
            PGDATA: /var/lib/postgresql/data/pgdata
            POSTGRES_USER: ${POSTGRES_USER}
            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
          networks:
            - auth-db
          restart: unless-stopped
          volumes:
            - db_data:/var/lib/postgresql/data
      
        fusionauth:
          image: fusionauth/fusionauth-app:latest
          depends_on:
            - auth-db
          environment:
            DATABASE_URL: jdbc:postgresql://auth-db:5432/fusionauth
            DATABASE_ROOT_USERNAME: ${POSTGRES_USER}
            DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
            DATABASE_USERNAME: ${DATABASE_USERNAME}
            DATABASE_PASSWORD: ${DATABASE_PASSWORD}
            FUSIONAUTH_APP_MEMORY: ${FUSIONAUTH_APP_MEMORY}
            FUSIONAUTH_APP_RUNTIME_MODE: development
            FUSIONAUTH_APP_URL: http://fusionauth:9011
            SEARCH_TYPE: database
      
          networks:
            - auth-db
          restart: unless-stopped
          ports:
            - "9011:9011"
          volumes:
            - fa_config:/usr/local/fusionauth/config
      
      networks:
        auth-db:
          driver: bridge
      
      volumes:
        db_data:
        fa_config:
      
      

      What is the use case?
      During integration testing I would like to have set up all infrastructure services automatically using single shell script. In such tests I would test registration of user account, but for it I need to confirm email address using Mailcatcher.

      1 Reply Last reply Reply Quote 0
      • M
        maciej.wisniowski Power User
        last edited by

        I don't think this is possible with environment variables as SMTP configuration is managed per tenant. You can use kickstart to configure it, eg.:

        {
              "method": "PATCH",
              "url": "/api/tenant/#{your_tenant_id}",
              "body": {
                "tenant": {
                  "name": "My Tenant name",
                  "issuer": "example.com",
                  "themeId": "#{my_theme_uid}",
                  "emailConfiguration": {
                    "defaultFromEmail": "no-reply@example.com",
                    "defaultFromName": "Blah",
                    "host": "mailhog",
                    "password": "",
                    "port": "1025",
                    "security": "TLS",
                    "username": "",
                    "forgotPasswordEmailTemplateId": "#{forgot_password_email_id}"
                  }
                }
              }
            },
        
        1 Reply Last reply Reply Quote 1
        • joshuaJ
          joshua
          last edited by

          @maciej-wisniowski Good Call! 🙂

          1 Reply Last reply Reply Quote 0
          • First post
            Last post