mage titans usa 2016 m2 deployment

22
© 2016 Magento, Inc. Page | 1

Upload: olga-kopylova

Post on 08-Jan-2017

439 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 1

Page 2: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 2

Agenda

1. Deployment types2. File permissions3. Connecting to Marketplace4. Upgrading procedure5. Q&A

Page 3: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 3

Deployment Types

Page 4: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 4

Deployment Types

Development DeploymentProduction Deployment

Requirements:- Secure

- Reliability

- Performance

- Flexible deployment settings

Requirements:- Easy to deploy

- Developer tools & debugging

Page 5: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 5

Deployment Types

Extension

Contributing

Self-hosted

Cloud

Shared hosting

Development DeploymentProduction Deployment

Page 6: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 6

Source of the Code

• Composer

• Git

• Archives

• Ready VM boxes:

– Vagrant

– Docker

Contributing dev

Extension dev Production

Production

Page 7: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 7

Application Modes

developer• Errors displayed• Auto-generated

static files

production• Errors logged• Pre-generated

static files

default• A simplified

“production”• Errors logged• Auto-generated

static files

For development

For production

Page 8: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 8

File permissions

Page 9: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 9

File Permissions

• Single user– A single user for both command line and web– Less flexibility for permissions management– Simplified setup– Good for development– May be the only option for shared hosting

• Two users: a web user and a command line user– Better flexibility for permissions management– More complicated setup– Good for production

Production on shared hosting

Development

Production

Page 10: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 10

Two Users Setup

• Command line user is the owner of the files and has full/extended permissions– Run Magento console commands and Cron from this user

• Web user is in the same group and has limited permissions– Run web server from this user

• Both users are in the same primary group

drwxr-xr-x 15 olga www-data 646 Aug 30 19:16 app

Command line Web user

Page 11: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 11

Magento Application: Read-Only Paths

• /• app• bin• devlib• phpserver• pub• pub/errors• pub/static• setup• update• var/di• var/generation• vendor

Page 12: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 12

Magento Application: Writeable Paths

• pub/media• app/etc/env.php – for cache status management• var/cache• var/page_cache• var/log• var/report• var/session• pub/static/merged – for static files merging• var/view_preprocessed – for static files merging• pub/opt/magento/var/resource_config.json - for DB media

storage• var/composer_home – for Setup Wizard

Page 13: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 13

Connecting to Marketplace

Page 14: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 14

Marketplace Credentials

• Marketplace keys ≠ marketplace username and password

Page 15: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 15

Marketplace Keys Location

• Two places where the keys are stored:– If you run Composer commands – Composer dir in user home folder

(/home/olga/.composer/auth.json)– If you use Setup Wizard – Composer dir in Magento folder

(/var/www/magento/var/composer_home/auth.json)

Page 16: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 16

Upgrading Procedure

Page 17: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 17

Composer-based Upgrade (Command Line)

• magento maintenance:enable• composer require magento/product-community-edition

2.1.1 --no-update• composer update• magento setup:upgrade• Generate DI and static view files:

– magento setup:di:compile – magento setup:static-content:deploy

• magento maintenance:disable

Page 18: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 18

Git-based Upgrade (Command Line)

Assumption: you are a contributing developer• git fetch magento• git merge magento/develop• composer install• magento setup:upgrade

Page 19: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 19

Upgrade via Web Setup Wizard

• Admin Panel > System > Tools > Setup Wizard • Select “System Upgrade”• Select version• Optional: select other components to upgrade

– Some components may require the upgrade to remain compatible with the new Magento version

• Go through the steps

Page 20: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 20

Upgrading Production: Steps

On Staging1. Upgrade the code2. Clean generated files3. Upgrade DB4. Generate DI5. Generate static view files

If you are an extension developer, reduce your extension’s upgrade time. Optimize setup scripts:- Implement one-step upgrade through multiple versions- Validate upgrade scripts on big DB

On Production1. Enable maintenance mode2. Fetch updated code3. Upgrade DB with --keep-

generated4. Disable maintenance mode

Page 21: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 21

Proper Way to Generate Files on Staging

• Configure same set of enabled/disabled modules as on production– For both DI and static view files

• Static view files:– Install Magento on the same code on staging– Locales:

• setup staging store with the same languages• or specify languages used on production

– Use --theme option to speed-up the process

Page 22: Mage Titans USA 2016  M2 deployment

© 2016 Magento, Inc. Page | 22

Olga Kopylova

Q&A