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

Include basic Docker environment #644

Closed
colinmollenhour opened this issue Apr 1, 2019 · 21 comments
Closed

Include basic Docker environment #644

colinmollenhour opened this issue Apr 1, 2019 · 21 comments

Comments

@colinmollenhour
Copy link
Member

I think these days it makes sense to include a basic Docker environment (docker-compose.yml, Dockerfiles, config files) with a project so that a working environment can be launched quickly using a simple docker-compose up allowing users to easily try the project out and also easily contribute improvements that are tested in Magento LTS and not just patched in from another installation.

This is not meant to be a production-ready environment although it could serve as a starting point for such.

I'd like to get thoughts and feedback on:

  • Objections? Does this really belong in this project? (I think it does - see above)
  • If so, specifically where does it belong? Should the entire project be reorganized to put the web root in a subdirectory so that other files can be left out more easily? (this would obviously break BC for people that just clone the repo - but placing these files in a new directory in the root is messy..)
  • Does anyone know of a really solid implementation that could serve as a reference or starting point? I'm sure there are many but I haven't looked yet.
  • Should nginx be the default web server over Apache? Placing the entire project within the Apache web root and then trying to lock everything down with .htaccess files is in my opinion a horrible way to do it...
@inluxc
Copy link

inluxc commented Apr 1, 2019

👍

The project must evolve

@tylers-username
Copy link

I use Lando for all of my Magento projects (M1 & M2). I strongly suggest using Lando so that the barrier of entry to containers for less experienced devs is much lower.

This repository could be distributed with a .lando.dist to get users up and running with a default setup (perhaps redis, MariaDB and PHP 7) and then users could provide overrides as needed.

For those familiar with Platform.sh, Lando works in a very similar manner.

Also, I have a PR and issue open with Lando to provide an extensible default Magento 2 recipe. If there is enough interest from the OpenMage community, I will consider creating a PR for a default Magento 1 recipe as well.

@tmotyl
Copy link
Contributor

tmotyl commented Apr 1, 2019

Im using ddev :)

@Flyingmana
Copy link
Contributor

I would (actually I started already, like two times) do this in a separate repository. There are different approaches to the whole thing, and not a single truth.

one approach you can find in https://github.com/OpenMage/Testfield/tree/master/.docker where I did use docker for everything non-php and did run magento natively with the builtin webserver.

