Skip to content
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

Smoother Set Up #106

Open
2 tasks
maxbucknell opened this issue Mar 28, 2018 · 3 comments
Open
2 tasks

Smoother Set Up #106

maxbucknell opened this issue Mar 28, 2018 · 3 comments

Comments

@maxbucknell
Copy link
Contributor

maxbucknell commented Mar 28, 2018

Requirements

  • As a developer, I should be able to initialise a project in a fashion that is seamless and consistent across projects, requiring only the codebase and a database seed.
  • As a developer, I should be able to install Magento from scratch by configuring local.env and running a workflow command.

Solution

Existing Projects

Right now, the workflow to set up an existing project is:

Magento 1:

$ workflow n98 local-config:generate
$ workflow sql -f dump.sql

Magento 2:

$ workflow mfi
$ workflow sql -f dump.sql

The requirements of setting up Magento 1 and Magento 2 are largely the same: we need a configuration file (app/etc/local.xml and app/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 to install (as opposed to configure) as part of simplifying and unifying the Workflow API.

There isn’t much wrong with this, though. It reads from local.env and runs a setup:install command. In doing that, it’s basically perfect.

Generating Environment Files

As part of workflow configure, we generate either local.xml, or env.php. This process should be improved.

Every project will have an etc/ directory that contains sample files, like env.php.twig. These files will be processed through Twig (populated by variables in local.env, and written to app/etc. This also allows us to remove the TemplateWriter class from Workflow, and make the template language a little bit more approachable.

@shakyShane
Copy link
Contributor

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.

@shakyShane
Copy link
Contributor

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

@JodiWarren
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants