Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Current »

This document only applies to Mac computers, Valet is incompatible with Windows and this document will not complete

  1. Install Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    If you are on an M1 macbook, you will need to add Homebrew to your path.

    echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc

  2. Install PHP

    brew install php@7.4
    echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc

    If on an M1 mac

    brew install php@7.4
    echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    brew services restart php@7.4

  3. Install Composer by following the instructions here:https://getcomposer.org/download/

  4. sudo mv composer.phar /usr/local/bin/composer

  5. verify composer works and installed properly by running composer

  6. Add Composer binaries to your path

    echo "export PATH=\$PATH:\$HOME/.composer/vendor/bin" >> ~/.zshrc
    source ~/.zshrc
  7. Install Laravel Valet Composer Package

    composer self-update 1.10.19
    composer global require laravel/valet

    If on an M1 mac

    sudo composer self-update 1.10.19
    composer global require laravel/valet
  8. Run Laravel Valet installer, this will throw an error, but that’s normal

    valet install
  9. Set the PHP Version of valet to PHP 7.4

    valet use php@7.4
    valet install

Install MySQL and Redis

Go to http://dbngin.com and download the client

Create the MySQL server

  1. Click the Plus in the Upper right of DBNgin

  2. Choose MySQL in the service dropdown

  3. Give your new server a name, anything is fine

  4. Click Create

Create the Redis Server

  1. Click the Plus in the Upper right of DBNgin

  2. Choose Redis in the service dropdown

  3. Give your new server a name, anything is fine

  4. Click Create

Start your services

  1. On each of the new servers you created, click Start.

If you encounter errors, ensure your don’t have running docker containers bound on the same ports

Import the MySQL Database

Download the Database dump
Extract the database dump

Download Sequel Ace

Connect to the Local database in Sequel Ace

Host: localhost
Username: root
Password: <empty>

Run the following commands in the query window by entering the text, and clicking the arrow to the right of “Run Current”. This will bring up a selector and in that selector, choose “Run All Queries”

CREATE DATABASE `continuingeducation`;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';
SET GLOBAL sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';
set foreign_key_checks=0

Select the new database in the dropdown located at the top of the window

Import the SQL file by going to File → Import

Once this is complete, re-enable foreign key checks by running

set foreign_key_checks=1

Modify the URLs in the dump

UPDATE core_config_data SET value='continuingeducation.test' WHERE scope_id=0 AND path='web/cookie/cookie_domain';
UPDATE core_config_data SET value='woundcare.test' WHERE scope_id=10 AND path='web/cookie/cookie_domain';
UPDATE core_config_data SET value='distancecme.test' WHERE scope_id=6 AND path='web/cookie/cookie_domain';
UPDATE core_config_data SET value='https://woundcare.test/' WHERE scope_id=10 AND path='web/secure/base_url';
UPDATE core_config_data SET value='https://woundcare.test/' WHERE scope_id=10 AND path='web/secure/base_link_url';
UPDATE core_config_data SET value='http://woundcare.test/' WHERE scope_id=10 AND path='web/unsecure/base_url';
UPDATE core_config_data SET value='http://woundcare.test/' WHERE scope_id=10 AND path='web/unsecure/base_link_url';
UPDATE core_config_data SET value='https://continuingeducation.test/' WHERE scope_id=0 AND path='web/secure/base_url';
UPDATE core_config_data SET value='https://continuingeducation.test/' WHERE scope_id=0 AND path='web/secure/base_link_url';
UPDATE core_config_data SET value='http://continuingeducation.test/' WHERE scope_id=0 AND path='web/unsecure/base_url';
UPDATE core_config_data SET value='http://continuingeducation.test/' WHERE scope_id=0 AND path='web/unsecure/base_link_url';
UPDATE core_config_data SET value='https://distancecme.test/' WHERE scope_id=6 AND path='web/secure/base_url';
UPDATE core_config_data SET value='https://distancecme.test/' WHERE scope_id=6 AND path='web/secure/base_link_url';
UPDATE core_config_data SET value='http://distancecme.test/' WHERE scope_id=6 AND path='web/unsecure/base_url';
UPDATE core_config_data SET value='http://distancecme.test/' WHERE scope_id=6 AND path='web/unsecure/base_link_url';

