├── Dockerfile ├── README.md ├── build.sh ├── config ├── 20-mcrypt.ini ├── apache_default_vhost ├── composer.json └── my.cnf ├── media ├── MJ01-YE_back_cropped.jpg ├── MJ01-YE_main_cropped.jpg ├── MJ02-OR_main_cropped.jpg ├── MJ03-GN_main_cropped.jpg ├── MJ04-RD_main_cropped.jpg ├── MJ07-BL_main_cropped.jpg ├── MJ08-RB_main_cropped.jpg ├── MJ09-YE_main_cropped.jpg └── MJ12-OR_main_cropped.jpg ├── run.sh └── scripts ├── install-magento2 └── runserver /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:trusty 2 | MAINTAINER Alan Kent 3 | 4 | # Get Apache, mysql client, PHP etc (subset of a full LAMP stack - no MySQL server) 5 | RUN apt-get update && apt-get install -y apache2 mysql-client php5 php5-curl php5-mcrypt php5-gd php5-mysql php5-intl curl git 6 | 7 | # mcrypt.ini appears to be missing from apt-get install. Needed for PHP mcrypt library to be enabled. 8 | ADD config/20-mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini 9 | ADD config/20-mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini 10 | 11 | # Environment variables from /etc/apache2/apache2.conf 12 | ENV APACHE_RUN_USER www-data 13 | ENV APACHE_RUN_GROUP www-data 14 | ENV APACHE_RUN_DIR /var/run/apache2 15 | ENV APACHE_LOG_DIR /var/log/apache2 16 | ENV APACHE_LOCK_DIR /var/lock/apache2 17 | ENV APACHE_PID_FILE /var/run/apache2/apache2.pid 18 | 19 | # Enable Apache rewrite module 20 | RUN a2enmod rewrite 21 | 22 | # Add the Apache virtual host file 23 | ADD config/apache_default_vhost /etc/apache2/sites-enabled/magento2.conf 24 | RUN rm -f /etc/apache2/sites-enabled/000-default.conf 25 | 26 | # Add the MySQL client configuration file (no server settings) 27 | ADD config/my.cnf /etc/mysql/my.cnf 28 | 29 | # Install Magento 2 30 | RUN mkdir /var/www/magento2 31 | ADD config/composer.json /var/www/magento2/composer.json 32 | ADD scripts/install-magento2 /var/www/install-magento2 33 | RUN bash -x /var/www/install-magento2 34 | 35 | # Expose the web server port 36 | EXPOSE 80 37 | 38 | # Start up the Apache server 39 | ADD scripts/runserver /usr/local/bin/runserver 40 | RUN chmod +x /usr/local/bin/runserver 41 | ENTRYPOINT ["bash", "-c"] 42 | CMD ["/usr/local/bin/runserver"] 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Magento 2 (alpha) Demo 2 | 3 | [Magento](http://magento.com/) is an open source ecommerce engine, 4 | developed by eBay Inc powering 240,000+ online ecommerce sites. 5 | Magento 2 is the next major platform release of Magento. 6 | The Magento 2 code base is pushed weekly to GitHub during development. 7 | 8 | ## Containers 9 | 10 | Only two containers are currently involved - a standard MySQL database 11 | container ('mysql') and the Magento 2 container. The Dockerfile contains 12 | instructions to build Magento 2 using Composer (PHP packaging system). It 13 | also loads a SQL dump of a database with a few sample records so you 14 | can perform queries out of the box. Trying querying for 'jacket'. 15 | 16 | To run the default 'mysql' container, please name the container 'mysql' 17 | and expose port 3306 for the Magento 2 container to use. For the purpose 18 | of this demo, set the 'root' account password to 'admin'. 19 | 20 | docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=admin \ 21 | mysql:5.6 22 | 23 | Do check that it started up (the -d makes it run as a daemon in 24 | background) use 25 | 26 | docker logs mysql 27 | 28 | An interestiong experiment for the reader is to replace the 'mysql' 29 | container with a Maria DB instance. 30 | 31 | The Magento 2 container requires a linkage to the MySQL container and 32 | several additional environment variables. 33 | 34 | docker run --rm --name magento2 -p 80:80 --link mysql:mysql \ 35 | -e MYSQL_USER=root -e MYSQL_PASSWORD=admin \ 36 | -e PUBLIC_HOST=yourhost.example.com \ 37 | alankent/docker-magento2-demo-apache:0.42.0-beta6 38 | 39 | When this container is started, it loops waiting for a succesful 40 | connection to the MySQL database. Once achieved it runs a PHP script 41 | to create the database. A MySQL dump is then loaded to put a few 42 | products into the database. These two steps can take up to 30 seconds. 43 | Finally Apache is run. After it is running site can be connected to 44 | using a web browser. 45 | 46 | ## Using Magento 2 47 | 48 | Magento 2 is still under active development. A developer beta is due 49 | for release late 2014 with GA in 2015. The steps for installing 50 | Magento 2 are not finalized and are subject to change before final 51 | release. That is in part why this demonstration was put together. 52 | To make it easier for someone to get Magento 2 running. 53 | 54 | To access the store front, use http://yourhost.example.com (the host 55 | name supplied as PUBLIC_HOST above). To access the admin interface, 56 | use http://yourhost.example.com/index.php/backend with a username 57 | of 'admin' and password of 'admin123'. (Obviously this is not 58 | intended for production usage!) 59 | 60 | Be aware if you start a new container instance, it will wipe the 61 | database and start again. 62 | 63 | This script currently does not load up any products - it is more to 64 | demonstrate the installation steps. Sample data is "coming soon". 65 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t docker-magento2-demo-apache . 4 | 5 | echo To publish use: 6 | echo docker tag docker-magento2-demo-apache alankent/docker-magento2-demo-apache 7 | echo docker tag docker-magento2-demo-apache alankent/docker-magento2-demo-apache:0.42.0-beta6 8 | echo docker push alankent/docker-magento2-demo-apache:0.42.0-beta6 9 | -------------------------------------------------------------------------------- /config/20-mcrypt.ini: -------------------------------------------------------------------------------- 1 | ; configuration for php mcrypt module 2 | ; priority=20 3 | extension=mcrypt.so 4 | -------------------------------------------------------------------------------- /config/apache_default_vhost: -------------------------------------------------------------------------------- 1 | 2 | 3 | DocumentRoot /var/www/magento2/htdocs 4 | 5 | 6 | Options Indexes FollowSymLinks 7 | AllowOverride All 8 | Order allow,deny 9 | allow from all 10 | 11 | 12 | ErrorLog ${APACHE_LOG_DIR}/error.log 13 | LogLevel warn 14 | CustomLog ${APACHE_LOG_DIR}/access.log combined 15 | 16 | 17 | -------------------------------------------------------------------------------- /config/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alankent/store", 3 | "require": { 4 | "magento/product-community-edition": "0.42.0-beta6" 5 | }, 6 | "repositories": [ 7 | { 8 | "type": "composer", 9 | "url": "http://packages.magento.com/" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "Magento\\Setup\\": "htdocs/setup/module/Magento/Setup/src/" 15 | } 16 | }, 17 | "extra": { 18 | "magento-root-dir": "htdocs", 19 | "magento-deploystrategy": "copy" 20 | }, 21 | "minimum-stability": "dev" 22 | } 23 | -------------------------------------------------------------------------------- /config/my.cnf: -------------------------------------------------------------------------------- 1 | # MySQL Client configuration (only) 2 | 3 | [client] 4 | port = 3306 5 | host = mysql 6 | -------------------------------------------------------------------------------- /media/MJ01-YE_back_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ01-YE_back_cropped.jpg -------------------------------------------------------------------------------- /media/MJ01-YE_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ01-YE_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ02-OR_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ02-OR_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ03-GN_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ03-GN_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ04-RD_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ04-RD_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ07-BL_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ07-BL_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ08-RB_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ08-RB_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ09-YE_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ09-YE_main_cropped.jpg -------------------------------------------------------------------------------- /media/MJ12-OR_main_cropped.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alankent/docker-magento2-demo-apache/eef219911544e2dc3b30ee5df4cf642399acb149/media/MJ12-OR_main_cropped.jpg -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | docker run --rm --name magento2 -i -t -p 80:80 --link mysql:mysql -e MYSQL_USER=root -e MYSQL_PASSWORD=admin -e PUBLIC_HOST=akent1-8619.lvs01.dev.ebayc3.com docker-magento2-demo-apache $* 2 | -------------------------------------------------------------------------------- /scripts/install-magento2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # See also http://alankent.wordpress.com/2014/08/02/magento-2-progress-towards-installation-via-composer/ 4 | 5 | cd /var/www/magento2 6 | 7 | rm -rf htdocs 8 | mkdir -p htdocs 9 | 10 | curl -sS https://getcomposer.org/installer | php 11 | php composer.phar install 12 | 13 | # Swap to developer mode for better error diagnostics 14 | echo "SetEnv MAGE_MODE production" >> .htaccess 15 | #echo "SetEnv MAGE_MODE developer" >> .htaccess 16 | 17 | chown www-data:www-data -R /var/www/magento2 18 | -------------------------------------------------------------------------------- /scripts/runserver: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Show what we execute 4 | set -x 5 | 6 | # MySQL authentication 7 | MYSQLAUTH="--user=$MYSQL_USER --password=$MYSQL_PASSWORD" 8 | 9 | # Wait for MySQL to come up. 10 | until mysql $MYSQLAUTH -e ""; do 11 | echo "Failed to connect to MySQL - retrying..." 12 | sleep 1 13 | done 14 | 15 | mysql $MYSQLAUTH -e "CREATE DATABASE IF NOT EXISTS magento" 16 | 17 | cd /var/www/magento2/htdocs 18 | php -f setup/index.php install \ 19 | --cleanup_database \ 20 | --db_host=mysql \ 21 | --db_name=magento \ 22 | --db_user="$MYSQL_USER" \ 23 | --db_pass="$MYSQL_PASSWORD" \ 24 | --backend_frontname=admin \ 25 | --base_url=http://$PUBLIC_HOST/ \ 26 | --language=en_US \ 27 | --timezone=America/Los_Angeles \ 28 | --currency=USD \ 29 | --admin_lastname=Smith \ 30 | --admin_firstname=John \ 31 | --admin_email=john.smith@example.com \ 32 | --admin_username=admin \ 33 | --admin_password=admin123 \ 34 | --use_secure=0 35 | 36 | # In production mode we pre-compute various files 37 | php -f dev/tools/Magento/Tools/View/deploy.php 38 | php -f dev/tools/Magento/Tools/Di/compiler.php 39 | 40 | # Run the web server 41 | exec /usr/sbin/apache2 -D FOREGROUND 42 | --------------------------------------------------------------------------------