Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cloud_staticfiles variable #15

Merged
merged 2 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------

Expand Down
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
-------------

Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tasks/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@
command: /bin/true
notify:
- collectstatic
run_once: "{{ cloud_staticfiles }}"