- Notifications
You must be signed in to change notification settings - Fork9
License
OSL-3.0, AFL-3.0 licenses found
Licenses found
magento/magento2-kubernetes-devbox
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- What You get
- How to install
- Day-to-day development scenarios
- Reinstall Magento
- Clear Magento cache
- Switch between CE and EE
- Sample data installation
- Basic data generation
- Use Magento CLI (bin/magento)
- Debugging with XDebug
- Connecting to MySQL DB
- View emails sent by Magento
- Accessing PHP and other config files
- Upgrading Magento
- Multiple Magento instances
- Update Composer dependencies
- Running Magento tests
- Environment configuration
- FAQ
It's expected that the Magento 2 project source code will be located and managed on the host to allow quick indexing of project files by IDE. All other infrastructure is deployed on the guest machine.
Current DevBox aims to support multi-service deployment in one click. It is optimized for development scenarios using local environment.
The environment for Magento EE development is also configured.
Theproject initialization script configures a complete development environment:
- Configures all software necessary for Magento 2: Nginx, PHP 7.x, MySQL 5.6, Git, Composer, XDebug
- Installs Magento 2 from Git repositories or Composer packages (can be configured via
checkout_source_fromoption inetc/config.yaml)
If you never used Kubernetes before, read theKubernetes Docs first.
The software listed below should be available inPATH (except for PHP Storm).
- Minikube
- Helm
- VirtualBox
- Git - Ensure that SSH keys are generated and associated with your Github account. Seehow to check andhow to configure, if not configured.
ℹ️ To obtain the codebase without cloning, just use the Magento 2 codebase instead ofvagrant-magento/magento2ce. Either method will produce a successful installation.
- PHP Storm, optional but recommended. To get Helm support in PhpStorm make sure to get v2018.3+
- NFS server

