Git Product home page Git Product logo

lando-magento2-template's Introduction

Note Most PHP apps hosted on Platform.sh can be cloned by Lando with a single lando init command. If starting with a new project, I highly suggest creating a Magento website from the Platform.sh Marketplace and then checking out the Lando/Platform.sh docs.

Important notes

  1. This setup expects Lando to be installed and ready to go on your machine
  2. This setup expects Magento's stock nginx.conf.sample to exist in Magento's project root.
    • NOTE: If you follow the Quick Setup instructions this file will be automatically downloaded
  3. You may experience performance gains by:
    • Adding Redis, Elasticsearch, etc.. These services can easily be added following Lando's documentation.
    • For Windows & MacOS, Lando has an experimental feature that disables file synchronization between the host and container that can be implemented as shown below. However, you will need to copy these files manually to your host if using an IDE that depends on the directories you exclude.
      # Add to .lando.yml as a root property
      # Must be implemented prior to `lando start`. Otherwise, modification requires `lando rebuild`
      excludes: # **Warning:** Experimental Lando Feature
         - vendor # Optionally disable syncing of this directory
         - '!vendor/my-company/my-dev-module' # Restore syncing to a subdirectory of an excluded directory
         - node_modules
         - '!node_modules/my-company/my-dev-module'
         # Improve performance of Magento-writable directories
         - pub/media
         - pub/static
  4. Last, the lando magento:setup:quick command accepts the --use-sample-data option. Keep in mind there are known issues with this in Magento 2.3

Getting Started with Magento 2 & Lando

Quick Setup

# Clone and access this repository
git clone https://github.com/improper/lando-magento2-template.git
cd lando-magento2-template
# Review Magento Download Options
cd lando-magento2-template
lando --help magento:download
# Download Magento. Drop arguments for interactive mode.
cd lando-magento2-template
lando magento:download --mage-edition "Open Source" \
    --mage-version 2.3.5 \
    --mage-access-key-private $MAGE_PRIVATE_KEY \
    --mage-access-key-public $MAGE_PUBLIC_KEY \
    --github-token $MY_GITHUB_TOKEN \
    --notify-magento false \
    --notify-github false
# Your auth.json has automatically been generated
cd lando-magento2-template
cat auth.json
# Deploy Mangento with configured database
cd lando-magento2-template
lando start
lando composer install
lando magento:setup:quick --use-sample-data

That's it! Your store is ready for development: https://magento2.lndo.site/

# Confirm store is accessible via bash
curl -I -k --fail -s https://magento2.lndo.site/home | grep 200 && echo "Good to go."

You should now be able to access your local installation of Magento: https://magento2.lndo.site/ (or whatever proxy value you have set in your lando.base.yaml file)

If you have followed the quick setup without providing any other parameters be aware your Magento database will have no base_url or base_url_secure values yet. This can and in most cases will cause a redirect loop when acessing the Magento admin page.

All lndo.site sub-domains https://magento2.lndo.site/ are real URL's, therefor won't be available offline.

Alternatively localhost.xxxx URL's are available offline but change with every Lando rebuild. See lando info for your URIs that point to this sandbox. And, always, you can modify the URI with:

lando magento setup:store-config:set --base-url=$PROVIDE_URL --base-url-secure=$PROVIDE_URL

Customizing Lando

This repository ships with a .lando.base.yaml which provides your Magento services as well as a .lando.yml which provides additions and overrides to the .lando.base.yml.

You may be happy merging .lando.base.yaml into .lando.yml. To help you make that decision, checkout the Landofile documentaion for best practices.

Bonus Info

We have some bonus tooling included. Review it with lando.

# Review additional Magento tooling
cd lando-magento2-template
lando --help magento:setup:destroy
lando --help magento:setup:quick

lando magento:setup:quick is an alias for lando magento setup:install and is pre-configured to set up the Lando DB connection.

Where is my admin?

If you did not pass specify arguments for lando magento:setup:quick, you will probably want to know your admin URI and to create an admin user.

  • Fetch Admin URI: lando magento info:adminuri
  • Create admin user: lando magento admin:user:create

Cleanup

# Jump into repo directory
cd lando-magento2-template
# Destroy  everything
lando destroy -y
cd .. && rm -r lando-magento2-template

lando-magento2-template's People

Contributors

aziwaan avatar azmeehan avatar dependabot[bot] avatar thanosalexandris avatar tylers-username avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lando-magento2-template's Issues

Provide option to define preferred composer version

Is your feature request related to a problem? Please describe.
Composer 2 is faster. Later versions of Magento support Composer 2. Earlier versions do not.

Describe the solution you'd like
??? Who knows.

