mage titans usa 2016 m2 deployment

Post on 08-Jan-2017

439 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© 2016 Magento, Inc. Page | 1

© 2016 Magento, Inc. Page | 2

Agenda

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

© 2016 Magento, Inc. Page | 3

Deployment Types

© 2016 Magento, Inc. Page | 4

Deployment Types

Development DeploymentProduction Deployment

Requirements:- Secure

- Reliability

- Performance

- Flexible deployment settings

Requirements:- Easy to deploy

- Developer tools & debugging

© 2016 Magento, Inc. Page | 5

Deployment Types

Extension

Contributing

Self-hosted

Cloud

Shared hosting

Development DeploymentProduction Deployment

© 2016 Magento, Inc. Page | 6

Source of the Code

• Composer

• Git

• Archives

• Ready VM boxes:

– Vagrant

– Docker

Contributing dev

Extension dev Production

Production

© 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

© 2016 Magento, Inc. Page | 8

File permissions

© 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

© 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

© 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

© 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

© 2016 Magento, Inc. Page | 13

Connecting to Marketplace

© 2016 Magento, Inc. Page | 14

Marketplace Credentials

• Marketplace keys ≠ marketplace username and password

© 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)

© 2016 Magento, Inc. Page | 16

Upgrading Procedure

© 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

© 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

© 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

© 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

© 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

© 2016 Magento, Inc. Page | 22

Olga Kopylova

Q&A

top related