Commit 46b4acc8 by Kevin Falcone

Allow nginx to be templated but not enabled

If you set nginx_skip_enable_sites it will not symlink the items in
nginx_sites.  This means you have to make that change later.  EdX does
it with our pre_supervisor script, the same code that checks on
migrations being complete and also symlinks in supervisor processes to
run.

Remove the TODO: remove task for minos.
We stopped creating all the per-service dirs in edx_service
parent dac68385
- Role: edxapp
- EDXAPP_NGINX_SKIP_ENABLE_SITES added to allow you to not sync in the lms or cms nginx configuration. Instead you can enable them during deployment.
- EDXAPP_NGINX_DEFAULT_SITES added to allow you to mark both lms and cms as defaults, best paired with picking which site to enable during deployment.
- Role: XQueue - Role: XQueue
- Convert to a yaml config (instead of xqueue.auth.json and xqueue.env.json we get xqueue.yml and it lives by default in /edx/etc/xqueue.yml like standard IDAs) - Convert to a yaml config (instead of xqueue.auth.json and xqueue.env.json we get xqueue.yml and it lives by default in /edx/etc/xqueue.yml like standard IDAs)
- Add XQUEUE_DEFAULT_FILE_STORAGE so that you can specify S3 or Swift in your config - Add XQUEUE_DEFAULT_FILE_STORAGE so that you can specify S3 or Swift in your config
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
nginx_sites: nginx_sites:
- lms - lms
- cms - cms
nginx_default_sites: nginx_default_sites: "{{ EDXAPP_NGINX_DEFAULT_SITES }}"
- lms
nginx_extra_sites: "{{ NGINX_EDXAPP_EXTRA_SITES }}" nginx_extra_sites: "{{ NGINX_EDXAPP_EXTRA_SITES }}"
nginx_extra_configs: "{{ NGINX_EDXAPP_EXTRA_CONFIGS }}" nginx_extra_configs: "{{ NGINX_EDXAPP_EXTRA_CONFIGS }}"
nginx_redirects: "{{ NGINX_EDXAPP_CUSTOM_REDIRECTS }}" nginx_redirects: "{{ NGINX_EDXAPP_CUSTOM_REDIRECTS }}"
nginx_skip_enable_sites: "{{ EDXAPP_NGINX_SKIP_ENABLE_SITES }}"
- edxapp - edxapp
- role: devstack_sqlite_fix - role: devstack_sqlite_fix
when: devstack is defined and devstack when: devstack is defined and devstack
......
...@@ -327,6 +327,16 @@ EDXAPP_COURSES_REQUEST_BURST_RATE: 10 ...@@ -327,6 +327,16 @@ EDXAPP_COURSES_REQUEST_BURST_RATE: 10
EDXAPP_COURSES_USER_AGENT_BURST_RATE: 5 EDXAPP_COURSES_USER_AGENT_BURST_RATE: 5
EDXAPP_RATE_LIMITED_USER_AGENTS: [] EDXAPP_RATE_LIMITED_USER_AGENTS: []
# Consumed in the edxapp.yml playbook
# to pass to nginx as nginx_skip_enable_sites
EDXAPP_NGINX_SKIP_ENABLE_SITES: False
# If the LMS and Studio run on the same machine / nginx, it makes sense to have
# a default (usually the LMS). If you run on separate machines, you'll want to mark
# them both as defaults.
EDXAPP_NGINX_DEFAULT_SITES:
- 'lms'
EDXAPP_LANG: 'en_US.UTF-8' EDXAPP_LANG: 'en_US.UTF-8'
EDXAPP_LANGUAGE_CODE : 'en' EDXAPP_LANGUAGE_CODE : 'en'
EDXAPP_LANGUAGE_COOKIE: 'openedx-language-preference' EDXAPP_LANGUAGE_COOKIE: 'openedx-language-preference'
......
...@@ -34,15 +34,6 @@ ...@@ -34,15 +34,6 @@
# - minos # - minos
# #
#TODO: remove
- name: Maintain backwards-compatable config location
file:
src: "{{ COMMON_CFG_DIR }}/{{ minos_service_name }}.yml"
dest: "{{ COMMON_CFG_DIR }}/{{ minos_service_name }}/{{ minos_service_name }}.yml"
state: link
owner: root
group: root
- name: Create minos config directory - name: Create minos config directory
file: file:
path: "{{ minos_voter_cfg }}" path: "{{ minos_voter_cfg }}"
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
# These are paramters to the role # These are paramters to the role
# and should be overridden # and should be overridden
nginx_sites: [] nginx_sites: []
# If you want to install multiple sites with nginx_site but enable
# them yourself (if you're using a single build for multiple deploys)
# you can skip having them link into sites-enabled and do it during boot.
nginx_skip_enable_sites: False
nginx_redirects: {} nginx_redirects: {}
nginx_extra_sites: [] nginx_extra_sites: []
nginx_extra_configs: [] nginx_extra_configs: []
......
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
owner: root owner: root
group: root group: root
with_items: "{{ nginx_sites }}" with_items: "{{ nginx_sites }}"
when: not nginx_skip_enable_sites
notify: reload nginx notify: reload nginx
tags: tags:
- install - install
...@@ -342,7 +343,7 @@ ...@@ -342,7 +343,7 @@
- install - install
- install:configuration - install:configuration
- name: Set up nginx access log rotation - name: Set up nginx error log rotation
template: template:
src: "etc/logrotate.d/edx_logrotate_nginx_error.j2" src: "etc/logrotate.d/edx_logrotate_nginx_error.j2"
dest: "/etc/logrotate.d/nginx-error" dest: "/etc/logrotate.d/nginx-error"
......
...@@ -20,6 +20,10 @@ MIGRATION_COMMANDS = { ...@@ -20,6 +20,10 @@ MIGRATION_COMMANDS = {
'credentials': ". {env_file}; sudo -E -u credentials {python} {code_dir}/manage.py showmigrations", 'credentials': ". {env_file}; sudo -E -u credentials {python} {code_dir}/manage.py showmigrations",
'discovery': ". {env_file}; sudo -E -u discovery {python} {code_dir}/manage.py showmigrations", 'discovery': ". {env_file}; sudo -E -u discovery {python} {code_dir}/manage.py showmigrations",
} }
NGINX_ENABLE = {
'lms': "sudo ln -sf /edx/app/nginx/sites-available/lms /etc/nginx/sites-enabled/lms",
'cms': "sudo ln -sf /edx/app/nginx/sites-available/cms /etc/nginx/sites-enabled/cms",
}
HIPCHAT_USER = "PreSupervisor" HIPCHAT_USER = "PreSupervisor"
# Max amount of time to wait for tags to be applied. # Max amount of time to wait for tags to be applied.
...@@ -250,6 +254,13 @@ if __name__ == '__main__': ...@@ -250,6 +254,13 @@ if __name__ == '__main__':
report.append("Enabling service: {}".format(service)) report.append("Enabling service: {}".format(service))
else: else:
raise Exception("No conf available for service: {}".format(link_location)) raise Exception("No conf available for service: {}".format(link_location))
if service in NGINX_ENABLE:
subprocess.call(NGINX_ENABLE[service], shell=True)
report.append("Enabling nginx: {}".format(service))
# We have to reload the new config files
subprocess.call("/bin/systemctl reload nginx", shell=True)
except AWSConnectionError as ae: except AWSConnectionError as ae:
msg = "{}: ERROR : {}".format(prefix, ae) msg = "{}: ERROR : {}".format(prefix, ae)
if notify: if notify:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment