Ref: https://docs.vuestorefront.io/guide/installation/linux-mac.html#requirements
https://medium.com/the-vue-storefront-journal/vue-storefront-how-to-install-and-integrate-with-magento2-227767dd65b2
Requirements
– Docker (with docker-compose installed).
Already included in vue-storefront and vue-storefront-api Docker images (required locally, if you do not use containerization):
– Node.js Active LTS (>=8.0.0)
|
1 2 3 4 |
teddy@teddy:~$ nvm use 10.15.1 Now using node v10.15.1 (npm v6.4.1) teddy@teddy:~$ node -v v10.15.1 |
– Yarn (>=1.0.0)
|
1 2 |
teddy@teddy:~$ yarn -v 1.13.0 |
– ImageMagick (to fit, resize and crop images)
First, Install Docker CE for ubuntu (https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository)
Install using the repository
Before you install Docker CE for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
SET UP THE REPOSITORY
Update the apt package index:
|
1 |
$ sudo apt-get update |
Install packages to allow apt to use a repository over HTTPS:
|
1 2 3 4 5 6 |
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common |
Add Docker’s official GPG key:
|
1 |
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
Verify that you now have the key with the fingerprint9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
|
1 2 3 4 5 |
teddy@teddy:~/Documents/works$ sudo apt-key fingerprint 0EBFCD88 pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22 |
Use the following command to set up the stable repository.
|
1 2 3 4 |
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" |
INSTALL DOCKER CE
Update the apt package index.
|
1 |
$ sudo apt-get update |
Install the latest version of Docker CE and containerd, or go to the next step to install a specific version:
|
1 |
$ sudo apt-get install docker-ce docker-ce-cli containerd.io |
Verify that Docker CE is installed correctly by running the hello-world image.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
teddy@teddy:~/Documents/works$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ |
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Check docker version: (https://docs.docker.com/engine/reference/commandline/cli/)
|
1 2 |
teddy@teddy:~/Documents/works$ sudo docker -v Docker version 18.09.2, build 6247962 |
Docker CE is installed and running. The docker group is created but no users are added to it. You need to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.
It’s important to manage docker for non-root user (https://docs.docker.com/install/linux/linux-postinstall/)
Create the docker group.
|
1 |
$ sudo groupadd docker |
Add your user to the docker group.
|
1 |
$ sudo usermod -aG docker $USER |
Logout and re-login so that your group membership is re-evaluated.
Verify that you can run docker commands without sudo.
|
1 |
$ docker run hello-world |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
teddy@teddy:~$ docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ |
Install Docker Compose
https://docs.docker.com/compose/install/
On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl command in your terminal to download the binaries. These step by step instructions are also included below. To ensure you have the latest version, check the Compose repository release page on GitHub.
|
1 |
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
Apply executable permissions to the binary:
|
1 |
$ sudo chmod +x /usr/local/bin/docker-compose |
Test the installation.
|
1 2 |
teddy@teddy:~$ docker-compose --version docker-compose version 1.23.2, build 1110ad01 |
For installing ImageMagic for Ubuntu 16.04, PHP7.2-FPM and NGINX. pls see http://www.mariorodriguez.co/2018/01/17/install-enable-imagick-on-ubuntu-16.04.html and https://askubuntu.com/questions/769396/how-to-install-imagemagick-for-php7-on-ubuntu
|
1 2 3 4 |
teddy@teddy:~$ sudo apt-get install php-imagick teddy@teddy:~$ php -m | grep imagick imagick teddy@teddy:~$ sudo gedit /etc/php/7.0/fpm/php.ini |
In /etc/php/7.0/fpm/php.ini file, insert ‘extension=imagick.so’ line. then save.
Restart php7.2-fpm and nginx
|
1 2 |
teddy@teddy:~$ sudo service php7.2-fpm reload teddy@teddy:~$ sudo service nginx restart |
Check the extension in phpinfo (http://localhost:8080/phpinfo.php)
Installation Vue StoreFront
To get started — first of all we need to install all projects on your local machine. Fortunately it’s very simple step because we do have CLI installer which installs vue-storefront and vue-storefront-api altogether.
First step is to get the VS from our github:
git clone https://github.com/DivanteLtd/vue-storefront.git vue-storefront
|
1 2 3 4 5 6 7 8 9 |
teddy@teddy:~/Documents/works$ git clone https://github.com/DivanteLtd/vue-storefront.git vue-storefront Cloning into 'vue-storefront'... remote: Enumerating objects: 278, done. remote: Counting objects: 100% (278/278), done. remote: Compressing objects: 100% (147/147), done. remote: Total 53218 (delta 145), reused 239 (delta 131), pack-reused 52940 Receiving objects: 100% (53218/53218), 36.88 MiB | 49.00 KiB/s, done. Resolving deltas: 100% (34882/34882), done. Checking connectivity... done. |
Go to the ‘vue-storefront’ directory
|
1 |
teddy@teddy:~$ cd Documents/works/vue-storefront/ |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn yarn install v1.13.0 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info There appears to be trouble with your network connection. Retrying... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning " > karma-webpack@3.0.5" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0". [5/5] Building fresh packages... Done in 96.86s. |
MAKE SURE YOU CHECK PORT 8080 (USUALLY IT BEING USED BY NGINX) BY ‘sudo netstat -plntu’. IF THE PORT IS BEING USED BY NGINX, PLS STOP IT FIRST ‘sudo service nginx stop’. PORT 8080 WOULD BE USED BY MAGENTO 2 BACKEND???
MAKE SURE YOU ALREADY ADD USER FOR DOCKER
<ERROR_YARN_INSTALLER_DOCKER_NON_ROOT>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn installer yarn run v1.13.0 $ node ./core/scripts/installer ┌─────────────────────────────────────────────────┐ │ Hi, welcome to the vue-storefront installation. │ │ Let's configure it together :) │ └─────────────────────────────────────────────────┘ ? Would you like to use https://demo.vuestorefront.io as the backend? No ? Please provide Git path (if it's not globally installed) git ? Please provide path for installing backend locally ../vue-storefront-api ? Choose path for images endpoint http://localhost:8080/img/ ? Please provide your magento url http://demo-magento2.vuestorefront.io ? Would You like to perform initial data import from Magento2 instance? No Trying to create log files... Cloning backend into '../vue-storefront-api'... Trying change directory to '../vue-storefront-api'... Working in directory '/home/teddy/Documents/works/vue-storefront-api'... Installing backend npm... Creating backend config 'config/local.json'... Starting docker in background... ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ERROR │ │ │ │ Error: Can't start docker in background. │ │ at Promise (/home/teddy/Documents/works/vue-storefront/core/scripts/installer.js:198:16) │ │ at new Promise (<anonymous>) │ │ at Backend.dockerComposeUp (/home/teddy/Documents/works/vue-storefront/core/scripts/installer.js:194:12) │ │ │ │ Please check log file for details: /home/teddy/Documents/works/vue-storefront/var/log/install.log │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
SOLUTION: ADD USER FOR DOCKER. SEE THE ABOVE REVISED DOCKER INSTALL!
</ERROR_YARN_INSTALLER_DOCKER_NON_ROOT>
RUN ‘yarn build’ BEFORE ‘yarn installer’. DONT FORGET REMOVE ‘vue-storefront-api’ DIRECTORY
|
1 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn build |
<ERROR_YARN_INSTALLER_STOREFRONT_NPM>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn installer yarn run v1.12.3 $ node ./core/scripts/installer ┌─────────────────────────────────────────────────┐ │ Hi, welcome to the vue-storefront installation. │ │ Let's configure it together :) │ └─────────────────────────────────────────────────┘ ? Would you like to use https://demo.vuestorefront.io as the backend? No ? Please provide Git path (if it's not globally installed) git ? Please provide path for installing backend locally ../vue-storefront-api ? Choose path for images endpoint http://localhost:8080/img/ ? Please provide your magento url http://demo-magento2.vuestorefront.io ? Would You like to perform initial data import from Magento2 instance? No Trying to create log files... Cloning backend into '../vue-storefront-api'... Trying change directory to '../vue-storefront-api'... Working in directory '/home/teddy/Documents/works/vue-storefront-api'... Installing backend npm... Creating backend config 'config/local.json'... Starting docker in background... Restoring data for ElasticSearch... Migrating data into ElasticSearch... Cloning Magento 2 Sample Data into 'var/magento2-sample-data'... Starting backend server... Trying change directory to '/home/teddy/Documents/works/vue-storefront'... Working in directory '/home/teddy/Documents/works/vue-storefront'... Creating storefront config 'config/local.json'... Build storefront npm... ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ERROR │ │ │ │ Error: Can't build storefront npm. │ │ at Promise (/home/teddy/Documents/works/vue-storefront/core/scripts/installer.js:478:16) │ │ at new Promise (<anonymous>) │ │ at Storefront.npmBuild (/home/teddy/Documents/works/vue-storefront/core/scripts/installer.js:474:12) │ │ at <anonymous> │ │ │ │ Please check log file for details: /home/teddy/Documents/works/vue-storefront/var/log/install.log │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘ error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
SOLUTION: https://docs.vuestorefront.io/guide/basics/recipes.html#how-to-prevent-an-error-can%E2%80%99t-build-storefront-npm
RUN: ‘yarn build’ BEFORE ‘yarn installer’.
</ERROR_YARN_INSTALLER_STOREFRONT_NPM>
WORKING!
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn installer yarn run v1.12.3 $ node ./core/scripts/installer ┌─────────────────────────────────────────────────┐ │ Hi, welcome to the vue-storefront installation. │ │ Let's configure it together :) │ └─────────────────────────────────────────────────┘ ? Would you like to use https://demo.vuestorefront.io as the backend? No ? Please provide Git path (if it's not globally installed) git ? Please provide path for installing backend locally ../vue-storefront-api ? Choose path for images endpoint http://localhost:8080/img/ ? Please provide your magento url http://demo-magento2.vuestorefront.io ? Would You like to perform initial data import from Magento2 instance? No Trying to create log files... Cloning backend into '../vue-storefront-api'... Trying change directory to '../vue-storefront-api'... Working in directory '/home/teddy/Documents/works/vue-storefront-api'... Installing backend npm... Creating backend config 'config/local.json'... Starting docker in background... Restoring data for ElasticSearch... Migrating data into ElasticSearch... Cloning Magento 2 Sample Data into 'var/magento2-sample-data'... Starting backend server... Trying change directory to '/home/teddy/Documents/works/vue-storefront'... Working in directory '/home/teddy/Documents/works/vue-storefront'... Creating storefront config 'config/local.json'... Build storefront npm... Starting storefront server... ┌───────────────────────────────────────────────────────────┐ │ Congratulations! │ │ │ │ You've just successfully installed vue-storefront. │ │ All required servers are running in background │ │ │ │ Storefront: http://localhost:3000 │ │ Backend: http://localhost:8080 │ │ │ │ Logs: /home/teddy/Documents/works/vue-storefront/var/log/ │ │ │ │ Good Luck! │ └───────────────────────────────────────────────────────────┘ Done in 155.67s. |
IF THE NODE JS SERVER IS STOPPED, START/RESTART IT AGAIN BY RUNNING: ‘yarn dev’ in ‘vue-storefront’ directory and ‘vue-storefront-api’ directory. Make sure nginx that use port 8080 is stopped (check port : sudo netstat -plntu)
|
1 2 |
teddy@teddy:~/Documents/works/vue-storefront$ yarn dev teddy@teddy:~/Documents/works/vue-storefront-api$ yarn dev |
Then to open the frontend (vue-storefront): http://localhost:3000/ –> OK. BUT WHEN I CLICK ANY LINK ON THE PRODUCT, I GOT ‘The product, category or CMS page is not available in Offline mode. Redirecting to Home.’
to open the backend (vue-storefront-api): http://localhost:8080/ –> NOT OK! I got this printed: Cannot GET /
http://localhost:8080/api –> printed: {“version”:”0.1.0″}






