Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ The `magento.test` above defines the hostname to use, `community` is the Magento

After the one-liner above completes running, you should be able to access your site at `https://magento.test`.

#### Install sample data
#### Install sample data and development modules

After the above installation is complete, run the following lines to install sample data:
After the above installation is complete, you can initialize the development environment with sample data and dev-related modules with:

```bash
bin/magento sampledata:deploy
bin/magento setup:upgrade
bin/init
```

### Manual Setup
Expand Down Expand Up @@ -197,6 +196,9 @@ bin/download community 2.4.8-p3
# Run the setup installer for Magento:
bin/setup magento.test

# Initialize development environment with sample data and dev-related modules:
bin/init

open https://magento.test
```

Expand Down Expand Up @@ -302,6 +304,7 @@ It is recommended to keep your root docker config files in one repository, and y
- `bin/fixowns`: This will fix filesystem ownerships within the container.
- `bin/fixperms`: This will fix filesystem permissions within the container.
- `bin/grunt`: Run the grunt binary. Ex. `bin/grunt exec`
- `bin/init`: Initialize development environment with sample data and dev-related modules.
- `bin/install-php-extensions`: Install PHP extension in the container. Ex. `bin/install-php-extensions sourceguardian`
- `bin/log`: Monitor the Magento log files. Pass no params to tail all files. Ex. `bin/log debug.log`
- `bin/magento`: Run the Magento CLI. Ex: `bin/magento cache:flush`
Expand Down
1 change: 1 addition & 0 deletions compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ help:
@echo "$(call format,fixowns,'This will fix filesystem ownerships within the container.')"
@echo "$(call format,fixperms,'This will fix filesystem permissions within the container.')"
@echo "$(call format,grunt,'Run the grunt binary.')"
@echo "$(call format,init,'Initialize development environment with sample data and dev-related modules.')"
@echo "$(call format,install-php-extensions,'Install PHP extension in the container.')"
@echo "$(call format,log,'Monitor the Magento log files. Pass no params to tail all files.')"
@echo "$(call format,magento,'Run the Magento CLI.')"
Expand Down
30 changes: 30 additions & 0 deletions compose/bin/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Script to initialize a Magento development environment

# Exit immediately if a command fails
set -e

echo ">>> Deploying Magento sample data..."
bin/magento sampledata:deploy

echo ">>> Disabling Two-Factor Authentication (for dev only)..."
bin/composer require --dev markshust/magento2-module-disabletwofactorauth
bin/magento module:enable MarkShust_DisableTwoFactorAuth

echo ">>> Running setup upgrade (applies sample data + new modules)..."
bin/magento setup:upgrade

echo ">>> Setting long admin session lifetime (1 year)..."
bin/magento config:set twofactorauth/general/enable 0
bin/magento config:set admin/security/session_lifetime 31536000

echo ">>> Generating URN catalog for IDEs..."
bin/dev-urn-catalog-generate

echo ">>> Running final optimizations (compile, reindex, cache flush)..."
bin/magento setup:di:compile
bin/magento indexer:reindex
bin/magento cache:flush

echo ">>> Magento development environment initialized successfully! 🎉"