must be installed and running on *nix and OSX hosts; usually available, followinstallation steps first
ℹ️ In case of any issues during installation, please readFAQ section
Open terminal and change your directory to the one you want to contain Magento project.
Download or clone the project with DevBox configuration:
⚠️ Do not open it in PhpStorm untilinit_project.shhas completed PhpStorm configuration in the initialize project step below.git clone git@github.com:magento/magento2-kubernetes-devbox.git magento2-devboxOptionally, if you use private repositories on GitHub or download packages from the Magento Marketplace using Composer.
- Copyetc/composer/auth.json.dist to
etc/composer/auth.json. - Specify your GitHub token by adding
"github.com": "your-github-token"to thegithub-oauthsection for GitHub authorization. - Add the Magento Marketplace keys for Marketplace authorization to the
repo.magento.comsection. - Copy (optional)etc/config.yaml.dist as
etc/config.yamland make the necessary customizations.
- Copyetc/composer/auth.json.dist to
Initialize the project (this will configure the environment, install Magento):
cd magento2-devbox# NFS configuration is needed just once for each project, it will prompt for your password to make changes on the hostbash scripts/host/configure_nfs_exports.shhelm plugin install .helm init-magentoTo initialize project with checkout container,clone sources to checkout directory and use -e parameter to init_project.sh call.
helm init-magento -eIf you have issues with nfs. To use filesystem mount instead of nfs use -d parameter to init_project.sh call.
helm init-magento -dUse the
magento2-devboxdirectory as the project root in PHP Storm (notmagento2-devbox/magento). This is important, because in this case PHP Storm will be configured automatically byinit_project.sh.Configure the remote PHP interpreter in PHP Storm. Go to Preferences, then Languages and Frameworks. Click PHP and add a new remote interpreter. Select Deployment configuration as a source for connection details.
Some of default settings are available for override. These settings can be found in the fileetc/config.yaml.dist.
To override settings create a copy of the file under the name 'config.yaml' and add your custom settings.
Upon a successful installation, you'll see the location and URL of the newly-installed Magento 2 application in console.
Web access:
- Access storefront at
http://<ip-from-config-yaml> - Access admin panel at
http://<ip-from-config-yaml>/admin/ - Magento admin user/password:
admin/123123q - Rabbit MQ control panel: run
bash k-open-rabbitmq, credentialsadmin/123123q
ℹ️ Your admin URL, storefront URL, and admin user and password are located inetc/config.yaml.
Codebase and DB access:
- Path to your Magento installation in the container:
- Can be retrieved from environment variable:
echo ${MAGENTO_ROOT}
- Can be retrieved from environment variable:
- MySQL DB host:
- inside the container:
localhost - remotely:
<ip-from-config-yaml>
- inside the container:
- MySQL DB name:
magento,magento_integration_tests - MySQL DB user/password:
root:123123q
Codebase on host
- CE codebase:
magento2-devbox/magento - EE codebase will be available if path to EE repository is specified in
etc/config.yaml:magento2-devbox/magento/magento2ee
Current vagrant project followssemantic versioning so feel free to pull the latest features and fixes, they will not break your project.For example your current branch is2.0, then it will be safe to pull any changes fromorigin/2.0. However branch3.0 will contain changes backward incompatible with2.0.Note, that semantic versioning is only used forx.0 branches (not fordevelop ormaster).
ℹ️ To apply changes runbash k-rebuild-environment.
Use commands described inSwitch between CE and EE section with-f flag. Before doing actual re-installation, these commands update linking of EE codebase, clear cache, update composer dependencies.
If no composer update and relinking of EE codebase is necessary, use the following command. It will clear Magento DB, Magento caches and reinstall Magento instance.
Go to the root of the project in command line and execute:
bash m-reinstallGo to the root of the project in command line and execute:
bash m-clear-cacheAssume, that EE codebase is available inmagento2-devbox/magento/magento2ee.The following commands will link/unlink EE codebase, clear cache, update composer dependencies and reinstall Magento.Go to 'magento2-devbox' created earlier and run in command line:
bash m-switch-to-ceORbash m-switch-to-eeForce switch can be done using-f flag even if already switched to the target edition. May be helpful to relink EE modules after switching between branches.
Upgrade can be performed instead of re-installation using-u flag.
Make sure thatce_sample_data andee_sample_data are defined inconfig.yaml and point CE and optionally EE sample data repositories.During initial project setup or duringbash init_project.sh -fc (with-fc project will be re-created from scratch), sample data repositories willl be checked out tomagento2-devbox/magento/magento2ce-sample-data andmagento2-devbox/magento/magento2ee-sample-data.
To install Magento with sample data setinstall_sample_data inconfig.yaml to1 and runbash m-switch-to-ce -f orbash m-switch-to-ee -f, depending on the edition to be installed. To disable sample data, set this option to0 and force-switch to necessary edition (using the same commands).
Several entities are generated for testing purposes by default using REST API after Magento installation:
- Customer with address (credentials
customer@example.com:123123qQ) - Category
- Couple simple products
- Configurable product
To disable this feature, setmagento/generate_basic_data inconfig.yaml to0 and runbash m-switch-to-ce -f orbash m-switch-to-ee -f, depending on the edition to be installed.
Go to 'magento2-devbox' created earlier and run in command line:
bash m-bin-magento <command_name>e.g.bash m-bin-magento listXDebug is already configured to connect to the host machine automatically. So just:
- Set XDEBUG_SESSION=1 cookie (e.g. using 'easy Xdebug' extension for Firefox). SeeXDebug documentation for more details
- Start listening for PHP Debug connections in PhpStorm on default 9000 port. See how tointegrate XDebug with PhpStorm
- Set beakpoint or set option in PhpStorm menu 'Run -> Break at first line in PHP scripts'
Go to 'magento2-devbox' created earlier and run in command line:
bash k-ssh-mysql
After successful login to the container run the following command and enter123123q when prompted for a password:
mysql -uroot -p
Not available yet.
The following configuration files are used by default:
- NGINX
- PHP-FPM:ini,conf
- xDebug
- Dockerfile for monolith base image
- Actually applied Dockerfile for monolith with customizations
- Actually applied Dockerfile for monolith with xDebug and customizations
- Kubernetes config for Monolith
- Kubernetes Helm variables
- Configs for Checkout service
Sometimes it is necessary to test upgrade flow. This can be easily done as follows (assuming that you have installed instance):
- For git-based installation - check out codebase corresponding to the target Magento version. Or modify your
composer.jsonin case of composer-based installation - Use commands described inSwitch between CE and EE section with
-uflag
Edit etc/config.yaml.Change ce branch and add checkout repository and branch.FollowInstallation steps, when running init-magento use -e argument
helm init-magento -e
Go to 'magento2-devbox' created earlier and run in command line:
bash m-composer installORbash m-composer updateNot available yet.
Not available yet.
Not available yet.
Not available yet.
Redis is configured as cache backend by default.
It is possible to reset project environment to default state, which you usually get just after project initialization. The following command will re-initialize Kubernetes cluster. Magento 2 code base (magento directory) andetc/config.yaml and PhpStorm settings will stay untouched.
Go to 'magento2-devbox' created earlier and run in command line:
bash init_project.sh -fIt is possible to reset Magento 2 code base at the same time. Magento 2 code base will be deleted and then cloned from the repositories specified inetc/config.yaml
bash init_project.sh -fcTo reset PhpStorm project configuration, in addition to-f specify-p option:
bash init_project.sh -fpUltimate project reset can be achieved by combining all available flags:
bash init_project.sh -fcpNodeJS not available yet.
About
Resources
License
OSL-3.0, AFL-3.0 licenses found
Licenses found
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.

