A complete GitHub Codespaces development setup for Mage-OS (Magento Open Source) with Hyvä theme integration. This configuration provides a fully-featured, pre-configured development environment that launches in minutes.
- PHP: 8.3-FPM
- Web Server: Nginx
- Database: MariaDB 10.6
- Search: OpenSearch 2.19.2
- Cache: Redis
- Mail Testing: Mailpit
- Node.js: 18.x
- Database Management: phpMyAdmin
- Magento Version: MageOs 2.0 | Magento 2.4.7-p5
- Theme: Hyvä
- Flexible Platform Installation: Choose between Mage-OS or Magento via
USE_MAGEOSflag - Sample Data Installation: Optional sample data installation via
INSTALL_SAMPLE_DATAflag - Pre-configured services (Nginx, MariaDB, Redis, OpenSearch)
- Hyvä theme build automation
- Docker-in-Docker support for additional containers (Mailpit, OpenSearch, phpMyAdmin)
- n98-magerun2 CLI tool pre-installed
- AI CLI tools (Gemini CLI, Claude Code) pre-installed
- Magento Claude Agents collection auto-installed
- Persistent installation detection (skips reinstall on restart)
- Xdebug pre-installed for debugging
-
GitHub account with Codespaces access
-
Required secrets configured in your repository:
HYVA_LICENCE_KEY: Hyvä license key (token for authentication)HYVA_PROJECT_NAME: Hyvä project name for Packagist repository access
-
Optional secrets (only needed if
USE_MAGEOS=NO):MAGENTO_COMPOSER_AUTH_USER: Adobe Commerce Marketplace usernameMAGENTO_COMPOSER_AUTH_PASS: Adobe Commerce Marketplace password
-
Create a new Codespace from this repository
-
Automated Setup Process:
The setup runs in two phases:
Phase 1 - Container Creation (
setup.shviaonCreateCommandruns during Pre-build if enabled):- Installs AI CLI tools (Gemini CLI, Claude Code)
- Starts Docker containers (Mailpit, OpenSearch, phpMyAdmin)
Phase 2 - Application Setup (
start.shviapostAttachCommand):- Configures and starts Supervisor services (Nginx, MariaDB, Redis, PHP-FPM)
- Installs Node.js using
npackage manager - Creates project using
composer create-project:- If
USE_MAGEOS=YES: Installs Mage-OS from https://repo.mage-os.org/ - If
USE_MAGEOS=NO: Installs Magento from https://repo.magento.com/
- If
- Installs sample data (if
INSTALL_SAMPLE_DATA=YES) - Installs fresh instance or uses existing database
- Installs Awesome Claude Agents from GitHub
- Builds the Hyvä theme (if license key provided)
- Creates
.devcontainer/db-installed.flagto skip reinstall on subsequent starts
-
Access your store:
- Frontend:
https://[your-codespace-name]-8080.app.github.dev/ - Admin Panel:
https://[your-codespace-name]-8080.app.github.dev/admin
- Frontend:
- Username:
admin - Password:
password1 - Email:
[email protected]
- Root Password:
password - Database Name:
magento2
| Service | Port | Description |
|---|---|---|
| Nginx | 8080 | Magento web interface |
| MariaDB | 3306 | Database server |
| phpMyAdmin | 8081 | Database management UI |
| Redis | 6379 | Cache and session storage |
| OpenSearch | 9200 | Search engine API |
| OpenSearch Node | 9600 | OpenSearch node communication |
| Mailpit SMTP | 1025 | Mail SMTP server |
| Mailpit Web | 8025 | Mail testing UI |
# Build Hyvä theme
n98-magerun2 dev:theme:build-hyva
# Build specific theme
n98-magerun2 dev:theme:build-hyva frontend/Hyva/default# List all commands
n98-magerun2 list
# Check system info
n98-magerun2 sys:info
# Check module status
n98-magerun2 module:list# Check all service status (custom script)
.devcontainer/scripts/status.sh
# Check Supervisor services
sudo supervisorctl status
# Restart a service
sudo supervisorctl restart nginx
sudo supervisorctl restart php-fpm
# Reload Supervisor configuration (after config changes)
sudo supervisorctl reread
sudo supervisorctl update
# Check Docker containers
docker ps
# View container logs
docker logs mailpit
docker logs opensearch-node
docker logs phpmyadmin# MySQL CLI access
mysql -u root -ppassword magento2
# Or use n98-magerun2
n98-magerun2 db:console
#PHP MyAdmin Port 8081
https://{{Codespaces-URL}}-8081.app.github.dev/Key configuration files are located in .devcontainer/:
Config Directory (.devcontainer/config/):
nginx.conf- Nginx web server configurationsp-php-fpm.conf- PHP-FPM supervisor configurationmysql.cnf- MariaDB server configurationmysql.conf- MariaDB supervisor configurationclient.cnf- MySQL client configurationsp-redis.conf- Redis supervisor configurationsp-nginx.conf- Nginx supervisor configurationsp-opensearch.conf- OpenSearch supervisor configuration (if used)env.php- Pre-configured Magento environment file (for existing installations)
Scripts Directory (.devcontainer/scripts/):
setup.sh- Initial setup (runs during container creation)start.sh- Application startup (runs on container attach)start_services.sh- Modular service management (sourced by start.sh)status.sh- Service status checker
Check supervisor status:
sudo supervisorctl statusRestart all services:
sudo supervisorctl restart allRe-run start script
.devcontainer/scripts/start.shVerify MariaDB is running:
sudo mysqladmin pingCheck MySQL logs:
sudo tail -f /var/log/mysql/error.logCheck OpenSearch status:
curl http://localhost:9200/_cluster/health?prettyView OpenSearch logs:
docker logs opensearch-nodebin/magento cache:flush
bin/magento cache:clean
rm -rf var/cache/* var/page_cache/* generated/*To trigger a fresh installation, delete the flag file:
rm .devcontainer/db-installed.flagThen restart the Codespace. The start.sh script will detect the missing flag and run the full installation process again, including:
- Fresh Magento installation (if
INSTALL_MAGENTO=YES) - Database recreation
- Composer dependencies installation
- Hyvä theme configuration
- All setup steps from scratch
Note: The flag file is created at the end of start.sh (line 141) to prevent reinstallation on subsequent container restarts.
- Make code changes in your IDE
- Clear Magento cache if needed:
bin/magento cache:flush - Rebuild Hyvä theme if template changes:
n98-magerun2 dev:theme:build-hyva - Test changes in your browser
- Commit and push to your repository
- The first startup may take 10-15 minutes as it installs Magento and all dependencies (Enable Pre-builds to cut new installs to 5mins)
- Subsequent instance starts are much faster (2-3 minutes) as the
.devcontainer/db-installed.flagprevents reinstallation - The environment uses Redis for sessions, cache, and full page cache
- OpenSearch runs in a Docker container with security disabled for development ease
- Xdebug is installed but not enabled by default
- Awesome Claude Agents are automatically cloned and installed to
~/.claude/agents - X-frame-options are patched to allow Magento's quick view functionality
- Services are managed through Supervisor with automatic restart policies
- Docker containers (Mailpit, OpenSearch, phpMyAdmin) have
--restart unless-stoppedpolicies
By default, this environment installs Mage-OS (set via USE_MAGEOS=YES). To install Magento instead:
-
Edit
.devcontainer/devcontainer.json:"USE_MAGEOS": "NO"
-
Ensure you have configured the required Magento Composer credentials:
MAGENTO_COMPOSER_AUTH_USERMAGENTO_COMPOSER_AUTH_PASS
Key Differences:
- Mage-OS: Community-driven fork, no Adobe Marketplace access by default
- Magento: Official Adobe version, requires Marketplace credentials, access to Marketplace extensions
Note: If using Mage-OS and you need Marketplace extensions, you'll need to configure repo.magento.com separately with appropriate credentials.
Edit .devcontainer/devcontainer.json and modify:
"MAGENTO_VERSION": "2.4.7-p5"To skip fresh installation and use an existing database:
- Set
INSTALL_MAGENTO: "NO"in.devcontainer/devcontainer.json - Place your pre-configured
env.phpin.devcontainer/config/env.php - The
start.shscript will copy this file toapp/etc/env.phpand update the base URL
Edit your composer.json or use:
composer config repositories.custom-repo vcs https://github.com/your/repoSample data provides products, categories, and content for testing and development. To control sample data installation:
-
Edit
.devcontainer/devcontainer.json:"INSTALL_SAMPLE_DATA": "YES"
-
Or set to
"NO"to skip sample data installation for a clean, minimal installation.
What gets installed:
- Sample products (bundle, configurable, downloadable, grouped)
- Sample categories and catalog structure
- Sample CMS pages and blocks
- Sample customers and reviews
- Sample sales data and tax rules
Note: Sample data installation adds approximately 5-10 minutes to the initial setup time and requires additional disk space (~500MB).
All environment variables can be customized in .devcontainer/devcontainer.json under containerEnv:
Key Environment Variables:
USE_MAGEOS- Set to "YES" for Mage-OS, "NO" for Magento (default: "YES")INSTALL_MAGENTO- Set to "YES" for fresh install, "NO" to use existing database (default: "YES")INSTALL_SAMPLE_DATA- Set to "YES" to install sample data, "NO" to skip (default: "YES")MAGENTO_VERSION- Magento version to install whenUSE_MAGEOS=NO(default: "2.4.7-p5")MAGENTO_ADMIN_USERNAME- Admin username (default: "admin")MAGENTO_ADMIN_PASSWORD- Admin password (default: "password1")MAGENTO_ADMIN_EMAIL- Admin email (default: "[email protected]")MYSQL_ROOT_PASSWORD- MySQL root password (default: "password")HYVA_LICENCE_KEY- Your Hyvä license token (required for Hyvä installation)HYVA_PROJECT_NAME- Your Hyvä project name for Packagist access (required for Hyvä installation)
This development environment configuration is provided as-is. Individual components (Magento, Hyvä, etc.) have their own licenses.
For issues with:
- Magento: Refer to Mage-OS Documentation
- Hyvä Theme: Refer to Hyvä Documentation
- This Setup: Open an issue in this repository