Skip to content

Commit

Permalink
feat(configuration): allow swapping between 2.3 and 2.4 more easily.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The default COMPOSE_FILE path has changed and the new root docker-compose.yml is empty. To fix your environment, see the updated env.sample. Likely, all you will have to do is append "./compose/base/2.3.yml" to your existing COMPOSE_FILE. If you run into problems, please report a Github issue.
  • Loading branch information
Nolan-Arnold authored Sep 27, 2021
1 parent 0ae11fb commit 3c5ada3
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 77 deletions.
15 changes: 5 additions & 10 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ COMPOSE_PROJECT_NAME=YOUR_PROJECT_NAME
##########################################################################
# Docker Compose File
# See https://docs.docker.com/compose/reference/envvars/#compose_file
# * Note that you can safely switch 2.3 with another release line of Magento2. e.g. 2.4
###########
# Mac
# COMPOSE_FILE=docker-compose.yml:compose/sync/docker-compose.partialsync.yml
# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.partialsync.yml

# Windows (WSL) and Linux
# COMPOSE_FILE=docker-compose.yml:compose/sync/docker-compose.fullsync.yml
# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.fullsync.yml



##########################################################################
# Preset Compose Configurations
#
# These are some prefab environment configurations to enable specific behaviors.
#######
# Magento v2.4
#######
# COMPOSE_FILE={PRIOR_CONFIGURATIONS}:compose/php/7.3/7.3.yaml:compose/elasticsearch/7.6.yaml
58 changes: 58 additions & 0 deletions compose/base/2.3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version : '3'

services:
ingress:
extends:
file: ./compose/base/base.yml
service: ingress
image: graycore/magento-nginx:1.18-alpine-develop
depends_on:
- magento2
magento2:
extends:
file: ./compose/base/base.yml
service: magento2
image: graycore/magento-php:7.3-fpm-alpine-develop
environment:
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_HOSTNAME=elasticsearch
- CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch6
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_PORT=9200
database:
extends:
file: ./compose/base/base.yml
service: database
image: mysql:5.7
cache:
extends:
file: ./compose/base/base.yml
service: cache
image: redis:5.0
message_queue:
extends:
file: ./compose/base/base.yml
service: message_queue
image: rabbitmq:3.5
fullpagecache:
extends:
file: ./compose/base/base.yml
service: fullpagecache
image: redis:5.0
sessioncache:
extends:
file: ./compose/base/base.yml
service: sessioncache
image: redis:5.0
elasticsearch:
extends:
file: ./compose/elasticsearch/6.8.yml
service: elasticsearch
networks:
- backend
volumes:
- es_data:/usr/share/elasticsearch/data
networks:
frontend:
backend:
volumes:
db_data:
es_data:
58 changes: 58 additions & 0 deletions compose/base/2.4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version : '3'

services:
ingress:
extends:
file: ./compose/base/base.yml
service: ingress
image: graycore/magento-nginx:1.18-alpine-develop
depends_on:
- magento2
magento2:
extends:
file: ./compose/base/base.yml
service: magento2
image: graycore/magento-php:7.4-fpm-alpine-develop
environment:
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_HOSTNAME=elasticsearch
- CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch7
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_PORT=9200
database:
extends:
file: ./compose/base/base.yml
service: database
image: mysql:5.7
cache:
extends:
file: ./compose/base/base.yml
service: cache
image: redis:5.0
message_queue:
extends:
file: ./compose/base/base.yml
service: message_queue
image: rabbitmq:3.5
fullpagecache:
extends:
file: ./compose/base/base.yml
service: fullpagecache
image: redis:5.0
sessioncache:
extends:
file: ./compose/base/base.yml
service: sessioncache
image: redis:5.0
elasticsearch:
extends:
file: ./compose/elasticsearch/7.6.yaml
service: elasticsearch
networks:
- backend
volumes:
- es_data:/usr/share/elasticsearch/data
networks:
frontend:
backend:
volumes:
db_data:
es_data:
50 changes: 50 additions & 0 deletions compose/base/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version : '3'

services:
ingress:
ports:
- "80:8000"
- "443:8443"
networks:
- frontend
environment:
- MAGENTO2_UPSTREAM=magento2
- MAGENTO2_UPSTREAM_PORT=9000
- NGINX_PORT=8000
- NGINX_TLS_PORT=8443
magento2:
restart: always
networks:
- frontend
- backend
env_file:
- ../../.env
database:
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: magento2
MYSQL_DATABASE: magento2
MYSQL_USER: magento2
MYSQL_PASSWORD: magento2
networks:
- backend
cache:
networks:
- backend
message_queue:
networks:
- backend
fullpagecache:
networks:
- backend
sessioncache:
networks:
- backend
networks:
frontend:
backend:
volumes:
db_data:

15 changes: 15 additions & 0 deletions compose/elasticsearch/6.8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version : '3'

services:
magento2:
environment:
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_HOSTNAME=elasticsearch
- CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch6
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_PORT=9200
elasticsearch:
image: elasticsearch:6.8.9
environment:
- discovery.type=single-node
ports:
- "9200:9200"
- "9300:9300"
3 changes: 3 additions & 0 deletions compose/elasticsearch/7.6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ services:
image: elasticsearch:7.6.2
environment:
- discovery.type=single-node
ports:
- "9200:9200"
- "9300:9300"
68 changes: 1 addition & 67 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,3 @@
version : '3'

services:
ingress:
image: graycore/magento-nginx:1.18-alpine-develop
ports:
- "80:8000"
- "443:8443"
networks:
- frontend
depends_on:
- magento2
environment:
- MAGENTO2_UPSTREAM=magento2
- MAGENTO2_UPSTREAM_PORT=9000
- NGINX_PORT=8000
- NGINX_TLS_PORT=8443
magento2:
image: graycore/magento-php:7.2-fpm-alpine-develop
restart: always
networks:
- frontend
- backend
env_file:
- ./.env
database:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
- ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: magento2
MYSQL_DATABASE: magento2
MYSQL_USER: magento2
MYSQL_PASSWORD: magento2
networks:
- backend
cache:
image: redis:5.0
networks:
- backend
message_queue:
image: rabbitmq:3.5
networks:
- backend
fullpagecache:
image: redis:5.0
networks:
- backend
sessioncache:
image: redis:5.0
networks:
- backend
elasticsearch:
image: elasticsearch:6.8.9
ports:
- "9200:9200"
- "9300:9300"
networks:
- backend
volumes:
- es_data:/usr/share/elasticsearch/data
networks:
frontend:
backend:
volumes:
db_data:
es_data:
services: {}

0 comments on commit 3c5ada3

Please sign in to comment.