If you find my work valuable, please consider sponsoring |
devenv it's a powerful development environment based on NixOS.
It allows you to have containerized environments without containers or hypervisor or emulation, with native performance on any platform.
This is by far the fasted Magento/Openmage development environment I've ever worked with and it's more than worth of the time to learn it.
This repo has a basic (and yet complete) OpenMage project installed via composer and all of the necessary software stack:
- PHP 8.2 (managed by PHP-FPM and served by Caddy)
- MySQL 8.0
- Redis 7.0
- OpenSearch 2.6
- Xdebug 3.2
- MailHog for email testing
- n98-magerun2
This branch is only compatible with Magento 2.4.6 because of the need for OpenSearch2 support (since ElasticSearch7 is broken in NixOS).
- If you don't have devenv/NixOS installed please follow devenv's installation guide, it's actually pretty easy and straightforward.
- Then clone this repository to have all the configuration files on your machine
- Start all services with
devenv up
- Open another terminal
- Enter the development environment shell with
devenv shell
- Create the magento project in the magento2 folder with composer
composer create-project --repository-url=https://mirror.mage-os.org/ magento/project-community-edition:2.4.6 magento2
(I'd prefer MageOS but at the moment 2.4.6 is not available on their repos) cd magento2
composer install
- Install sample data if you want
bin/magento setup:install --base-url='http://magento2.test' --db-host='127.0.0.1' --db-user='magento2' --db-password='magento2' --db-name='magento2' --admin-firstname='admin' --admin-lastname='admin' --admin-email='[email protected]' --admin-user='admin' --admin-password='admin123' --language='en_US' --currency='EUR' --timezone='Europe/Rome' --use-rewrites='1' --backend-frontname='admin' --session-save-redis-host='127.0.0.1' --session-save-redis-port='6379' --session-save-redis-db='0' --cache-backend-redis-server='127.0.0.1' --cache-backend-redis-port='6379' --cache-backend-redis-db='1' --page-cache-redis-server='127.0.0.1' --page-cache-redis-port='6379' --page-cache-redis-db='2' --elasticsearch-host='127.0.0.1' --elasticsearch-port='9200'
- Enter the project folder
- run
devenv up
to start all the software stack - run
devenv shell
to enter a shell with all softwares configured properly (like n98-magerun2)
At the moment the project is configured with http://magento2.test
as the main domain name (you can change it in the devenv.nix
file), so you'll have to add magento2.test
to your hosts
file first, then you'll be able to open the browser to http://magento2.test
.