torchbox / wagtail-template

A Django template for starting new Wagtail projects with Vagrant. NO LONGER MAINTANED
19 stars 8 forks source link

Validate system status prior to migrating #9

Open nils-werner opened 9 years ago

nils-werner commented 9 years ago

This doesn't really prevent errors from happening but rather stops the deployment when there are validation errors. This check will happen prior to changing the database etc.

You could also implement a rollback mechanism using

    try:
        run('git pull origin master')
        run(pip + ' install -r requirements.txt')
        run(python + ' {{ project_name }}/manage.py validate --settings={{ project_name }}.settings.production')
    except SystemExit:
        run('git reset --hard HEAD@{1}')

this will pull the changes, try validating the system and, if it fails, undo the pull. I didn't implement this as it will not undo failing migrations etc. and currently only gives a false sense of security. :-)

davecranwell commented 9 years ago

Hi Nils,

This isn't pertinent to the content of this pull request specifically, but I need to point out that wagtail's main repo now contains its own project template. This specific repo is mainly now for internal Torchbox use. It's effectively not for public consumption. It was for the public, but We rethought things, stripped it back a little, made it less opinionated, and added it to wagtail's main repo here: https://github.com/torchbox/wagtail/tree/master/wagtail/project_template

Any changes you're suggesting here, while extremely useful, probably ought to be made in the main wagtail repo.

kaedroho commented 9 years ago

@nils-werner Thanks, this is a really good idea.

Could we use the manage.py check command instead? As this template is for starting Django 1.7 projects and validate has been deprecated in favour of check.

@davecranwell Yes, this template is aimed at Torchbox projects but it is still open to the public to use just as before. We only decided to create a separate template for wagtail start as we didn't want the default one to be so opinionated.

davecranwell commented 9 years ago

Ah ok, my point still stands though. Your changes may need to occur in two places. Perhaps not this specific pr, but perhaps https://github.com/torchbox/wagtail-template/pull/8 and any others you're due to submit