Commit dc15da43 by Fred Smith

edxapp on django 1.8

parent f5134954
...@@ -11,8 +11,8 @@ import time ...@@ -11,8 +11,8 @@ import time
# Services that should be checked for migrations. # Services that should be checked for migrations.
MIGRATION_COMMANDS = { MIGRATION_COMMANDS = {
'lms': "{python} {code_dir}/manage.py lms migrate --noinput --settings=aws --db-dry-run --merge", 'lms': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list",
'cms': "{python} {code_dir}/manage.py cms migrate --noinput --settings=aws --db-dry-run --merge", 'cms': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list",
'xqueue': "{python} {code_dir}/manage.py xqueue migrate --noinput --settings=aws --db-dry-run --merge", 'xqueue': "{python} {code_dir}/manage.py xqueue migrate --noinput --settings=aws --db-dry-run --merge",
'ecommerce': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list", 'ecommerce': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list",
'programs': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list", 'programs': ". {env_file}; {python} {code_dir}/manage.py migrate --noinput --list",
...@@ -73,6 +73,8 @@ if __name__ == '__main__': ...@@ -73,6 +73,8 @@ if __name__ == '__main__':
help="Location of the edx-platform code.") help="Location of the edx-platform code.")
migration_args.add_argument("--edxapp-python", migration_args.add_argument("--edxapp-python",
help="Path to python to use for executing migration check.") help="Path to python to use for executing migration check.")
migration_args.add_argument("--edxapp-env",
help="Location of the ecommerce environment file.")
xq_migration_args = parser.add_argument_group("xqueue_migrations", xq_migration_args = parser.add_argument_group("xqueue_migrations",
"Args for running xqueue migration checks.") "Args for running xqueue migration checks.")
...@@ -205,16 +207,7 @@ if __name__ == '__main__': ...@@ -205,16 +207,7 @@ if __name__ == '__main__':
for service in services_for_instance(instance_id): for service in services_for_instance(instance_id):
if service in MIGRATION_COMMANDS: if service in MIGRATION_COMMANDS:
# Do extra migration related stuff. # Do extra migration related stuff.
if (service == 'lms' or service == 'cms') and args.edxapp_code_dir: if service == 'xqueue' and args.xqueue_code_dir:
cmd = MIGRATION_COMMANDS[service].format(python=args.edxapp_python,
code_dir=args.edxapp_code_dir)
if os.path.exists(args.edxapp_code_dir):
os.chdir(args.edxapp_code_dir)
# Run migration check command.
output = subprocess.check_output(cmd, shell=True)
if 'Migrating' in output:
raise Exception("Migrations have not been run for {}".format(service))
elif service == 'xqueue' and args.xqueue_code_dir:
cmd = MIGRATION_COMMANDS[service].format(python=args.xqueue_python, cmd = MIGRATION_COMMANDS[service].format(python=args.xqueue_python,
code_dir=xqueue_code_dir) code_dir=xqueue_code_dir)
if os.path.exists(args.xqueue_code_dir): if os.path.exists(args.xqueue_code_dir):
...@@ -225,6 +218,8 @@ if __name__ == '__main__': ...@@ -225,6 +218,8 @@ if __name__ == '__main__':
raise Exception("Migrations have not been run for {}".format(service)) raise Exception("Migrations have not been run for {}".format(service))
else: else:
new_services = { new_services = {
"lms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
"cms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
"ecommerce": {'python': args.ecommerce_python, 'env_file': args.ecommerce_env, 'code_dir': args.ecommerce_code_dir}, "ecommerce": {'python': args.ecommerce_python, 'env_file': args.ecommerce_env, 'code_dir': args.ecommerce_code_dir},
"programs": {'python': args.programs_python, 'env_file': args.programs_env, 'code_dir': args.programs_code_dir}, "programs": {'python': args.programs_python, 'env_file': args.programs_env, 'code_dir': args.programs_code_dir},
"insights": {'python': args.insights_python, 'env_file': args.insights_env, 'code_dir': args.insights_code_dir}, "insights": {'python': args.insights_python, 'env_file': args.insights_env, 'code_dir': args.insights_code_dir},
......
...@@ -11,4 +11,4 @@ setuid {{ supervisor_user }} ...@@ -11,4 +11,4 @@ setuid {{ supervisor_user }}
{% set programs_command = "" %} {% set programs_command = "" %}
{% endif %} {% endif %}
exec {{ supervisor_venv_dir }}/bin/python {{ supervisor_app_dir }}/pre_supervisor_checks.py --available={{ supervisor_available_dir }} --enabled={{ supervisor_cfg_dir }} {% if SUPERVISOR_HIPCHAT_API_KEY is defined %}--hipchat-api-key {{ SUPERVISOR_HIPCHAT_API_KEY }} --hipchat-room {{ SUPERVISOR_HIPCHAT_ROOM }} {% endif %} {% if edxapp_code_dir is defined %}--edxapp-python {{ COMMON_BIN_DIR }}/python.edxapp --edxapp-code-dir {{ edxapp_code_dir }}{% endif %} {% if xqueue_code_dir is defined %}--xqueue-code-dir {{ xqueue_code_dir }} --xqueue-python {{ COMMON_BIN_DIR }}/python.xqueue {% endif %} {% if ecommerce_code_dir is defined %}--ecommerce-env {{ ecommerce_home }}/ecommerce_env --ecommerce-code-dir {{ ecommerce_code_dir }} --ecommerce-python {{ COMMON_BIN_DIR }}/python.ecommerce {% endif %} {% if insights_code_dir is defined %}--insights-env {{ insights_home }}/insights_env --insights-code-dir {{ insights_code_dir }} --insights-python {{ COMMON_BIN_DIR }}/python.insights {% endif %} {% if analytics_api_code_dir is defined %}--analytics-api-env {{ analytics_api_home }}/analytics_api_env --analytics-api-code-dir {{ analytics_api_code_dir }} --analytics-api-python {{ COMMON_BIN_DIR }}/python.analytics_api {% endif %} {{ programs_command }} exec {{ supervisor_venv_dir }}/bin/python {{ supervisor_app_dir }}/pre_supervisor_checks.py --available={{ supervisor_available_dir }} --enabled={{ supervisor_cfg_dir }} {% if SUPERVISOR_HIPCHAT_API_KEY is defined %}--hipchat-api-key {{ SUPERVISOR_HIPCHAT_API_KEY }} --hipchat-room {{ SUPERVISOR_HIPCHAT_ROOM }} {% endif %} {% if edxapp_code_dir is defined %}--edxapp-python {{ COMMON_BIN_DIR }}/python.edxapp --edxapp-code-dir {{ edxapp_code_dir }} --edxapp-env {{ edxapp_app_dir }}/edxapp_env{% endif %} {% if xqueue_code_dir is defined %}--xqueue-code-dir {{ xqueue_code_dir }} --xqueue-python {{ COMMON_BIN_DIR }}/python.xqueue {% endif %} {% if ecommerce_code_dir is defined %}--ecommerce-env {{ ecommerce_home }}/ecommerce_env --ecommerce-code-dir {{ ecommerce_code_dir }} --ecommerce-python {{ COMMON_BIN_DIR }}/python.ecommerce {% endif %} {% if insights_code_dir is defined %}--insights-env {{ insights_home }}/insights_env --insights-code-dir {{ insights_code_dir }} --insights-python {{ COMMON_BIN_DIR }}/python.insights {% endif %} {% if analytics_api_code_dir is defined %}--analytics-api-env {{ analytics_api_home }}/analytics_api_env --analytics-api-code-dir {{ analytics_api_code_dir }} --analytics-api-python {{ COMMON_BIN_DIR }}/python.analytics_api {% endif %} {{ programs_command }}
...@@ -21,4 +21,3 @@ ...@@ -21,4 +21,3 @@
dependencies: dependencies:
- supervisor - supervisor
- redis
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