-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): add initial docker architecture for Magento 2 local env…
…ironment
- Loading branch information
0 parents
commit c006a37
Showing
15 changed files
with
397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Mage2Docker | ||
|
||
## Prerequisites | ||
* Docker | ||
* Composer | ||
* An existing Magento 2 project | ||
|
||
## Getting Started | ||
This project assumes you have already created a Magento 2 project with composer. | ||
|
||
You can read the docs on the Magento website on [how to create a new Magento 2 project](https://devdocs.magento.com/guides/v2.3/install-gde/composer.html). We strongly recommend using composer. | ||
|
||
From your project's root directory (the directory above the Magento `app`) | ||
|
||
```bash | ||
git clone https://www.github.com/graycoreio/mage2docker && cd mage2docker | ||
docker-compose -p {your_project_name} -f docker-compose.yml -f docker-compose.dev.yml up | ||
``` | ||
|
||
## Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BLACKFIRE_CLIENT_ID=SOME_ID | ||
BLACKFIRE_CLIENT_TOKEN=SOME_TOKEN | ||
BLACKFIRE_SERVER_ID=YOUR_ID | ||
BLACKFIRE_SERVER_TOKEN=YOUR_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version : '3' | ||
|
||
services: | ||
magento2: | ||
volumes: &appvolumes | ||
- appdata:/var/www/html | ||
- ../app:/var/www/html/app:cached | ||
- ../bin:/var/www/html/bin:cached | ||
- ../lib:/var/www/html/lib:cached | ||
- ../pub:/var/www/html/pub:delegated | ||
- ../setup:/var/www/html/setup:cached | ||
- ../update:/var/www/html/update:cached | ||
- ../index.php:/var/www/html/index.php:cached | ||
- ../nginx.conf.sample:/var/www/html/nginx.conf:cached | ||
- ../composer.json:/var/www/html/composer.json:delegated | ||
- ../composer.lock:/var/www/html/composer.lock:delegated | ||
ingress: | ||
volumes: *appvolumes | ||
volumes: | ||
appdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version : '3' | ||
|
||
services: | ||
ingress: | ||
build: ./nginx/1.17/alpine | ||
ports: | ||
- "80:8000" | ||
- "443:8443" | ||
networks: | ||
- frontend | ||
magento2: | ||
build: ./php/7.2/alpine-develop | ||
restart: always | ||
networks: | ||
- frontend | ||
- backend | ||
database: | ||
image: mysql:5.7 | ||
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: | ||
image: redis:5.0 | ||
networks: | ||
- backend | ||
fullpagecache: | ||
image: redis:5.0 | ||
networks: | ||
- backend | ||
sessioncache: | ||
image: redis:5.0 | ||
networks: | ||
- backend | ||
elasticsearch: | ||
image: elasticsearch:5.6 | ||
ports: | ||
- "9200:9200" | ||
- "9300:9300" | ||
networks: | ||
- backend | ||
blackfire: | ||
image: blackfire/blackfire | ||
env_file: | ||
- blackfire/.env | ||
networks: | ||
- backend | ||
networks: | ||
frontend: | ||
backend: | ||
volumes: | ||
db_data: |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?php | ||
return [ | ||
'backend' => [ | ||
'frontName' => 'admin' | ||
], | ||
'crypt' => [ | ||
'key' => 'REPLACEME' | ||
], | ||
'db' => [ | ||
'table_prefix' => '', | ||
'connection' => [ | ||
'default' => [ | ||
'host' => 'database', | ||
'dbname' => 'magento2', | ||
'username' => 'magento2', | ||
'password' => 'magento2', | ||
'active' => '1', | ||
'model' => 'mysql4', | ||
'engine' => 'innodb', | ||
'initStatements' => 'SET NAMES utf8;' | ||
] | ||
] | ||
], | ||
'resource' => [ | ||
'default_setup' => [ | ||
'connection' => 'default' | ||
] | ||
], | ||
'x-frame-options' => 'SAMEORIGIN', | ||
'MAGE_MODE' => 'developer', | ||
'session' => [ | ||
'save' => 'redis', | ||
'redis' => [ | ||
'host' => 'sessioncache', | ||
'port' => '6379', | ||
'password' => '', | ||
'timeout' => '2.5', | ||
'persistent_identifier' => '', | ||
'database' => '0', | ||
'compression_threshold' => '2048', | ||
'compression_library' => 'gzip', | ||
'log_level' => '4', | ||
'max_concurrency' => '6', | ||
'break_after_frontend' => '5', | ||
'break_after_adminhtml' => '30', | ||
'first_lifetime' => '600', | ||
'bot_first_lifetime' => '60', | ||
'bot_lifetime' => '7200', | ||
'disable_locking' => '0', | ||
'min_lifetime' => '60', | ||
'max_lifetime' => '2592000', | ||
'sentinel_master' => '', | ||
'sentinel_servers' => '', | ||
'sentinel_connect_retries' => '5', | ||
'sentinel_verify_master' => '0' | ||
] | ||
], | ||
'cache' => [ | ||
'frontend' => [ | ||
'default' => [ | ||
'id_prefix' => '40d_', | ||
'backend' => 'Cm_Cache_Backend_Redis', | ||
'backend_options' => [ | ||
'server' => 'cache', | ||
'database' => '0', | ||
'port' => '6379', | ||
'password' => '', | ||
'compress_data' => '1', | ||
'compression_lib' => '' | ||
] | ||
], | ||
'page_cache' => [ | ||
'id_prefix' => '40d_', | ||
'backend' => 'Cm_Cache_Backend_Redis', | ||
'backend_options' => [ | ||
'server' => 'fullpagecache', | ||
'database' => '0', | ||
'port' => '6379', | ||
'password' => '', | ||
'compress_data' => '0', | ||
'compression_lib' => '' | ||
] | ||
] | ||
] | ||
], | ||
'lock' => [ | ||
'provider' => 'db', | ||
'config' => [ | ||
'prefix' => '' | ||
] | ||
], | ||
'cache_types' => [ | ||
'config' => 1, | ||
'layout' => 1, | ||
'block_html' => 1, | ||
'collections' => 1, | ||
'reflection' => 1, | ||
'db_ddl' => 1, | ||
'compiled_config' => 1, | ||
'eav' => 1, | ||
'customer_notification' => 1, | ||
'config_integration' => 1, | ||
'config_integration_api' => 1, | ||
'full_page' => 1, | ||
'config_webservice' => 1, | ||
'translate' => 1, | ||
'vertex' => 1 | ||
], | ||
'install' => [ | ||
'date' => 'Mon, 01 Jul 2019 18:06:52 +0000' | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM nginx:1.17-alpine | ||
|
||
MAINTAINER Damien Retzinger <damien@graycore.io> | ||
|
||
RUN apk update && apk add openssl | ||
RUN mkdir /etc/nginx/certs \ | ||
&& echo -e "\n\n\n\n\n\n\n" | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certs/nginx.key -out /etc/nginx/certs/nginx.crt | ||
|
||
COPY ./conf/nginx.conf /etc/nginx/ | ||
COPY ./conf/default.conf /etc/nginx/conf.d/ | ||
|
||
EXPOSE 8443 | ||
|
||
WORKDIR /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
upstream fastcgi_backend { | ||
server magento2:9000; | ||
} | ||
|
||
server { | ||
listen 8000; | ||
return 301 https://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 8443 ssl; | ||
|
||
ssl_certificate /etc/nginx/certs/nginx.crt; | ||
ssl_certificate_key /etc/nginx/certs/nginx.key; | ||
|
||
set $MAGE_ROOT /var/www/html; | ||
|
||
include /var/www/html/nginx[.]conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
worker_processes 2; | ||
|
||
error_log /var/log/nginx/error.log debug; | ||
|
||
events { | ||
|
||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main | ||
'$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
|
||
keepalive_timeout 60; | ||
|
||
gzip on; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## This ngninx configuration should serve as an example for a production configuration of nginx. | ||
## Do note that this configuration only serves non-encrypted connections. This is intentional; | ||
## traffic within the DMZ should not need to be encrypted unless absolutely required. | ||
|
||
server { | ||
listen 8000; | ||
|
||
set $MAGE_ROOT /var/www/html; | ||
|
||
include /var/www/html/nginx[.]conf; | ||
} | ||
|
||
# upstream fastcgi_backend { | ||
# server magento2:9001; | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM php:7.2-fpm-alpine | ||
|
||
MAINTAINER Damien Retzinger <damien@graycore.io> | ||
|
||
RUN apk update && apk add \ | ||
gzip \ | ||
freetype-dev \ | ||
icu-dev \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libxslt-dev \ | ||
lsof \ | ||
curl-dev \ | ||
libsodium-dev \ | ||
mysql-client \ | ||
vim \ | ||
zip | ||
|
||
RUN docker-php-ext-configure \ | ||
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ | ||
|
||
# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions | ||
RUN docker-php-ext-install \ | ||
bcmath \ | ||
gd \ | ||
hash \ | ||
intl \ | ||
opcache \ | ||
pdo_mysql \ | ||
simplexml \ | ||
soap \ | ||
xsl \ | ||
zip | ||
|
||
RUN curl -sS https://getcomposer.org/installer | \ | ||
php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
# Blackfire | ||
ENV current_os=alpine | ||
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ | ||
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/$current_os/amd64/$version \ | ||
&& mkdir -p /tmp/blackfire \ | ||
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ | ||
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ | ||
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ | ||
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz | ||
|
||
|
||
COPY conf/php.ini /usr/local/etc/php/ | ||
|
||
WORKDIR /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
memory_limit = 4G | ||
max_execution_time = 30 | ||
zlib.output_compression = On | ||
display_errors = On | ||
|
||
date.timezone = UTC | ||
upload_max_filesize = 20M | ||
post_max_size = 20M |
Oops, something went wrong.