Modify Nginx and Valet Configurations

Increase the buffers and buffer size in the fastcgi parameters for Nginx

echo "fastcgi_buffers 8 256k;\nfastcgi_buffer_size 128k;" >> /usr/local/etc/nginx/fastcgi_params

If on an M1 Mac:

echo "fastcgi_buffers 8 256k;\nfastcgi_buffer_size 128k;" >> /opt/homebrew/etc/nginx/fastcgi_params

Create the valet Nginx configuration directory

mkdir -p ~/.valet/Nginx/

Modify the proxy configuration on the valet template

echo "proxy_buffer_size   256k;\nproxy_buffers   8 256k;\nproxy_busy_buffers_size   512k;" >> ~/.valet/Nginx/all.conf

Disable JIT compilation to allow the backend to properly render

echo "pcre.jit=0" > /usr/local/etc/php/7.4/conf.d/10-disable-pcre-jit.ini

If on an M1 Mac

echo "pcre.jit=0" > /opt/homebrew/etc/php/7.4/conf.d/10-disable-pcre-jit.ini

Clone the Magento Repository

mkdir ~/dev/ && cd ~/dev/
git clone git@bitbucket.org:relias/magento-2.git 
cd magento-2
git checkout integration
valet link continuingeducation
composer install

Configure Magento to communicate with MySQL and Redis

Open or create app/etc/env.php and paste the following in

<?php
return [
    'backend' => [
        'frontName' => 'admin'
    ],
    'install' => [
        'date' => 'Mon, 13 May 2019 16:46:50 +0000'
    ],
    'crypt' => [
        'key' => '2756aee4edcbc2e8c8734287b50cfe74'
    ],
    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => '127.0.0.1',
                'dbname' => 'continuingeducation',
                'username' => 'root',
                'password' => '',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'active' => '1'
            ]
        ]
    ],
    'resource' => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
    'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '127.0.0.1',
            'port' => '6379',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '2',
            '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'
        ]
    ],
    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '0',
                    'port' => '6379',
                    'password' => ''
                ]
            ],
            'page_cache' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'password' => '',
                    'database' => '1',
                    'compress_data' => '0'
                ]
            ]
        ]
    ],
    'x-frame-options' => 'SAMEORIGIN',
    'MAGE_MODE' => 'developer',
    'cache_types' => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'full_page' => 1,
        'translate' => 1,
        'config_webservice' => 1,
        'compiled_config' => 1
    ],
    'queue' => [
        'amqp' => [
            'host' => 'rabbitmq',
            'port' => '5672',
            'user' => 'guest',
            'password' => 'guest',
            'virtualhost' => '/',
            'ssl' => ''
        ]
    ],
    'cron_consumers_runner' => [
        'max_messages' => 500
    ],
    'directories' => [
        'document_root_is_pub' => 1
    ]
];

Locate the ‘cache’ entry in the array and ensure the backend options point to localhost port 6379

Locate the ‘session’ entry and ensure it’s set to use Redis and localhost port 6379 as well

Locate ‘db’ and ensure it’s set to

'host' => '127.0.0.1',
'dbname' => 'continuingeducation',
'username' => 'root',

Create a .valet-env.php if it doesn’t exist and place the following into it

<?php
return [
    'distancecme' => [
        'MAGE_RUN_CODE' => 'dcme_default_view',
        'MAGE_RUN_TYPE' => 'store',
    ],
    'woundcare' => [
	    "MAGE_RUN_CODE" => "wocn_default_view",
	    "MAGE_RUN_TYPE" => "store"
    ],
    // Set $_SERVER['key'] to "value" for all sites...
    '*' => [
        'MAGE_RUN_CODE' => 'default',
	    'MAGE_RUN_TYPE' => 'store'
    ],
];

Bring Valet Online

sudo brew services stop nginx
sudo brew services stop dnsmasq
sudo brew services stop php@7.4
valet restart
valet secure
  • No labels