Skip to content

Commit

Permalink
Merge pull request #15 from caktus/cloud-staticfiles
Browse files Browse the repository at this point in the history
Add a cloud_staticfiles variable
jbradberry authored Sep 13, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents d0f678f + bb7ca75 commit 0389fe8
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ Tequila-django

Changes

v 0.9.5 on Sep 13, 2017
-----------------------

* Added a ``cloud_staticfiles`` boolean variable, that determines
whether to run ``collectstatic`` only once or not.


v 0.9.4 on Sep 6, 2017
----------------------

8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ The following variables are used by the ``tequila-django`` role:
- ``requirements_extra_args`` **default:** ``""``
- ``use_newrelic`` **default:** ``false``
- ``new_relic_license_key`` **required if use_newrelic is true**
- ``cloud_staticfiles`` **default:** ``false``
- ``gunicorn_version`` **optional**
- ``gunicorn_num_workers`` **required**
- ``gunicorn_num_threads`` **optional** (note: gunicorn sets this at ``1`` if ``--threads=...`` is not given)
@@ -125,6 +126,13 @@ checkout of the repo is rsynced into the environment, with a few
exclusions (.pyc files, the .git directory, the .env file, and the
node_modules directory).

The ``cloud_staticfiles`` variable is to allow for the case where the
Django static files are being collected to an external service, such
as S3. In that case, we don't want to be running ``collectstatic`` on
every web instance, since they'll be getting in each other's way.
This variable set to ``true`` causes the ``collectstatic`` task to be
run only once.

Optimizations
-------------

1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ db_name: "{{ project_name }}_{{ env_name }}"
db_user: "{{ project_name }}_{{ env_name }}"
db_host: 'localhost'
db_port: 5432
cloud_staticfiles: false
static_dir: "{{ root_dir }}/public/static"
media_dir: "{{ root_dir }}/public/media"
log_dir: "{{ root_dir }}/log"
1 change: 1 addition & 0 deletions tasks/web.yml
Original file line number Diff line number Diff line change
@@ -59,3 +59,4 @@
command: /bin/true
notify:
- collectstatic
run_once: "{{ cloud_staticfiles }}"

0 comments on commit 0389fe8

Please sign in to comment.