Remove older built JS/CSS files
notify:
- restart uwsgi
+- name: rsync build Django code to {{ airavata_django_checkout }}, deleting older built files
+ synchronize:
+ src: "{{ airavata_django_portal_tempdir.path }}/{{ item }}/"
+ dest: "{{ airavata_django_checkout }}/{{ item }}"
+ delete: yes
+ rsync_opts:
+ - "--exclude=node_modules"
+ # Bug: become_user doesn't work with synchronize: https://github.com/ansible/ansible/issues/29698
+ rsync_path: "sudo -u {{ user }} rsync"
+ # become: yes
+ # become_user: "{{user}}"
+ notify:
+ - restart uwsgi
+ with_items:
+ - "django_airavata/apps/api/static/django_airavata_api"
+ - "django_airavata/static/common"
+ - "django_airavata/apps/admin/static/django_airavata_admin"
+ - "django_airavata/apps/groups/static/django_airavata_groups"
+ - "django_airavata/apps/workspace/static/django_airavata_workspace"
+ - "django_airavata/apps/dataparsers/static/django_airavata_dataparsers"
+
- name: Create virtual environment for Django portal and install dependencies
pip:
requirements: "{{ item }}"
become: yes
become_user: "{{user}}"
+- name: Find built JS/CSS files in /static directory accessed more than 30d ago
+ find:
+ paths: "{{ doc_root_dir }}/static"
+ age: 30d
+ age_stamp: atime
+ recurse: yes
+ register: static_files_to_delete
+ become: yes
+ become_user: "{{user}}"
+
+- name: Remove older built files from /static directory
+ file:
+ path: "{{ item.path }}"
+ state: absent
+ with_items: "{{ static_files_to_delete.files }}"
+ become: yes
+ become_user: "{{user}}"
+
- name: Run Django's manage.py collectstatic
django_manage:
command: "collectstatic -i node_modules --noinput"
