How to make SMTP work in your Open EdX fullstack instance
Step-by-step guide
Firstly, there are 3 simple things to keep in mind:
- All the authentication information should be kept privately.
- If you add them to the edx-platform source files there will be conflicts when you upgrade or pull from master/branches.
- So, the best place to keep all the settings for all your Open edX applications is /edx/app/edx_ansible/server-vars.yml.
0. Checkout all of your modification on: (to avoid source code conflicts)
cms/envs/common.py
lms/envs/aws.py
cms.env.json
cms.auth.json
lms.env.json
lms.auth.json
1. Create server-vars.yml in /edx/app/edx_ansible/
2. Add these following variables to server-vars.yml with your SMTP information:
EDXAPP_EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend'
EDXAPP_EMAIL_HOST: 'localhost'
EDXAPP_EMAIL_PORT: 25
EDXAPP_EMAIL_USE_TLS: False
EDXAPP_EMAIL_HOST_USER: ''
EDXAPP_EMAIL_HOST_PASSWORD: ''
...
# you can add more here
Notes:
- These settings use the local smtp service to sent out messages. If you want to use gmail or your own smtp server, change them.
- For more vars, please read this.
3. Run the update command to apply the changes:
sudo /edx/bin/update edx-platform master
If you're not running on a custom/forked version of Open edX, then instead, you should run:
/edx/bin/update edx_platform $(cd /edx/app/edxapp/edx_platform; git rev-parse HEAD) - DOC-4022Getting issue details... STATUS
as this will ensure your version of the code stays the same, and all that changes is the regenerated configuration files.
You can add this line in /edx/app/edx_ansible/server-vars.yml to pull code from your folked edx-platform:
edx_platform_repo: "https://github.com/<user>/edx-platform.git"
For more instructions, read here.
4. By default, the LMS runs on port 18000, if after the provisioning it changes back to that port, go to /etc/nginx/sites-available/lms and modify the server port (80). Then restart nginx.
5. Compile the assets:
sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/edx-platform
paver update_assets cms --settings=production
paver update_assets lms --settings=production