-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow overriding fabric ENVS, create sync task. #1337
Conversation
Only glanced at the code, but I like the idea. |
Cool, what do you think @jerivas, I think you had done the most recent work on the fabfile. |
Nice idea! A few things:
|
I think with the You're about to overwrite the database and uploaded media in FOO with database and uploaded media from BAR. Are you sure? (where FOO and BAR are the env names in the We'd also need an optional arg to these, akin to The thinking here is that judging from some of the mailing list posts, a lot of people expect there to be a way to automatically do this without actually overwriting data, and they expect a tool like this to somehow magically merge the environments, so it needs to be very clear that's not what's happening. What do you guys think? |
Thanks for the feedback guys! @jerivas I've updated the FABRIC dict in local_settings.py.template, removed GUNICORN_PORT from the example, and added the missing newline. @stephenmcd I think that the confirm message was a really good idea and will save a lot of headaches for us and users in the future. I've just added a confirm to the beginning of sync_to, the task that calls the other sync tasks. Do you think there should be more than one confirm? I also added a no_input argument to sync_to, I specifically tested I think it would be good to get some more people to test the sync_to command before we merge this. It is working for me in a production environment, but that is using the old fabric file. |
Oh, just remembered that you should update the docs too, both to
document the new sync task and the new FABRIC syntax.
|
Good call @jerivas, just updated the docs. I'd appreciate it if a few people could give it a read through to make sure it makes sense. Also, It would still be good for others to test the sync command. Thanks! |
Will try to give it a shot in the weekend.
|
🎉 This issue has been resolved in version 5.0.0-rc.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 5.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This is a bit of a work in progress.
Update the FABRIC dictionary to be expected to look like this (the old style will still work as well):
In the above
DEV
andPROD
are optional dictionaries that can override values in theDEFAULT
dictionary.DEV
andPROD
are not required and any other names or number of dictionaries can be used.To have a non default dictionary override pass
--set FABENV=ENV
to any fabric command where ENV is a key in theFABRIC
dictionary. For example:would call the
all
task and override any values inDEFAULT
that are also inDEV
with the values fromDEV
.If no overrides are desired call fabric commands like normal, i.e.:
My motivation for the above changes was to create a sync command that will sync the database and static files from one environment to another (this command is also included in the pull request). The usage of it would be:
Fabric hosts can technically be a list of hosts, I don't think this will support that as is so if that should be supported it will take some more work. If anyone has thoughts on the best way to do that let me know!