Open maxbucknell opened 6 years ago
I would appreciate this having the highest priority over any/all other features. I especially like having the env.php file in the repo & automatically put in place should it be needed.
If someone solves this, without needing a huge rewrite, they'd be directly impacting the productivity of nearly 20 devs. @maxbucknell you've made it sound easy, let make it happen
I think I'd be more hindrance than help, but @maxbucknell please let me know if there's anything I can do to help with this. This would have literally saved me days of work.
Requirements
local.env
and running aworkflow
command.Solution
Existing Projects
Right now, the workflow to set up an existing project is:
Magento 1:
Magento 2:
The requirements of setting up Magento 1 and Magento 2 are largely the same: we need a configuration file (
app/etc/local.xml
andapp/etc/env.php
respectively), and we need a database with which to seed.But these two processes are quite different. In the Magento 2 case, we are installing Magento from scratch, and then installing a database dump on top of that. This wastes a little bit of time, but can also cause problems for projects that don’t install cleanly.
We could unify these approaches by creating a command called
configure
, which takes a single argument of a path to a database dump. In each case this would provision the relevant configuration files (bifurcation between M1 and M2), and then install a database.Clean Installations
As alluded to above, we sometimes have issues when the existing
mfi
command in Workflow does not complete. This is because of assumptions inherent in Magento modules’ setup scripts, wherein they assume that they are being installed into an already running Magento instance. These can be tricky to locate and fix, and in some cases there are things you wish to do in an upgrade script that are simply not possible, especially things to do with selecting themes, configuring websites and other things.Nevertheless, it should be an aim of all JH projects that installation without a seed database yields a valid environment, and we should explore opportunities on how to enforce and improve this.
But for now, we have cut the proverbial Gordian Knot by not requiring installation.
New Projects
Sometimes you want to install Magento from scratch. I don’t think anybody really wants to install Magento 1 from scratch anymore, so I’ve neglected that case and will only consider Magento 2 now.
We should maintain the
mfi
command, although I’d appreciate a rebranding toinstall
(as opposed toconfigure
) as part of simplifying and unifying the Workflow API.There isn’t much wrong with this, though. It reads from
local.env
and runs asetup:install
command. In doing that, it’s basically perfect.Generating Environment Files
As part of
workflow configure
, we generate eitherlocal.xml
, orenv.php
. This process should be improved.Every project will have an
etc/
directory that contains sample files, likeenv.php.twig
. These files will be processed through Twig (populated by variables inlocal.env
, and written toapp/etc
. This also allows us to remove theTemplateWriter
class from Workflow, and make the template language a little bit more approachable.