Last active
October 19, 2019 08:10
-
-
Save mhhansen/fee1aa37d1e37f489c6ee0504e87aa9f to your computer and use it in GitHub Desktop.
Magento PWA Studio setup with 2.3.0-alpha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# NODE: 8.11.2 | |
# NPM: 5.6.0 (I prob should upgrade this one) | |
# MySQL: 5.7 | |
# PHP: 7.1 | |
################################################################ | |
################################################################ | |
################################ | |
### DOWNLOAD AND PREPARE MAGENTO TO INSTALL | |
# assuming you are in /<YOUR_PROJECT_FOLDER>/ | |
# | |
# download Magento 2.3.0 alpha via composer into a new folder "230develop" | |
git clone -b 2.3-develop https://github.com/magento/magento2.git 230develop | |
# (optional) install sample data | |
git clone -b 2.3-develop https://github.com/magento/magento2-sample-data.git 230develop-data | |
# connect sample data to your mage | |
php -f 230develop-data/dev/tools/build-sample-data.php -- --ce-source="<full_path_to_magento_source>/230develop" | |
############################# | |
### for VALETPLUS users only | |
### if you don't use valet: | |
### setup your local host pointing to your new magento copy | |
### and a new fresh db with user/pwd | |
### and skip this step | |
# | |
# show which domain valet is currently using (by default is "test", in my case "local") | |
valet domain | |
> local | |
# enter to the newely cloned m2: | |
cd 230develop | |
# park the directory | |
valet park | |
> This directory has been added to Valet's paths. | |
# secure with a TLS certificate | |
valet secure | |
> (...) | |
> The [230develop.local] site has been secured with a fresh TLS certificate. | |
# link to register the domain | |
valet link | |
> Current working directory linked to 230develop.local | |
# create fresh database for current project | |
# (by default valet will create a db with the same project name) | |
valet db create | |
> Database "230develop" created successfully | |
### | |
### | |
### | |
### | |
################################## | |
### INSTALL MAGENTO | |
# start the magento setup wizard and complete the installation | |
# in my case, my domain is "https://www.230.local/" | |
# keep in mind you have to have a secure domain (for the service-worker) | |
# open setup wizard using chrome | |
cd 230develop | |
# install magento dependencies | |
composer install | |
# install magento | |
php bin/magento setup:install --base-url=https://YOUR_LOCAL_DOMAIN/ \ | |
--db-host=localhost --db-name=DB_NAME --db-user=DB_USER --db-password=DB_PASSWORD \ | |
--admin-firstname=YOUR_NAME --admin-lastname=YOUR_LASTNAME --admin-email=YOUR_EMAIL \ | |
--admin-user=YOUR_ADMIN_USER --admin-password=YOUR_ADMIN_PASSWRD --language=en_US \ | |
--currency=USD --timezone=America/Argentina/Buenos_Aires --use-rewrites=1 | |
#################################### | |
### DOWNLOAD PWA STUDIO packages | |
# head one folder back (to be at same level of 230develop) | |
cd .. | |
# now clone PWA Studio github repo | |
git clone https://github.com/magento-research/pwa-studio.git | |
# enter to the `pwa-studio` folder and install all dependencies | |
cd pwa-studio | |
npm install | |
### INSTALL `pwa-module` | |
# symlink module "pwa-studio/packages/pwa-module" into "230alpha/app/code/Magento/" as "Pwa" | |
# go to your magento | |
cd ../230develop/app/code/Magento | |
# create a symlink to "pwa-module" | |
ln -s <FULL_PATH_TO_PWA_STUDIO>/packages/pwa-module Pwa | |
# if you run "php bin/magento module:status" in your root | |
# you should, see the new "Magento_Pwa" module disabled. | |
# now go to the root folder and install it | |
php bin/magento setup:upgrade | |
### INSTALL `venia-concept` theme | |
# symlink venia theme into your magento into "app/design/frontend/Magento" as "venia" | |
cd app/design/frontend/Magento | |
ln -s <FULL_PATH_TO_PWA_STUDIO>/packages/venia-concept venia | |
# go again to the folder root and clean the cache | |
php bin/magento cache:clean | |
# go Magento backend, to activate venia in your store: | |
# Content > Design > Configuration > Default Store > Applied Theme: Magento Venia | |
# last step: create an `.env` file for the venia-concept | |
# or you can copy the existing `.env.dist` file or just create one | |
cd ../pwa-studio/packages/venia-concept | |
touch .env | |
# and entering this lines. replace the "backend domain", in my case "https://www.230alpha.local": | |
MAGENTO_BACKEND_DOMAIN="https://www.230alpha.local" | |
MAGENTO_BACKEND_PUBLIC_PATH="/pub/static/frontend/Magento/venia/en_US/" | |
SERVICE_WORKER_FILE_NAME="sw.js" | |
ENABLE_SERVICE_WORKER_DEBUGGING= | |
################################################################ | |
# that's it. | |
# now go to "/pwa-studio/packages/venia-concept/" folder | |
# start the PWA server: | |
npm start | |
# you'll get your local dev environment url so you can access via | |
# like so: | |
Project is running at https://magento-venia.local.pwadev:8000/ | |
webpack output is served from https://magento-venia.local.pwadev:8000/pub/static/frontend/Magento/venia/en_US/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment