- Add the ability to skip the
rm -rf
step inbower-install.sh
andnpm-install.sh
, whenbower.json
orpackage.json
has changed, by exportingBOWER_INSTALL_SH_SKIP_CLEAN=1
orNPM_INSTALL_SH_SKIP_CLEAN=1
.
-
django-compressor
andixc-whitenoise
will now include a.$GIT_COMMIT
suffix in their manifest filename, so we can run new and old versions of a codebase side by side with a shared volume.When upgrading:
-
To disable this behaviour for local development, where you do not want to re-compress or collect static files for every commit, add the following to your
.env.develop.secret
file:# Configure static file manifests. Comment out to save versioned files with a # `$GIT_COMMIT` suffix. export COMPRESS_OFFLINE_MANIFEST='manifest.json' export STATICFILES_MANIFEST='staticfiles.json'
-
- Use tuple instead of list for template dirs, context processors, loaders. Check if you are using
+= [..., ]
and change to(..., )
-
setup.sh
andsetup-tests.sh
no longer automatically run any npm script, even ifSETUP_NPM_RUN
orSETUP_TESTS_NPM_RUN
is defined.Instead, export
SETUP_COMMAND
andSETUP_TESTS_COMMAND
, which can be any shell command instead of the name of an npm script.This allows us to execute any combination of npm scripts in sequence (via
run-s
) or parallel (viarun-p
), without cluttering uppackage.json
with near identical wrapper scripts.We can also execute any shell script or bash command.
When upgrading:
-
Add
export SETUP_COMMAND='npm run -l build --if-present'
andexport SETUP_TESTS_COMMAND='npm run -l build --if-present'
to your.env
file to restore the old behaviour. -
Or add
export SETUP_COMMAND='...'
to your.env
file, as required.
-
-
The
COMPRESS_OFFLINE
setting is nowTrue
. Offline compression is required when using WhiteNoise without autorefresh, which is not used in production because it is only intended for development and has had a serious security issue in the past.When upgrading:
- Add
"compress": "manage.py compress --verbosity=0"
to thepackage.json
file. - Add
export SETUP_COMMAND='run-s -l compress ...'
to your.env
file. - Add
run-s -l collectstatic compress
toDockerfile
. - Confirm that your
{% compress %}
blocks do not have any dynamic content (changes with context), or setIXC_COMPRESSOR_REQUEST
,IXC_COMPRESSOR_GLOBAL_CONTEXT
andIXC_COMPRESSOR_OPTIONAL_CONTEXT
accordingly.
- Add
-
Supervisor no longer wraps its programs with
entrypoint.sh
. This was a convenience during troubleshooting so we could edit a dotenv file and restart the program, without having to restart supervisor or the container itself.Now that
entrypoint.sh
is optional, it is no longer appropriate to always wrap programs with it.If you are still using
entrypoint.sh
, in a pinch you can live edit the supervisor template to reinstate the wrapper.
setup.sh
now runs thesetup
npm script instead ofbuild
, to better reflect its purpose. To upgrade, rename yourbuild
script tosetup
inpackage.json
or exportSETUP_NPM_RUN=build
in your env file(s).- The hard coded
collectstatic
andcompress
commands have been removed fromruntests.sh
. Instead, thesetup
npm script is run bysetup-tests.sh
. If you need to execute different commands for setup and tests, exportSETUP_TESTS_NPM_RUN=foo
in your env file(s).
- Rename
SUPERVISORD_*
environment variables toSUPERVISOR_*
for consistency with Supervisor's own environment variables. - Remove
logentries
program fromsupervisor.tmpl.conf
. Add it back viaSUPERVISOR_TMPL_CONF
, if needed. - Run a single gunicorn process by default. Explicitly set
GUNICORN_WORKERS=auto
for the previous behaviour (2x CPU cores +1 for sync, 1x CPU cores for async). - Run a single nginx worker process by default. Explicitly set
NGINX_WORKER_PROCESSES=auto
for the previous behaviour (1 per CPU core). - Remove
www
redirect via nginx whenNGINX_REDIRECT_SERVER_NAME
is defined. Do the redirect in your app or with https://github.com/ixc/nginx-proxy-redirect
- Add
prefix-logs.sh
and use it insupervisor.include.tmpl.conf
. Send program logs directly to stdout and stderr with a prefix, so we don't needdockerize -stdout ... -stderr ...
anymore. - Send nginx access log to stdout instead of gunicorn, now that we can send all supervisor program logs directly to stdout and stderr with a prefix.
- Add
SUPERVISOR_NUMPROCS
environment variable, for programs that don't internally run multiple worker processes. - Each process will have
SUPERVISOR_PROCESS_NUM
environment variable set, which can be used to increment the baseNGINX_PROXY_PORT
(default: 8080) port number. - Configure nginx to load balance all processes via the default server, AND allow direct access to each process via
s{{ SUPERVISOR_PROCESS_NUM }}.*
subdomains. - Define default environment variables once in shell scripts instead of config templates, where they are often needed multiple times.
- Disable nginx CPU affinity. Allow workers to execute on any available process.
- Move nginx config from lower to higher contexts (e.g. from
server
tohttp
) where possible.
-
djcelery.schedulers.DatabaseScheduler
is no longer hard coded incelerybeat.sh
. If you want to continue using the database scheduler, addCELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
to your project settings. -
Offline compression is no longer enabled in
compressor.py
settings, because we now have persistent shared volumes on Docker for AWS. If you want to continue using offline compression, addCOMPRESS_OFFLINE = True
to your project settings. -
git-secret
is no longer supported. Switch totranscrypt
, before upgrading. -
SASS/SCSS precompiler has been removed from
compressor.py
settings, because it forks a compiler on every single request when offline compression is disabled. Instead:- Add
RUN entrypoint.sh compile-scss.sh
toDockerfile
before collecting static files. - Add
static/COMPILED/
to.dockerignore
and/static/COMPILED/
to.gitignore
. - Reference the compiled CSS in templates, instead of the source SCSS. For example:
{% static "COMPILED/scss/foo.css" %}
instead of{% static "scss/foo.scss" }
. - Run
compile-sass.sh --watch
during development.
- Add
-
Setuptools has vendored its dependencies again. Update
Dockerfile
andgo.sh
, changingpip install ... -r <(grep -v setuptools requirements.txt)
topip install ... -r requirements.txt
-
setup-django.sh
has been removed in favour ofsetup.sh
andsetup-wait.sh
. Add the former to a newsetup
service with no health check. Replacesetup-django.sh
with the latter in existing services, and removestart_period
from health checks. -
Dockerize is now a required.
-
If your project uses Python 3, you must export
PYTHON_VERSION=python3
inDockerfile
and specify--python=python3
ingo.sh
when creating the virtualenv. -
go.sh
no longer uses the active virtualenv instead ofvar/go.sh-venv
whenVIRTUAL_ENV
is set. If you want to continue using a virtualenv in a non-standard location, addPROJECT_VENV_DIR='path/to/venv/dir'
to your.env.base
file. -
Editable packages are now always installed in
$PROJECT_DIR/src
, when run with Docker orgo.sh
. If you want to install to a different location, addPIP_SRC='path/to/src/dir'
to your.env.local
file. -
Stub
setup.py
files are no longer needed to add the project directory to the Python path. -
Gunicorn now uses
gevent
async worker by default. If you want to continue using the default sync worker, addGUNICORN_WORKER_CLASS='sync'
to your.env.base
file. -
runserver.sh
now runs Gunicorn instead of the Django dev server, with a single async worker, autoreloading enabled, and simplified logging. If you want to run the Django dev server, runmanage.py runserver 0.0.0.0:8000
. -
bash.sh
sleeps forever when there is no tty. Use this as the command in ashell
service with no replicas, which you can scale up on demand then exec into to troubleshoot. -
You no longer need to manually terminate existing connections before executing
SETUP_POSTGRES_FORCE=1 setup-postgres.sh
to drop and recreate a database. -
SETUP_POSTGRES_FORCE=1 setup-postgres.sh
will now prompt for confirmation when there is a tty, for safety. -
You can now exclude unwanted table data when restoring from a source database via
SRC_PGDUMP_EXTRA
. For example,SRC_PGDUMP_EXTRA='--exclude-table-data django_session --exclude-table-data FOO ...'
-
Management commands executed in
Dockerfile
should be wrapped withentrypoint.sh
to ensure the runtime environment is properly configured.
-
Config templates are now rendered to the
$PROJECT_DIR/var/etc
directory for easier discovery and to avoid writing to potentially read-only file systems.The default templates can be overridden by setting the
LOGENTRIES_TMPL_CONF
,NEWRELIC_TMPL_CONF
,NGINX_TMPL_CONF
,SUPERVISOR_TMPL_CONF
, orSUPERVISOR_INCLUDE_TMPL_CONF
environment variables in your dotenv file. -
supervisor.sh
no longer attempts to render$PROJECT_DIR/etc/supervisor.tmpl.conf
as an alternative to the default include config (nginx proxy).Instead, you should explicitly set
SUPERVISOR_INCLUDE_TMPL_CONF=$PROJECT_DIR/etc/supervisord.include.tmpl.conf
in your dotenv file.