From ceeed8bbc13a59e504f082bbda151737e9128953 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 20 Jul 2017 18:09:15 -0400 Subject: [PATCH 1/2] Move the collectstatic task out into the handlers and be smarter about how we trigger them. This is needed because the artifacts generated by the `npm run build` step need to be included in the `collectstatic` step. --- handlers/main.yml | 10 +++++++++- tasks/web.yml | 35 +++++++++++++++++------------------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 7a25e8d..cd10ccd 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -13,4 +13,12 @@ become_user: "{{ project_user }}" vars: ansible_ssh_pipelining: true - when: package_json.stat.exists == True and build_script.stdout != "" + +- name: collectstatic + django_manage: + command: collectstatic + app_path: "{{ source_dir }}" + virtualenv: "{{ venv_dir }}" + become_user: "{{ project_user }}" + vars: + ansible_ssh_pipelining: true diff --git a/tasks/web.yml b/tasks/web.yml index 129c72d..0617f1f 100644 --- a/tasks/web.yml +++ b/tasks/web.yml @@ -22,20 +22,11 @@ # TODO: let connections to 8000 through the firewall if we are load-balancing. -- name: collectstatic - django_manage: > - command=collectstatic - app_path={{ source_dir }} - virtualenv={{ venv_dir }} - become_user: "{{ project_user }}" - vars: - ansible_ssh_pipelining: true - - name: migrate - django_manage: > - command=migrate - app_path={{ source_dir }} - virtualenv={{ venv_dir }} + django_manage: + command: migrate + app_path: "{{ source_dir }}" + virtualenv: "{{ venv_dir }}" become_user: "{{ project_user }}" vars: ansible_ssh_pipelining: true @@ -50,12 +41,20 @@ group={{ project_name }} mode=700 -- name: change ownership of node modules +# Note: we want the npm build and collectstatic steps to happen at the +# very end of the roles section for the current playbook, so that +# they'll still happen in the order needed even if the playbook has a +# 3rd-party role after tequila-django, e.g. geerlingguy/nodejs. Thus, +# they are moved out into handlers. + +- name: trigger build of npm artifacts command: /bin/true - notify: chown node_modules + notify: + - chown node_modules + - npm run build when: package_json.stat.exists == True and build_script.stdout != "" -- name: rebuild node modules +- name: trigger collectstatic command: /bin/true - notify: npm run build - when: package_json.stat.exists == True and build_script.stdout != "" + notify: + - collectstatic From 917d81435ba1892a8028c1e5da8d598ede02faf6 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 20 Jul 2017 18:13:56 -0400 Subject: [PATCH 2/2] Update the CHANGES file --- CHANGES.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9c676f8..eedc23f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,14 @@ Tequila-django Changes +v 0.9.1 on July 20, 2017 +------------------------ + +* Convert the collectstatic task into a handler. This is needed so + that it happens after the ``npm run build`` step, so that the files + generated from that are included. + + v 0.9.0 on July 18, 2017 ------------------------