For freelancers and agencies they need a more flexible approach I guess (many use stuff based on local dns resolver for domain lookups, and Iam not sure, how we can prepare something, which will cover their needs.

Or should we just go the easy way and provide the most simple approach which likely is not performing perfectly (on macs)?

In any case, happy to help/review/test this, have currently all 3 major OS available

@edannenberg
Copy link
Contributor

While being convenient I feel this encourages users to work with the repo in the worst possible way. Ideally this repo is nothing but a dependency for actual projects that have their own repo and dev environment handling.

I would prefer we only provide documentation on how to setup a recommended workflow/dev environment with Docker.

@tylers-username
Copy link

tylers-username commented Apr 1, 2019

@Flyingmana - this is why I recommended Lando. OpenMage can say, "For those new to Magento and trying it out for the first time, clone the repo and run lando start." The dev now has a fully functional environment to play around in.

Any establish freelancer or agency will likely already have a preferred setup, I think this thread is about giving devs who are new to Magento something they can quickly spin up and start playing around in.

@colinmollenhour
Copy link
Member Author

@tylerssn The first step is actually "Install Lando" which while not difficult it is not exactly simple either. It is not a single binary like docker-compose and docker-compose is a requirement anyway so I think it adds extra steps. I looked at the docs for a bit and I think a good dev environment can be setup with just "docker-compose up" without adding additional layers.

@edannenberg

Ideally this repo is nothing but a dependency for actual projects that have their own repo and dev environment handling.

The problem with this is then their entire custom environment is part of the dev environment. Having a basic Docker setup would allow a developer who wants to work on a contribution using a completely pristine environment much easier.

@colinmollenhour
Copy link
Member Author

The project by @alexcheng1982 looks like a great example. Perhaps he would be interested in keeping a fork which uses magento-lts instead of magento-mirror and then we could just reference it in the README.

https://github.com/alexcheng1982/docker-magento

@Flyingmana
Copy link
Contributor

Flyingmana commented Apr 2, 2019

okay, so for lando it would just need a recipe which is created on their side, that would also be good PR(as in PublicRelations) for us to directly add it as OpenMage and it would not need any change in our repository.
OpenMage/organizational#12
I did create a separate ticket for this already so we can continue here with the other possibilities:

If for a docker container we could work together with one of the existing ones, that would be a lot easier, and we can reference (maybe multiple) vie Readme and Website.

And maybe we also have at one point an example/demo project ready, which fetches OpenMage as a dependency via composer, as it should be for an actual project. By the Way, is anyone aware of public OpenMage demos? Has anyone the possibilities to get hosting resources for one?

@FredericMartinez
Copy link
Contributor

@colinmollenhour I think it's better to create an OpenMage/docker repository, and update OpenMage/magento-lts README file.
Or in this repository, but do no use docker-compose.yml but a docker-composer-lts.yml to avoid conflicts.

@tylerssn Same for Lando, it's possible to create OpenMage/Lando repository, or merge Docker/Lando/Valet/ in an OpenMage/local-env repository.

@rvelhote
Copy link
Contributor

rvelhote commented Apr 11, 2019

I already use Docker in development and production (via Elastic Beanstalk Dockerrun.aws.json) so I think it's a pretty good idea to have a Docker environment ready to go.

It would be even a cooler idea to have two flavours: one production ready and one development ready (with Xdebug, Blackfire/MagentoProfiler + many useful Magento/PHP development settings by default).

It would be better to have a separate repository with a docker-compose.yml + composer.json that imports the magento-lts package rather than imposing it in the main repository.

@colinmollenhour
Copy link
Member Author

One problem with importing the project with composer.json is that it will not be a fully functional git repo so if you were developing a patch you'd then have to monkey around to get your stuff committed and pushed. For production this is fine, but for development not so good, that's why having the docker-compose.yml file in the repo would be nice, so that the user can easily work on whatever fork/branch they want without fighting against tooling like composer.

@rvelhote
Copy link
Contributor

I see your point @colinmollenhour and I agree. I didn't think about that specific issue of making contributions just from a module development perpective.

@gety9
Copy link

gety9 commented Jun 9, 2019

We've being using meanbee/docker-magento set-up, and it works great.
It has composer, xdebug, magerun, etc preinstalled.

https://github.com/meanbee/docker-magento

@Flyingmana
Copy link
Contributor

I added a setup to have OpenMage installed with the sample data inside docker.
https://github.com/OpenMage/Docker-Setups

Its not so shiny like most other projects, but its a beginning and targeted for people, who want to have a first look at the project and may not know what the minimum requirements are.

@tylers-username
Copy link

@Flyingmana - I see that you have created a docker-setups config. I'd like to revisit the idea of OpenMage officially demoing a host/dev setup. I believe this is important because if you can give new and existing developers a configuration that Just Works™️ then the opportunity to grow the project is that much greater.

I don't have a dog in the fight other than supporting OpenMage - I have no affiliation with Lando. That said, I think it's worth considering including a .lando.dist.yml as well as a Platform.sh configuration.

Lando recently partnered with Platform.sh and released a platformsh recipe. This recipe takes your host configuration from your Platform.sh services.yaml, routes.yaml and .platform.app.yaml to configure your local dev environment. If implemented in the OpenMage repository, at the time that you clone the repo you have a working production and development environment - no further changes would be required. You can always add overrides and additional tooling (such as the N98 Magerun client) as needed to the Lando config file.

I understand that this is venturing into very opinionated territory but you have to consider the value (especially to those new to Magento) this adds spoon-feeding the developer a fully functional stack.

To undo this OpenMage could document the remove of the YAML files or let the user know they can be ignored altogether if they have their own preferred docker/host stack.

@tylers-username
Copy link

@Flyingmana
Copy link
Contributor

@tylerssn would you be able to provide this config?
And is it possible to place these files into the /dev/ directory? maybe as /dev/lando/

@tylers-username
Copy link

Once the platform.sh recipe is stable, I'd be happy to provide it.

The files would have to be in the root directory. They could be in a subdirectory with a ReadMe and/or an optional bash script to copy them into place.

colinmollenhour added a commit that referenced this issue Aug 20, 2020
* Add development environment setup files and README. Refs #644

* Added mention of ddev.

* Fix for first-time user.

* Fix file permissions for first time install.

* Reduce installation steps to one.
@colinmollenhour
Copy link
Member Author

Added a basic Docker-Compose environment that can be setup in just one step: https://github.com/OpenMage/magento-lts/blob/1.9.4.x/dev/openmage/README.md

For some users this will be sufficient, others may want something more robust like lando, so more options are certainly still welcome so I'll leave this open.

@kkrieger85
Copy link
Contributor

Fixed in #1012

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