|
@@ -14,41 +14,34 @@ This file is provided as an example development environment using Mage Inferno M
|
|
|
|
|
|
```
|
|
```
|
|
# Mage Inferno Docker Compose (https://github.com/mageinferno/magento2-docker-compose)
|
|
# Mage Inferno Docker Compose (https://github.com/mageinferno/magento2-docker-compose)
|
|
-# Version 3.0.0
|
|
|
|
|
|
+# Version 4.0.0
|
|
|
|
|
|
app:
|
|
app:
|
|
- image: mageinferno/magento2-nginx:1.9.9-2
|
|
|
|
- ports:
|
|
|
|
- - "80:80"
|
|
|
|
|
|
+ image: mageinferno/magento2-nginx:1.9.14-0
|
|
links:
|
|
links:
|
|
- - php-fpm
|
|
|
|
|
|
+ - phpfpm
|
|
- db
|
|
- db
|
|
volumes_from:
|
|
volumes_from:
|
|
- appdata
|
|
- appdata
|
|
- environment:
|
|
|
|
- - APP_MAGE_MODE=default
|
|
|
|
- - VIRTUAL_HOST=mysite.com
|
|
|
|
|
|
+ ports:
|
|
|
|
+ - 80:80
|
|
|
|
|
|
appdata:
|
|
appdata:
|
|
image: tianon/true
|
|
image: tianon/true
|
|
volumes:
|
|
volumes:
|
|
- - /src
|
|
|
|
- - ~/.composer:/root/.composer
|
|
|
|
|
|
+ - /srv/www
|
|
|
|
+ - ~/.composer:/var/www/.composer
|
|
|
|
+# - ./www/app/code:/srv/www/app/code
|
|
|
|
|
|
-"php-fpm":
|
|
|
|
- image: mageinferno/magento2-php:7.0.2-fpm-1
|
|
|
|
|
|
+phpfpm:
|
|
|
|
+ image: mageinferno/magento2-php:7.0.5-fpm-0
|
|
links:
|
|
links:
|
|
- db
|
|
- db
|
|
volumes_from:
|
|
volumes_from:
|
|
- appdata
|
|
- appdata
|
|
- environment:
|
|
|
|
- - APP_MAGE_MODE=default
|
|
|
|
- - PHP_MEMORY_LIMIT=2048M
|
|
|
|
|
|
|
|
db:
|
|
db:
|
|
- image: mariadb:10.1.10
|
|
|
|
- ports:
|
|
|
|
- - "3306:3306"
|
|
|
|
|
|
+ image: mariadb:10.1.13
|
|
volumes_from:
|
|
volumes_from:
|
|
- dbdata
|
|
- dbdata
|
|
environment:
|
|
environment:
|
|
@@ -63,7 +56,7 @@ dbdata:
|
|
- /var/lib/mysql
|
|
- /var/lib/mysql
|
|
|
|
|
|
setup:
|
|
setup:
|
|
- image: mageinferno/magento2-php:7.0.2-fpm-1
|
|
|
|
|
|
+ image: mageinferno/magento2-php:7.0.5-fpm-0
|
|
command: /usr/local/bin/mage-setup
|
|
command: /usr/local/bin/mage-setup
|
|
links:
|
|
links:
|
|
- db
|
|
- db
|
|
@@ -74,23 +67,22 @@ setup:
|
|
- M2SETUP_DB_NAME=magento2
|
|
- M2SETUP_DB_NAME=magento2
|
|
- M2SETUP_DB_USER=magento2
|
|
- M2SETUP_DB_USER=magento2
|
|
- M2SETUP_DB_PASSWORD=magento2
|
|
- M2SETUP_DB_PASSWORD=magento2
|
|
- - M2SETUP_BASE_URL=http://mysite.com/
|
|
|
|
|
|
+ - M2SETUP_BASE_URL=http://docker.local/
|
|
- M2SETUP_ADMIN_FIRSTNAME=Admin
|
|
- M2SETUP_ADMIN_FIRSTNAME=Admin
|
|
- M2SETUP_ADMIN_LASTNAME=User
|
|
- M2SETUP_ADMIN_LASTNAME=User
|
|
- M2SETUP_ADMIN_EMAIL=dummy@gmail.com
|
|
- M2SETUP_ADMIN_EMAIL=dummy@gmail.com
|
|
- M2SETUP_ADMIN_USER=magento2
|
|
- M2SETUP_ADMIN_USER=magento2
|
|
- M2SETUP_ADMIN_PASSWORD=magento2
|
|
- M2SETUP_ADMIN_PASSWORD=magento2
|
|
- - M2SETUP_VERSION=2.0.0
|
|
|
|
- - M2SETUP_USE_SAMPLE_DATA=true
|
|
|
|
|
|
+ - M2SETUP_VERSION=2.0.4
|
|
|
|
+ - M2SETUP_USE_SAMPLE_DATA=false
|
|
|
|
+ - M2SETUP_USE_ARCHIVE=true
|
|
```
|
|
```
|
|
|
|
|
|
## Composer Setup
|
|
## Composer Setup
|
|
|
|
|
|
-This setup attaches the `~/.composer` directory from the host machine. For fully automated setup, please first setup a GitHub Personal Access Token for Composer (before running setup) by visiting <a href="https://github.com/settings/tokens/new?scopes=repo&description=Composer" target="_blank">https://github.com/settings/tokens/new?scopes=repo&description=Composer</a>.
|
|
|
|
|
|
+Uncomment the composer line from `appdata` to mount a `.composer` directory to the `www-data` user home directory. Please first setup Magento Marketplace authentication (details at <a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html" target="_blank">http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html</a>).
|
|
|
|
|
|
-You'll also need to retrieve your Magento development keys. Please see <a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html" target="_blank">http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html</a> for more details.
|
|
|
|
-
|
|
|
|
-After both sets of keys are retrieved, place your auth token on your host machine at `~/.composer/auth.json` with the following contents, like so:
|
|
|
|
|
|
+Place your auth token at `~/.composer/auth.json` with the following contents, like so:
|
|
|
|
|
|
```
|
|
```
|
|
{
|
|
{
|
|
@@ -99,99 +91,33 @@ After both sets of keys are retrieved, place your auth token on your host machin
|
|
"username": "MAGENTO_PUBLIC_KEY",
|
|
"username": "MAGENTO_PUBLIC_KEY",
|
|
"password": "MAGENTO_PRIVATE_KEY"
|
|
"password": "MAGENTO_PRIVATE_KEY"
|
|
}
|
|
}
|
|
- },
|
|
|
|
- "github-oauth": {
|
|
|
|
- "github.com": "GITHUB_ACCESS_TOKEN"
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
## Composer-less, No-Auth Setup
|
|
## Composer-less, No-Auth Setup
|
|
|
|
|
|
-If you don't want to use Composer or setup the auth keys above, no worries. Magento provides a complete Magento 2 archive at <a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/zip_install.html" target="_blank">http://devdocs.magento.com/guides/v2.0/install-gde/prereq/zip_install.html</a>. We decided to use this method for a very quick installation.
|
|
|
|
-
|
|
|
|
-Just set the `M2SETUP_USE_ARCHIVE` environment variable to `true` when running setup.
|
|
|
|
|
|
+If you don't want to use Composer or setup the auth keys above, no worries. Mage Inferno install script uses Nexcess' hosted Magento archives for a Composer-less install process. Just set the `M2SETUP_USE_ARCHIVE` environment variable to `true` when running setup.
|
|
|
|
|
|
## Running Setup
|
|
## Running Setup
|
|
|
|
|
|
-Before running Magento 2, you must download the source code, install composer dependencies, and execute the Magento installer script. Luckily, Mage Inferno makes this easy for you.
|
|
|
|
|
|
+Using the above `docker-compose.yml` file, all you need to do is run one line to install Magento 2:
|
|
|
|
|
|
-The following environment variables can be set for setup:
|
|
|
|
```
|
|
```
|
|
-- M2SETUP_DB_HOST=db
|
|
|
|
-- M2SETUP_DB_NAME=magento2
|
|
|
|
-- M2SETUP_DB_USER=magento2
|
|
|
|
-- M2SETUP_DB_PASSWORD=magento2
|
|
|
|
-- M2SETUP_BASE_URL=http://mysite.docker/
|
|
|
|
-- M2SETUP_ADMIN_FIRSTNAME=Admin
|
|
|
|
-- M2SETUP_ADMIN_LASTNAME=User
|
|
|
|
-- M2SETUP_ADMIN_EMAIL=dummy@gmail.com
|
|
|
|
-- M2SETUP_ADMIN_USER=magento2
|
|
|
|
-- M2SETUP_ADMIN_PASSWORD=magento2
|
|
|
|
-- M2SETUP_VERSION=2.0.0
|
|
|
|
-- M2SETUP_USE_SAMPLE_DATA=true
|
|
|
|
-- M2SETUP_USE_ARCHIVE=true
|
|
|
|
|
|
+docker-compose run --rm setup
|
|
```
|
|
```
|
|
|
|
|
|
-Our setup script uses these variables to determine how to setup your store. Everything is pretty self-explanatory. The `M2SETUP_USE_ARCHIVE` installs from archive, otherwise Composer is used for installation. `M2SETUP_VERSION` is required.
|
|
|
|
-
|
|
|
|
-To run setup, execute the following command from your project directory (`~/Sites/mysite`), which creates a one-off throw away container that sets up Magento 2 for you.
|
|
|
|
-`docker-compose run --rm setup`
|
|
|
|
|
|
+You may modify any environment variables depending on your requirements.
|
|
|
|
|
|
## Data Volumes
|
|
## Data Volumes
|
|
|
|
|
|
-This install will mount a `src` directory as a docker volume. Note that the persistancy comes from your host machine, so you may terminate running nginx/php containers and start them back up, and your data will remain. The `appdata` definition in the docker-compose.yml file is mainly there so we only have to define the relation in one place in the file, instead of it being defined multiple times.
|
|
|
|
-
|
|
|
|
-For MySQL, the `mysqldata` container runs from the `tianon/true` volume. This makes a persistent Docker volume, however be aware that removing this container will remove all of your MySQL data (aka your database). Even though it appears as exited/stopped when running `docker ps -a`, be sure not to remove this container, as your MySQL data will truly go away if you remove it.
|
|
|
|
-
|
|
|
|
-## Environment Variables
|
|
|
|
-
|
|
|
|
-You may pass in environment variables which will override the web server configurations at runtime. All variables are optional as appropriate defaults are set.
|
|
|
|
-
|
|
|
|
-Please see the appropriate images for available values:
|
|
|
|
-
|
|
|
|
-- <a href="https://github.com/mageinferno/docker-magento2-php#variables" target="_blank">mageinferno/php-fpm</a>
|
|
|
|
-- <a href="https://github.com/mageinferno/docker-magento2-nginx#variables" target="_blank">mageinferno/nginx</a>
|
|
|
|
-
|
|
|
|
-## OS X / Dinghy
|
|
|
|
-
|
|
|
|
-To use this image on other systems for local development, create a Dockerfile with anything specific to your local development platform.
|
|
|
|
-
|
|
|
|
-For example, if using [Dinghy](https://github.com/codekitchen/dinghy) on OS X, use:
|
|
|
|
|
|
+Your Magento source data is persistently stored within Docker data volumes. For local development, we advise copying the entire contents of the `appdata` data volume to your local machine (after setup is complete of course). Since you shouldn't be modifying any of these files, this is just to bring the fully copy of the site back to your host:
|
|
|
|
|
|
```
|
|
```
|
|
-FROM mageinferno/magento2-php:[TAG]
|
|
|
|
-RUN usermod -u 501 www-data
|
|
|
|
|
|
+docker cp CONTAINERID:/srv/www ./
|
|
```
|
|
```
|
|
|
|
|
|
-Then build your custom image:
|
|
|
|
-
|
|
|
|
-```
|
|
|
|
-docker build -t myname/php .
|
|
|
|
-```
|
|
|
|
-
|
|
|
|
-Remember to add your `VIRTUAL_HOST` environment variable to the web server container in your docker-compose.yml file, and remove `ports` as those are automatically exposed in Dinghy.
|
|
|
|
-
|
|
|
|
-### Host Volumes
|
|
|
|
-
|
|
|
|
-Previously, we mounted this entire src directory from the host to the volume, but this made things pretty slow. Instead, we are now recommending mounting /src as a standard Docker volume (not connected to the host). Install Magento 2, then issue a command like the following on your host machine:
|
|
|
|
-
|
|
|
|
-```
|
|
|
|
-docker cp CONTAINERID:/src ./
|
|
|
|
-```
|
|
|
|
-
|
|
|
|
-This will copy the contents of the entire /src directory to your host machine. Since you shouldn't be modifying any of these files, this is just to bring the fully copy of the site back to your host.
|
|
|
|
-
|
|
|
|
-Then, just mount your host `app/code` directory in your `appdata` container definition, and re-start your containers:
|
|
|
|
-
|
|
|
|
-```
|
|
|
|
-appdata:
|
|
|
|
- image: tianon/true
|
|
|
|
- volumes:
|
|
|
|
- - /src
|
|
|
|
- - ./src/app/code:/src/app/code
|
|
|
|
- - ~/.composer:/root/.composer
|
|
|
|
-```
|
|
|
|
|
|
+Then, just uncomment the `/www/app/code:/srv/www/app/code` within your docker-compose.yml file (appdata > volumes) to mount your local `app/code` directory to the Docker data volume, then just restart your containers:
|
|
|
|
|
|
```
|
|
```
|
|
docker-compose up -d app
|
|
docker-compose up -d app
|