Describe alternatives you've considered
lando rebuild will cause Lando to revert to the composer_version value in the LEMP config property. Perhaps composer require in the Magento project has a feature to help us with this?

Replace built-in Magento downloader with improper/mage2me

Is your feature request related to a problem? Please describe.
Yes, the Lando template shouldn't have to know how to fetch Magento, only run it.

Describe the solution you'd like
Install mage2me and allow that service to be responsible for understanding Magento 2 download requirements

Describe alternatives you've considered
Have you seen this repo? Gross.

Additional context

https://github.com/improper/mage2me

From my comment in the thread:

  • GitHub token authentication & validation prior to download
  • Magento public/private key authentication & validation prior to download
  • Magento Edition and Version Validation with clear error messages
    • You can specify Commerce (enterprise) or Open Source edition
    • When the version is specified (2.2, 2.3.x, 2.4-develop) mage2me will validate that the version exists for the Magento edition that you requested prior to launching composer create-project.
  • Nice, clear error messages each step of the way
  • Nicely compiled executable allowing it to be standalone and installed globally
  • Should be fully compatible with Windows, OSX and Linux
  • Improved directory validation

Sample data command not installing sample data

Sample data is not installed when following the quicksetup instructions and providing
--use-sample-data option.

To Reproduce
lando magento quick:setup --use-sample-data

Expected Result
Sample data is installed

Actual result
Command runs without error but there are no sample data packages installed. Seems to just run the install command again.

This works
lando magento sampledata:deploy
lando magento setup:upgrade

Set the Magento URL using localhost values on each lando build

Not setting the Magento base URL's as part of the install and setup leads to unexpected results because there are no values for the url_base and url_base_secure values.

It would be nice if the magento URL was set using the localhost build URL after each lando rebuild. Other option would be to use the lndo.site subdomain but that is not available offline as far as Im aware.

As lando is a dev tool it would make sense that your local install of magento is available offline, so the localhost URLs make sense to use.

Admin uri redirects to bad URL

Versions:

  • OS: MacOS
  • Lando v3.0.0-rc.22
  • Docker Version 19.03.4

Describe the bug
I added this config to an existing project and I don't seem to be able to get to my admin page. When I try my local site with admin uri it redirects to the same site but with index.php added and the uri. See pattern below

http://magent.lndo.site/admin_uri -> http://magent.lndo.siteindex.php/admin_uri

It's missing the / at the end of the sire url.

To Reproduce
Steps to reproduce the behavior:

  1. Go to admin uri on site

Expected behavior
Expect to see admin login page

Additional context
I'm using Magento 2.3.3

lando magento:download fails

At step 2 of the quick setup, it fails with this error:

OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: \"/app/dev/lando/tooling/magento.download.sh\": stat /app/dev/lando/tooling/magento.download.sh: no such file or directory": unknown

If I'm interpreting it correctly, the tooling is going to try to execute that command in the container, which doesn't exist at this point. That path isn't valid on the host OS.

That may be a misinterpretation on my part of how tooling works, though. It looks like changing line 55 to
cmd: ./dev/lando/tooling/magento.download.sh

is working

New Pull Requests

Hey Man,

Been using this a little bit lately, finding it pretty useful so thanks for putting it together!

Are you taking pull requests I have a couple of suggestions that might save some headaches for new users.

Not able to proceed with lando magento:setup:quick

Versions:

  • Ubuntu 18.04]
  • Lando (fetch with: lando version: v3.0.0-rc.20):
  • Docker Version (fetch with: docker version: 17.06.1-ce):

Describe the bug
I installed the docker CE and lando, everything works till the "lando magento:setup:quick", it is throwing following error :

user@N626:/var/www/html/lando-magento2-template$ lando magento
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: "/app/bin/magento": stat /app/bin/magento: no such file or directory": unknown
user@N626:/var/www/html/lando-magento2-template$ lando magento:setup:quick
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: "/app/bin/magento": stat /app/bin/magento: no such file or directory": unknown
user@N626:/var/www/html/lando-magento2-template$

Now not able to proceed with https://magento2.lndo.site , it is throwing

404 Not Found
nginx/1.14.2

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
The command was for quick magento set up, which should quickly set up the magento for the given URL, so that I can visit the default magento version and could explore more

Screenshots
PFA

Can anybody tell me what and where things are going wrong.

Replace Magento download logic with composer create-project

Is your feature request related to a problem? Please describe.

For speed benefits, the lando magento:download command downloads Magento's latest release Zip. The problem is that it includes the Magento modules in app/code/Magento rather than a production-ready version that requires Magento features as composer packages.

Describe the solution you'd like

Replace the complicated latest release zip download logic with composer create-project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.