diff --git a/docker-compose.yml b/docker-compose.yml index 78e4d20da..2bc964425 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,13 @@ version: "3.5" services: + mailserver: + container_name: relay-smtp-mail-server + image: boky/postfix + environment: + ALLOWED_SENDER_DOMAINS: ${ALLOWED_SENDER_DOMAINS} + RELAYHOST: "smtp-relay.gmail.com:25" + networks: + - network web: build: . container_name: pycontw-2024 diff --git a/document/deploy_docker_prod.md b/document/deploy_docker_prod.md index ef74c5e17..967ee88e6 100644 --- a/document/deploy_docker_prod.md +++ b/document/deploy_docker_prod.md @@ -21,10 +21,11 @@ There are four configurations that must be set when running the container. * `DATABASE_URL` specifies how to connect to the database (in the URL form e.g. `postgres://username:password@host_or_ip:5432/database_name`) * `EMAIL_URL` specifies how to connect to the mail server - (e.g. `smtp+tls://username:password@host_or_ip:25`) + (e.g. `smtp+tls://username:password@host_or_ip:25`, `smtp://host_or_ip:587` for local smtp server) * `DSN_URL` specify how to connect to Sentry error reporting service (e.g. `https://key@sentry.io/project`), please refer to [Sentry's documentation on how to obtain Data Source Name](https://docs.sentry.io/error-reporting/quickstart/?platform=python) + * (optional) `ALLOWED_SENDER_DOMAINS` - Could be `python.tw` if we [route outgoing SMTP relay messages through Google](https://support.google.com/a/answer/2956491?hl=en) * (optional) `GTM_TRACK_ID` * (optional) `SLACK_WEBHOOK_URL` diff --git a/src/pycontw2016/settings/production/base.py b/src/pycontw2016/settings/production/base.py index e4fe66e2b..4a2d3345d 100644 --- a/src/pycontw2016/settings/production/base.py +++ b/src/pycontw2016/settings/production/base.py @@ -95,16 +95,16 @@ 'SentryResponseErrorIdMiddleware', ) -EMAIL_BACKEND = env.email_url()['EMAIL_BACKEND'] -EMAIL_HOST = env.email_url()['EMAIL_HOST'] -EMAIL_HOST_PASSWORD = env.email_url()['EMAIL_HOST_PASSWORD'] -EMAIL_HOST_USER = env.email_url()['EMAIL_HOST_USER'] -EMAIL_PORT = env.email_url()['EMAIL_PORT'] -EMAIL_USE_TLS = env.email_url()['EMAIL_USE_TLS'] +EMAIL_BACKEND = env.email_url().get('EMAIL_BACKEND') +EMAIL_HOST = env.email_url().get('EMAIL_HOST') +EMAIL_HOST_PASSWORD = env.email_url().get('EMAIL_HOST_PASSWORD') +EMAIL_HOST_USER = env.email_url().get('EMAIL_HOST_USER') +EMAIL_PORT = env.email_url().get('EMAIL_PORT') +EMAIL_USE_TLS = env.email_url().get('EMAIL_USE_TLS') DEFAULT_FROM_EMAIL = SERVER_EMAIL = '{name} <{addr}>'.format( name='PyCon Taiwan', - addr='web@pycon.tw', + addr='no-reply@python.tw', ) # Securiy related settings