mage2click / docker-magento-mutagen

Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
https://mage2.click
MIT License
69 stars 9 forks source link

Add support for Magento 1 projects #39

Open u-maxx opened 5 years ago

u-maxx commented 5 years ago

Add support for Magento 1 projects

atishgoswami commented 5 years ago

Recently used the project to setup Magento 1.14 site on my local.

Had to do a couple of changes and the setup manually, but it did work.

docker-compose.yml

version: "3"

services:

  app:
    image: mage2click/magento-nginx:1.15-alpine
    ports:
      - "80:8000"
      - "443:8443"
    depends_on:
      - db
      - phpfpm
    volumes: &appvolumes
      - ~/.composer:/var/www/.composer:delegated
      - appdata:/var/www/html
      - sockdata:/sock

  db:
    image: percona:5.7
    ports:
      - "3306:3306"
    env_file: env/db.env
    volumes:
      - dbdata:/var/lib/mysql

  phpfpm:
    image: mage2click/magento-php-versions:5.6-fpm
    depends_on:
      - db
    volumes: *appvolumes

volumes:
  appdata:
  dbdata:
  sockdata:

nginx.conf

root $MAGE_ROOT;

client_body_buffer_size 8k;
client_max_body_size 10M;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;

if ($server_port = 80) { set $httpss off; }

location /
{
    index index.html index.php; ## Allow a static html file to be shown first
    try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
    expires 30d; ## Assume all files are cachable
}

## These locations would be hidden by .htaccess normally
location /app/                { deny all; }
location /includes/           { deny all; }
location /lib/                { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/            { deny all; }
location /report/config.xml   { deny all; }
location /var/                { deny all; }

## Disable .htaccess and other hidden files
location  /.
{
    return 404;
}

## Magento uses a common front handler
location @handler
{
    rewrite / /index.php;
}

## Forward paths like /js/index.php/x.js to relevant handler
location ~ .php/
{
    rewrite ^(.*.php)/ $1 last;
}

## Execute PHP scripts
location ~ .php$
{
    ## Catch 404s that try_files miss
    if (!-e $request_filename) {
        rewrite / /index.php last;
    }

    expires off; ## Do not cache dynamic content
    fastcgi_pass fastcgi_backend;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #fastcgi_read_timeout 1500;
    fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
    fastcgi_param MAGE_RUN_TYPE store;
    fastcgi_param HTTPS on;
    fastcgi_param HTTP_X_FORWARDED_PROTO https;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 4 32k;
    include fastcgi_params; ## See /etc/nginx/fastcgi_params
    fastcgi_param SERVER_PORT 443;
}

Had to change the mutagen sync configs as well and removed the vendor sync

bin/mutagen

mutagen create \
        --label=mage2click-sync=html \
        --default-file-mode=0644 \
        --default-directory-mode=0755 \
        --default-owner-beta=app \
        --default-group-beta=app \
        --sync-mode=two-way-resolved \
        --ignore=/.idea \
        --ignore-vcs \
        ${CONTAINER_SRC_SYNC_DIR}/app docker://$(docker-compose ps -q phpfpm|awk '{print $1}')/var/www/html/app/

Hope it helps someone, trying to setup M1 on there local using the project

shkoliar commented 5 years ago

Hey @atishgoswami,

Check also feature/magento-1 branch and M1.md for setup information 😉

atishgoswami commented 5 years ago

Silly me, should have checked the branches.

Will test it out thanks @shkoliar