Skip to content

Development environment for Magento 2 with Docker

License

Notifications You must be signed in to change notification settings

bid-d/magento2-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

bid-d/magento2-init

Supported Magento Versions Maintained - Yes

Table of contents

Docker Network

network image

Usage

This configuration is used for setting up a full magento 2 local development.

Folders:

  • developer/bin: Shell file for initializing project
  • developer/images: Configuration files for container
  • developer/env: env variable for setting project
  • developer/lib: Contains init shell file which used to automate setting up project

Prerequisites

  • Operating systems (Linux x86-64): such as RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, and similar
  • Memory requirement: At least 2GB Ram
  • Hard Drive: SSD is preferred over HDD
  • Docker and Docker-compose installed (For Ubuntu)
  • Composer pre-installed is not required

Setup

You can either use automated setup with default env values or manual setup where you can define your own env variable

Automated Setup

Run this command line from the directory you want to install the project

curl -s https://raw.githubusercontent.com/bid-d/magento2-init/master/developer/lib/init | bash -s

This command above will install magento 2 project at your current directory with base url at https://magento2.local and version 2.4.1 with default values:

MYSQL_HOST=mysql
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=magentodb
MYSQL_USER=bidd
MYSQL_PASSWORD=bidd

VERSION=2.4.1
BASE_URL=magento2.local
ADMIN_BACKEND=admin
ADMIN_USER=admin
ADMIN_PASSWORD=admin123
ADMIN_FIRSTNAME=bidd
ADMIN_LASTNAME=bidd
ADMIN_EMAIL=bidd@admin.org

You can change the base url with -d flag and the version with -v flag:

curl -s https://raw.githubusercontent.com/bid-d/magento2-init/master/developer/lib/init | bash -s -- -d yourbaseurl -v version

Manual Setup

# Get the repository
foo@ubuntu:~$ git clone https://github.com/bid-d/magento2-init.git

# CD to repository
foo@ubuntu:~$ cd magento2-init

# Use nano or vim to edit env variables (I use vim in my case)
foo@ubuntu:~/magento2-init$ vim developer/env/magento.env

# Edit and save, then edit MYSQL_ROOT_PASSWORD if you want to change this default value too
foo@ubuntu:~/magento2-init$ vim developer/env/.env

# Copy manual setup shell script to current directory
foo@ubuntu:~/magento2-init$ cp developer/lib/manual .

# Execute the script
foo@ubuntu:~/magento2-init$ ./manual

# All done for manual installation, congrats!

Credits

Bidd Nguyen

My name is Bidd Nguyen and I'm the author of this repo. I've been PHP Web Developer (Laravel/Magento) and DevOps for more than three years. You can contact me directly at biddqb@gmail.com

License

MIT