diff --git a/bin/max-git-log b/bin/max-git-log index 9d0f444..e479d1b 100755 --- a/bin/max-git-log +++ b/bin/max-git-log @@ -36,10 +36,10 @@ git log --color=always --graph --pretty="tformat:${FORMAT}" $* | sed -Ee 's/(^[^<]*) ago\)/\1)/' | # Replace (2 years, 5 months) with (2 years) sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?\)/\1)/' | - # Line columns up based on } delimiter - column -s '}' -t | # Color merge commits specially sed -Ee "s/(Merge (branch|remote-tracking branch|pull request) .*$)/$(printf $ANSI_RED)\1$(printf $ANSI_RESET)/" | + # Line columns up based on } delimiter + column -s '}' -t | # Page only if we're asked to. if [ -n "$GIT_NO_PAGER" ]; then cat diff --git a/lib/python/mbutils.py b/lib/python/mbutils.py index afee9ec..40cc1b5 100644 --- a/lib/python/mbutils.py +++ b/lib/python/mbutils.py @@ -17,7 +17,7 @@ def find_root(filename, starting_dir=None): candidate_file = path.join(starting_dir, filename) - if (path.isfile(candidate_file)): + if (path.isfile(candidate_file) or path.isdir(candidate_file)): return starting_dir elif starting_dir == '/': raise IOError('File not found in any directory') diff --git a/share/workflow-github/.docker/certs/cert0.pem b/share/workflow-github/.docker/certs/cert0.pem new file mode 100644 index 0000000..d7db7ba --- /dev/null +++ b/share/workflow-github/.docker/certs/cert0.pem @@ -0,0 +1,47 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA2wa+9FzdlSLoiMlHh7h6bTVtN2FC70QGKVGCr7cw2CDHnsnD +TEC0HeDNMRZ9byXU0uRBDAeixSMJK+qhHGoVwqVv63XdH6Vk4M/Nc3fta/rWXNVm +wBJM3k+uA6vQ17CTXmq5N5SOi5Yp2CY77dZ1V6BtihOz/8WeZIXR8P+cQYbxHh4Z +yNLoqISfdmrar71/D6KvoiD7kQSIqsW8w8/ZIBrF7fe7GCA/xefV6N3PSxwbNQEF +BfF+SKs6blfiWl9rmYrZKR8pKc2GvryAR1o+QAH2dnzDsiYU//IMP4+efl4/CNH+ +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AMBAf8wDQYJKoZIhvcNAQEFBQADggEBAMs7PIfwyOS6iOaDMi8TB8Tj +AYVzndQh10+kaZbmfqSwW5P/WKmj+jIgv7E5BixA3olmMqReZTpLa58AT+Afj+3D +hN4WPC9AXtp3eE3/rYFMzMuV4qpKa1+J9BPvFUX7ezMkABSxpzH1aCu39wvRgLTd +aDenrWOR8FrGQS6q5qfRUEA/73NZDCfjKv9hqNaxp5+5SZpD23U26jbD+iFnv52I +4iIwlMc3eCpnOx9ZvaScbtYtvinkg2/xBpOQxanasw/48vI+NnGvfp/sjzSVnPo/ +jlV2yR8UWuw9nMdz7oIvK2DLDfoIM76qg75CgzZ0D9rdlSwvhfr/Z3NYQRK+M48= +-----END CERTIFICATE----- diff --git a/share/workflow-github/.docker/composer-cache/.gitkeep b/share/workflow-github/.docker/composer-cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/share/workflow-github/.docker/composer-cache/.htaccess b/share/workflow-github/.docker/composer-cache/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/share/workflow-github/.docker/composer-cache/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/share/workflow-github/.docker/db/.gitkeep b/share/workflow-github/.docker/db/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/share/workflow-github/.docker/local.env b/share/workflow-github/.docker/local.env new file mode 100644 index 0000000..d8d9661 --- /dev/null +++ b/share/workflow-github/.docker/local.env @@ -0,0 +1,41 @@ +# Copy to local.env and store on local machine + +# Host Config +MAGE_ROOT_DIR=/var/www +MAGE_HOST=https://jml.m2 +MAGE_ADMIN_USER=admin +MAGE_ADMIN_PASS=password123 +MAGE_ADMIN_FIRSTNAME=Joe +MAGE_ADMIN_LASTNAME=Bloggs +MAGE_ADMIN_EMAIL=magento@wearejh.com +MAGE_BACKEND_FRONTNAME=admin +HTTPS=on + +# MySQL Details +MYSQL_ROOT_PASSWORD=docker +MYSQL_DATABASE=docker +MYSQL_USER=docker +MYSQL_PASSWORD=docker + +# PHP +PHP_MEMORY_LIMIT=2G + +# RabbitMQ +RABBITMQ_DEFAULT_USER=user +RABBITMQ_DEFAULT_PASS=password + +## Mail config +MAIL_HOST=mail +MAIL_PORT=1025 + +## Xdebug config +XDEBUG_IDE_KEY=PHPSTORM +XDEBUG_CONFIG=remote_host=docker.for.mac.host.internal +XDEBUG_ENABLE=true +PHP_IDE_CONFIG=serverName=jml.m2 + +# Blackfire +BLACKFIRE_CLIENT_ID= +BLACKFIRE_CLIENT_TOKEN= +BLACKFIRE_SERVER_ID= +BLACKFIRE_SERVER_TOKEN= diff --git a/share/workflow-github/.docker/local.env.dist b/share/workflow-github/.docker/local.env.dist new file mode 100644 index 0000000..a69c0b5 --- /dev/null +++ b/share/workflow-github/.docker/local.env.dist @@ -0,0 +1,41 @@ +# Copy to local.env and store on local machine + +# Host Config +MAGE_ROOT_DIR=/var/www +MAGE_HOST=https://jml.m2 +MAGE_ADMIN_USER=admin +MAGE_ADMIN_PASS=password123 +MAGE_ADMIN_FIRSTNAME=Joe +MAGE_ADMIN_LASTNAME=Bloggs +MAGE_ADMIN_EMAIL=magento@wearejh.com +MAGE_BACKEND_FRONTNAME=admin +HTTPS=on + +# MySQL Details +MYSQL_ROOT_PASSWORD=docker +MYSQL_DATABASE=docker +MYSQL_USER=docker +MYSQL_PASSWORD=docker + +# PHP +PHP_MEMORY_LIMIT=2G + +# RabbitMQ +RABBITMQ_DEFAULT_USER=user +RABBITMQ_DEFAULT_PASS=password + +## Mail config +MAIL_HOST=mail +MAIL_PORT=1025 + +## Xdebug config +XDEBUG_IDE_KEY=PHPSTORM +XDEBUG_CONFIG=remote_host=docker.for.mac.host.internal +XDEBUG_ENABLE=true +PHP_IDE_CONFIG=serverName=jml.m2 + +# Blackfire +BLACKFIRE_CLIENT_ID= +BLACKFIRE_CLIENT_TOKEN= +BLACKFIRE_SERVER_ID= +BLACKFIRE_SERVER_TOKEN= \ No newline at end of file diff --git a/share/workflow-github/.docker/nginx/sites/site.conf b/share/workflow-github/.docker/nginx/sites/site.conf new file mode 100644 index 0000000..c8a4419 --- /dev/null +++ b/share/workflow-github/.docker/nginx/sites/site.conf @@ -0,0 +1,179 @@ +upstream fastcgi_backend { + server php:9000; +} + +server { + set $MAGE_ROOT /var/www; + + listen 80 default_server; + listen [::]:80 default_server; + + root $MAGE_ROOT/pub; + + index index.php; + autoindex off; + charset UTF-8; + error_page 404 403 = /errors/404.php; + #add_header "X-UA-Compatible" "IE=Edge"; + + # PHP entry point for setup application + location ~* ^/setup($|/) { + root $MAGE_ROOT; + location ~ ^/setup/index.php { + fastcgi_pass fastcgi_backend; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ ^/setup/(?!pub/). { + deny all; + } + + location ~ ^/setup/pub/ { + add_header X-Frame-Options "SAMEORIGIN"; + } + } + + # PHP entry point for update application + location ~* ^/update($|/) { + root $MAGE_ROOT; + + location ~ ^/update/index.php { + fastcgi_split_path_info ^(/update/index.php)(/.+)$; + fastcgi_pass fastcgi_backend; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + } + + # Deny everything but index.php + location ~ ^/update/(?!pub/). { + deny all; + } + + location ~ ^/update/pub/ { + add_header X-Frame-Options "SAMEORIGIN"; + } + } + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location /pub/ { + location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) { + deny all; + } + alias $MAGE_ROOT/pub/; + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /static/ { + # Uncomment the following line in production mode + # expires max; + + # Remove signature of the static files that is used to overcome the browser cache + location ~ ^/static/version { + rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; + } + + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + add_header X-Frame-Options "SAMEORIGIN"; + expires +1y; + + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + } + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + add_header X-Frame-Options "SAMEORIGIN"; + expires off; + + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + } + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; + } + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /media/ { + try_files $uri $uri/ /get.php?$args; + + location ~ ^/media/theme_customization/.*\.xml { + deny all; + } + + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + add_header X-Frame-Options "SAMEORIGIN"; + expires +1y; + try_files $uri $uri/ /get.php?$args; + } + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + add_header X-Frame-Options "SAMEORIGIN"; + expires off; + try_files $uri $uri/ /get.php?$args; + } + add_header X-Frame-Options "SAMEORIGIN"; + } + + location /media/customer/ { + deny all; + } + + location /media/downloadable/ { + deny all; + } + + location /media/import/ { + deny all; + } + + # PHP entry point for main application + location ~ (index|get|static|report|404|503|health_check)\.php$ { + try_files $uri =404; + fastcgi_pass fastcgi_backend; + fastcgi_buffers 1024 4k; + + fastcgi_read_timeout 600s; + fastcgi_connect_timeout 600s; + + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + gzip on; + gzip_disable "msie6"; + + gzip_comp_level 6; + gzip_min_length 1100; + gzip_buffers 16 8k; + gzip_proxied any; + gzip_types + text/plain + text/css + text/js + text/xml + text/javascript + application/javascript + application/x-javascript + application/json + application/xml + application/xml+rss + image/svg+xml; + gzip_vary on; + + # Banned locations (only reached if the earlier PHP entry point regexes don't match) + location ~* (\.php$|\.htaccess$|\.git) { + deny all; + } +} \ No newline at end of file diff --git a/share/workflow-github/.docker/php/Dockerfile b/share/workflow-github/.docker/php/Dockerfile new file mode 100644 index 0000000..f2d6c58 --- /dev/null +++ b/share/workflow-github/.docker/php/Dockerfile @@ -0,0 +1,68 @@ +FROM php:7.1-fpm +MAINTAINER Michael Woodward + +ARG BUILD_ENV=dev +ENV PROD_ENV=prod + +RUN apt-get update \ + && apt-get install -y \ + cron \ + libfreetype6-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng12-dev \ + libxslt1-dev \ + gettext \ + msmtp \ + git \ + vim + +RUN docker-php-ext-configure \ + gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ + +RUN docker-php-ext-install \ + gd \ + intl \ + mbstring \ + mcrypt \ + pdo_mysql \ + xsl \ + zip \ + soap \ + bcmath \ + mysqli \ + opcache \ + pcntl + +# Xdebug +RUN [ "$BUILD_ENV" != "$PROD_ENV" ] && pecl install -o -f xdebug-2.5.0; true + +# Blackfire +RUN [ "$BUILD_ENV" != "$PROD_ENV" ] \ + && 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/linux/amd64/$version \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \ + && mv /tmp/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; \ + true + +# Configuration files +COPY .docker/php/etc/custom.template .docker/php/etc/xdebug.template /usr/local/etc/php/conf.d/ +COPY .docker/php/etc/msmtprc.template /etc/msmtprc.template + +# Copy in Entrypoint file & Magento installation script +COPY .docker/php/bin/docker-configure .docker/php/bin/magento-install .docker/php/bin/magento-configure /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-configure /usr/local/bin/magento-install /usr/local/bin/magento-configure + +# Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +COPY . /var/www + +RUN chsh -s /bin/bash www-data + +VOLUME ["/var/www"] +WORKDIR "/var/www" +ENTRYPOINT ["/usr/local/bin/docker-configure"] +CMD ["php-fpm"] diff --git a/share/workflow-github/.docker/php/bin/docker-configure b/share/workflow-github/.docker/php/bin/docker-configure new file mode 100644 index 0000000..663bd79 --- /dev/null +++ b/share/workflow-github/.docker/php/bin/docker-configure @@ -0,0 +1,15 @@ +#!/bin/bash + +envsubst < "/usr/local/etc/php/conf.d/xdebug.template" > "/usr/local/etc/php/conf.d/xdebug.ini" +envsubst < "/usr/local/etc/php/conf.d/custom.template" > "/usr/local/etc/php/conf.d/custom.ini" +envsubst < "/etc/msmtprc.template" > "/etc/msmtprc" + +rm /usr/local/etc/php/conf.d/xdebug.template +rm /usr/local/etc/php/conf.d/custom.template +rm /etc/msmtprc.template + +[ "$XDEBUG_ENABLE" = "true" ] && \ + docker-php-ext-enable xdebug && \ + echo "Xdebug is enabled" + +exec "$@" diff --git a/share/workflow-github/.docker/php/bin/magento-configure b/share/workflow-github/.docker/php/bin/magento-configure new file mode 100644 index 0000000..893f9b9 --- /dev/null +++ b/share/workflow-github/.docker/php/bin/magento-configure @@ -0,0 +1,75 @@ +#!/usr/bin/env php + 'redis', + 'redis' => + [ + 'host' => 'redis', + 'port' => '6379', + 'password' => '', + 'timeout' => '2.5', + 'persistent_identifier' => '', + 'database' => '0', + 'compression_threshold' => '2048', + 'compression_library' => 'gzip', + 'log_level' => '1', + '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' + ] +]; + +$config['cache'] = [ + 'frontend' => + [ + 'default' => + [ + 'backend' => 'Cm_Cache_Backend_Redis', + 'backend_options' => + [ + 'server' => 'redis', + 'port' => '6379', + 'database' => '1' + ], + ] + ] +]; + +$config['MAGE_MODE'] = $isProduction ? 'production' : 'developer'; + +$contents = <<exec($sql); diff --git a/share/workflow-github/.docker/php/bin/magento-install b/share/workflow-github/.docker/php/bin/magento-install new file mode 100644 index 0000000..06c058d --- /dev/null +++ b/share/workflow-github/.docker/php/bin/magento-install @@ -0,0 +1,31 @@ +#!/bin/bash + +cd /var/www + +echo "Installing Magento..." + +bin/magento setup:install \ + --db-host=db \ + --db-name=$MYSQL_DATABASE \ + --db-user=$MYSQL_USER \ + --db-password=$MYSQL_PASSWORD \ + --base-url=$MAGE_HOST \ + --base-url-secure=$MAGE_HOST \ + --admin-firstname=$MAGE_ADMIN_FIRSTNAME \ + --admin-lastname=$MAGE_ADMIN_LASTNAME \ + --admin-email=$MAGE_ADMIN_EMAIL \ + --admin-user=$MAGE_ADMIN_USER \ + --admin-password=$MAGE_ADMIN_PASS \ + --backend-frontname=$MAGE_BACKEND_FRONTNAME \ + --use-secure=1 \ + --use-secure-admin=1 \ + --cleanup-database -vvv \ + || { exit 1; } + +bin/magento index:reindex && \ +bin/magento dev:source-theme:deploy --area="adminhtml" --theme="Magento/backend" css/styles-old css/styles && \ +bin/magento dev:source-theme:deploy --theme="Magento/blank" css/styles-m css/styles-l css/email css/email-inline && \ +bin/magento dev:source-theme:deploy && \ +bin/magento setup:static-content:deploy + +echo "Installation complete ᕦ( ̿ ̿ - ̿ ̿ )つ" \ No newline at end of file diff --git a/share/workflow-github/.docker/php/etc/custom.template b/share/workflow-github/.docker/php/etc/custom.template new file mode 100644 index 0000000..bbf6fbf --- /dev/null +++ b/share/workflow-github/.docker/php/etc/custom.template @@ -0,0 +1,9 @@ +memory_limit = ${PHP_MEMORY_LIMIT}; +session.auto_start=off; +suhosin.session.cryptua=off; +sendmail_path=/usr/bin/msmtp -t; +opcache.enable=1 +opcache.enable_cli=1 +opcache.save_comments=1 +opcache.max_accelerated_files=65406 +opcache.memory_consumption=256 \ No newline at end of file diff --git a/share/workflow-github/.docker/php/etc/msmtprc.template b/share/workflow-github/.docker/php/etc/msmtprc.template new file mode 100644 index 0000000..499275c --- /dev/null +++ b/share/workflow-github/.docker/php/etc/msmtprc.template @@ -0,0 +1,4 @@ +account default +host ${MAIL_HOST} +port ${MAIL_PORT} +auto_from on \ No newline at end of file diff --git a/share/workflow-github/.docker/php/etc/xdebug.template b/share/workflow-github/.docker/php/etc/xdebug.template new file mode 100644 index 0000000..060b133 --- /dev/null +++ b/share/workflow-github/.docker/php/etc/xdebug.template @@ -0,0 +1,5 @@ +xdebug.remote_enable = 1 +xdebug.remote_port = 9000 +xdebug.scream = 0 +xdebug.show_local_vars = 1 +xdebug.idekey = ${XDEBUG_IDE_KEY} \ No newline at end of file diff --git a/share/workflow-github/.docker/production.env.dist b/share/workflow-github/.docker/production.env.dist new file mode 100644 index 0000000..933fe29 --- /dev/null +++ b/share/workflow-github/.docker/production.env.dist @@ -0,0 +1,30 @@ +# Copy to production.env and store on production machine +# Never commit your production details into the repo + +# Host Config +MAGE_HOST=https://mage.dev +MAGE_ADMIN_USER=admin +MAGE_ADMIN_PASS=password123 +MAGE_ADMIN_FIRSTNAME=Joe +MAGE_ADMIN_LASTNAME=Bloggs +MAGE_ADMIN_EMAIL=magento@wearejh.com +MAGE_BACKEND_FRONTNAME=admin +HTTPS=on + +# MySQL Details +MYSQL_ROOT_PASSWORD=docker +MYSQL_DATABASE=docker +MYSQL_USER=docker +MYSQL_PASSWORD=docker + +# PHP +PHP_MEMORY_LIMIT=2G + +# RabbitMQ +RABBITMQ_DEFAULT_USER=user +RABBITMQ_DEFAULT_PASS=password + +## Xdebug config +XDEBUG_IDE_KEY=PHPSTORM +XDEBUG_CONFIG=remote_host=10.254.254.254 +XDEBUG_ENABLE=false \ No newline at end of file diff --git a/share/workflow-github/.dockerignore b/share/workflow-github/.dockerignore new file mode 100644 index 0000000..8aa9ee3 --- /dev/null +++ b/share/workflow-github/.dockerignore @@ -0,0 +1,33 @@ +# Ignore .docker to prevent it being copied with COPY ./ +.docker + +# Unignore these to allow docker build to copy them in +!.docker/php +!.docker/nginx +!.docker/certs +!.docker/composer-cache + +docker-compose*.yml +.dockerignore + +# Ignore some files we don't need in the containers +LICENSE*.txt +COPYING.txt +.user.ini +.travis.yml +.php_cs +.htaccess +*.sample +*.md + +Gemfile +cap +Capfile +circle.yml +.phpstorm.meta.php + +.git +.gitignore +.idea + +node_modules diff --git a/share/workflow-github/docker-compose.dev.yml b/share/workflow-github/docker-compose.dev.yml new file mode 100644 index 0000000..93cf20d --- /dev/null +++ b/share/workflow-github/docker-compose.dev.yml @@ -0,0 +1,37 @@ +version: '2' + +services: + nginx: + volumes: + - .docker/certs:/etc/letsencrypt + env_file: + - ./.docker/local.env + + php: + env_file: + - .docker/local.env + volumes: + - ./app/code/JH:/var/www/app/code/JH + + db: + env_file: + - ./.docker/local.env + volumes: + - .docker/db/:/docker-entrypoint-initdb.d/ + +# rabbitmq: +# env_file: +# - ./.docker/local.env + + mail: + container_name: m23-mail + image: mailhog/mailhog + ports: + - 1025 + - 8025:8025 + + blackfire: + container_name: m23-blackfire + image: blackfire/blackfire + env_file: + - .docker/local.env diff --git a/share/workflow-github/docker-compose.prod.yml b/share/workflow-github/docker-compose.prod.yml new file mode 100644 index 0000000..f29b487 --- /dev/null +++ b/share/workflow-github/docker-compose.prod.yml @@ -0,0 +1,32 @@ +version: '2' + +volumes: + app-var: + +services: + nginx: + volumes: + - /etc/letsencrypt:/etc/letsencrypt + env_file: + - .docker/production.env + + php: + env_file: + - .docker/production.env + volumes: + - app-var:/var/www/var + + db: + env_file: + - .docker/production.env + +# rabbitmq: +# env_file: +# - ./.docker/production.env + +# varnish: +# image: million12/varnish +# ports: +# - "80:80" +# env_file: +# - ./.docker/production.env \ No newline at end of file diff --git a/share/workflow-github/docker-compose.yml b/share/workflow-github/docker-compose.yml new file mode 100644 index 0000000..638f4cd --- /dev/null +++ b/share/workflow-github/docker-compose.yml @@ -0,0 +1,79 @@ +version: '2' + +volumes: + db-data: + app-env: + +services: + haproxy: + image: dockercloud/haproxy:latest + links: + - varnish + environment: + - CERT_FOLDER=/certs + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - .docker/certs:/certs + ports: + - "80:80" + - "443:443" + + varnish: + image: wearejh/magento-varnish:latest + environment: + - FORCE_SSL=yes + depends_on: + - nginx + + nginx: + container_name: m23 + image: nginx:stable-alpine + working_dir: /var/www + volumes: + - .docker/nginx/sites:/etc/nginx/conf.d + volumes_from: + - php + depends_on: + - php + + php: + container_name: m23-php + image: wearejh/m23 + build: + context: . + dockerfile: .docker/php/Dockerfile + volumes: + - ~/.composer/auth.json:/root/.composer/auth.json + depends_on: + - db + ports: + - 9000 + + db: + container_name: m23-db + image: mysql:5.6 + volumes: + - db-data:/var/lib/mysql + ports: + - "3306:3306" + restart: unless-stopped + + redis: + container_name: m23-redis + image: redis:3-alpine + ports: + - "6379:6379" + +# elasticsearch: +# container_name: m23-elasticsearch +# image: elasticsearch +# ports: +# - "9200:9200" +# - "9300:9300" + +# rabbitmq: +# container_name: m23-rabbitmq +# image: rabbitmq:3.6.1-management +# ports: +# - "15672:15672" +# - "5672:5672" diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index e0ed561..58026d1 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -1,3 +1,5 @@ +source /etc/zshrc + ## Path # Default path export PATH="/sbin" @@ -195,3 +197,23 @@ function serve_m2 { php -S "0.0.0.0:15013" "../phpserver/router.php" "../pub" popd } + +alias ww='workflow' + +# Initialize workflow with Github +function workflow_github { + local root="$(findroot "app/code/Magento")" + pushd "$root" + cp -r "$HOME/dotfiles/share/workflow-github/" "." + cat <<'EOF' +Initialized workflow Docker and Docker Compose files in the Magento root. + +Configure your volumes to sync what you are working on, edit .docker/local.env +and run: + + $ workflow up && workflow mfi + +To install Magento. Happy hacking! +EOF + popd +}