django-simple-deploy
django-simple-deploy copied to clipboard
Refine Platform.sh support
#71 is getting crowded, so moving ongoing work to this issue. The goal of this issue is to bring support for Platform.sh to a level comparable to Heroku's current level of support. This work will bring up some issues that affect both platforms, as the overall structure of simple_deploy becomes more refined and consistent.
Anything that can be moved to a longer-term issue can be added to #90.
- [x] Finish updating documentation to reflect current Platform.sh implementation.
- [x] Move remaining items from #71 to here, and another longer-term issue; this one is for refinements before returning to a more general project focus, and revisiting other platforms.
- [x] Add a new developer doc, describing the deployment process as implemented between simple_deploy.py and deploy_platform.py.
- [ ] Get platform-specific confirmation (ie
_confirm_preliminary()) in simple_deploy.py, before making any changes such as building log dir. - [ ] Refine initial inspection, both generally and platform-specific.
- [ ] Require
platform createto be called before running simple_deploy, without--automate-all. - [ ] Make sure configuration changes are done in order of least impact to the current state of the project.
- [ ] Move adding simple deploy req to simple_deploy, now that inspection is done in a more consistent manner.
- [ ] Implement
automate-all.- [ ] The
platform createcommand can be run with a--quietflag, and there are flags for everything that's prompted interactively. To see this, runplatform help project:create. - [ ] Use Platform.sh integration test as a blueprint for implementing
--automate-all.
- [ ] The
- [ ] Write friendly summary log file.
- [ ] Support Poetry.
- [x] Document any general principles that have been defined or clarified through this work.
- [ ] Make sure Heroku deployments still work.
- [ ] Some changes to simple_deploy.py will have impacts on deploy_heroku.py. Make sure any new errors are addressed, and all current tests for Heroku still pass.
- [ ] Make issue to bring deploy_heroku.py to a consistent state with the current overall approach.
- [ ] Examine current state of support on Windows. Probably means documenting how to install and use CLI on Windows.
- [ ] Update existing documentation.
Refine documentation
- [x] Finish updating platformsh_deployements.md.
Working notes
- [ ] Consider bailing if
git statusdoes not return "nothing to commit, working tree clean".- Really want to encourage users to be able to easily undo configuration changes.
- [ ] Consider a flag to ignore this, ie
--force-git-unclean. Maybe simple_deploy is running a second time, and they don't want multiple commits for configuration? See #28. - [ ] Consider what this means if using
--automate-all. We are making commits in this case, and we really don't want to have user changes mixed in with our changes when we make a commit.
- [x] Move confirmation of
--automate-allto simple_deploy.py. Platform-specific script should not have to deal with this confirmation, other than being called by simple_deploy to generate a platform-specific message about what will be done to automate deployment.
Move adding simple deploy req to simple_deploy
- This gets at a fundamental architectural question: should deploy_platform-name.py do any general work, or only platform-specific work. The latter seems much better. That will change a number of things, like whether
_check_platform()is still a good name in simple_deploy.py. - [x] Figure out an appropriate way to call
_add_simple_deploy_req()from within simple_deploy.py.- [x] _check_platform() should create platform-specific deployer, and call any platform-specific checks and validations.
- [x] Call
add_simple_deploy_req()from simple_deploy.py, not platform-specific script. - [x] Move logging work so it occurs after platform-specific validation. See below.
- [x] Refactor for confirmation (ie
while confirmed.lower()...) to simple_deploy.- [x] Use for confirming
--automate-all. - [x] Use for confirming preliminary status in platform_sh deployments.
- [x] Use for confirming
- [x] Add
validate_platform()methods to platform-specific deployer classes. Can bepass()with DEV comment for now if needed.- [x] This should be called before confirming automate all; no need confirming that if the platform won't work.
- [x] Check for platform_sh cli.
- [x] Check for platformshconfig.
- [x] Update unit testing approach to install platformshconfig, with remote pip call.
- [x] Add platformshconfig to vendor/.
- [x] Check for Heroku CLI.
- [x] Use helper method naming consistently. Some things that were helpers are now being called through instances.
- [x] simple_deploy.py
- [x] deploy_heroku.py
- [x] deploy_platformsh.py
- [x] then call platform_deployer.deploy()
- [x] make these changes for platform_sh, then for heroku as well.
- [x] Clean up
_parse_cli_options(); it's doing more than parsing cli options. Most of this should probably be moved tohandle().
Start logging after all validation complete
This is part of making sure no changes are made until after all validation is complete. This also makes dev work easier, as a test project is not modified at all when intentionally running invalid commands.
- [x] Move creation of logging to after platform validation, before adding simple_deploy req.
- [x]
_inspect_project()ignores logs; this needs to be moved, because it won't be possible before starting to log.- [x] Consider building a preliminary log entry; once we make the log, dump this text to the log as soon as it's created.
- [x] Looks like there's nothing we really need to log in
_get_dep_man_approach(). Skip logging here, and everything should work.- [x] Seems to be creating log dir, but no log file. Diagnose in
_start_logging(). If you start logging before configuring the logger, it doesn't use the configured log file. Stopped all logging before calling start_logging(). - [x] Probably need to log if we couldn't find a .git dir. No, this is reported in an error message and logging should not be critical for diagnosing anything related to this.
- [x] Address these issues, then remove all diagnostics and address recent DEV notes.
- [x] Seems to be creating log dir, but no log file. Diagnose in
- [x] Make this part of unit testing, if not already tested. (Check that the info in the preliminary log entry is present in the log file.)
- [x] How easily can I test that an invalid command results in no log dir or file?
- [x] Verify by running
--platform platform_shand denying confirmation; logs should not appear. - [x] Verify by confirming, with exit() call before deploy() call. Logs should appear.
- [x] Move confirmation of
--automate-allto simple_deploy, and move related messages out of_parse_cli_options().- [x] Needs to be run after the platform deployer object has been created. (No, just needs access to platform-specific messages.)
- [x] Needs to display a platform-specific message.
- [x] Revise
_prep_automate_all()with the simplification that confirmation has already happened. - [x] Can I easily test any of this? Not now, but added note to #14.
Closing
- [ ] Remove any remaining diagnostics.
- [ ] Are there any remaining DEV notes in simple_deploy.py that can be addressed before moving on?
All unfinished tasks moved to #92.