Whats App

Spryker Installation Guide

Yes Soft 6 Comments
Post Image

Overview

We don’t live in a Linux Universe, not yet. As we are developers operating mainly from windows, there are some advantages you can gain, mostly game-wise. But there are major disadvantages, too.

These disadvantages are: having to sacrifice performance for virtualization as you try to use Virtual Box or Hyper-V to install a fully-fledged Linux System. Then, dealing with the Networking issues. Last but not the least, some problems with re-configure things on other devices.

We aren’t going to fix that, not entirely anyway. What we are trying to do in this tutorial is installing all-in software platform on your windows machine with main advantages:

  1. Low download sizes
  2. Minimal configuration on the networking side
  3. Faster performance in the future with no change in networking or additional configuration

This is achieved by using Windows own Linux terminal. Well, not just terminal but a Linux Kernel installed in its system named WSL (Windows Subsystem for Linux).

Software

  1. WSL (Windows Subsystem for Linux)
  2. Spryker

WSL (Windows Subsystem for Linux)

When the next windows version released (at the time of writing this it’s version 1903 Build Number 18990), It would be version 2 which improves IO performance drastically.

WSL is fairly new idea introduced in Windows 10 build number 16215 which is version 1607.

The main idea here is that you can use open source terminal software in Linux kernel with download size that is less than 250 MB.

You can start the “Linux System” just like a normal app. And install all your tools from it and use the system resources through the link “localhost” just like any windows service.

Spryker

Software developed by the Spryker team. It operates mainly in Germany and has a very large code “modules” reached 750 modules (at the time of writing this) which is used for E-Commerce objectives.

It has two suites totally; the shop suit and the Commerce OS suite which is directed to the banking systems. 

Tools

This based mainly on Spryker Installation Requirements.

  1. MySQL/PostgreSQL: Installed on the Windows which both is easier and performs better
  2. Jenkins: Again, on Windows, same reasons
  3. RabbitMQ: Windows
  4. Redis for Windows installed from here or you can use the subsystem, either way it’s fine.
  5. ElasticSearch: you should use version 5 for Spryker to work, download it from here. Installed on windows.
  6. Graphviz: Windows
  7. NodeJS: on the subsystem
  8. NPM: installed separately on the subsystem.
  9. Nginx: subsystem install

Setup Process

Here is where the magic happens.

Installing WSL

There are three main steps to do here:

  1. Enable Windows Subsystem in your Windows:
    a. Search for “Features”
    b. Go to “Turn Windows features on or off”
    c. Enable the Following:
    i. Windows Hypervisor Platform
    ii. Virtual Machine Platform (WSL 2 Required)
    iii. Windows Subsystem for Linux
  2. Install WSL
    a. Go to “Microsoft Store”
    b. Search For “Kali”
    c. The Linux group shows, install Kali/Debian
    This is because Ubuntu at the time of writing this supports up to PHP 7.2 FPM, Kali Supports PHP 7.3 without additional apt setup.
  3. Run the Subsystem and assign a password for the installation to finish. 

Installing Tools for WSL & Windows

Tools for Windows

MySQL:

Let’s start with databases: we tested the system with MySQL.

  1. Download MySQL from here. We tested with V8 but the system Spryker works just fine with 5.7 and higher.
  2. Make sure it works on the default port of 3306 and that it uses the standard authentication type.
  3. use the host ip 0.0.0.0 in my.ini in the installation folder.
  4. Add a new user named “development”, a DBA with the password of “mate20mg” and write them down when changing because it will be necessary later while configuring Spryker.

RabbitMQ

  1. Install erlang from here.
  2. Install RabbitMQ from here.

Jenkins

  1. Download from here
  2. Install it to run on port 10007 this is important, otherwise remember the port, you will need it later when configuring Spryker.
  3. Go to http://localhost:10007
  4. Follow the instruction and complete the download
  5. Now it’s done.

ElasticSearch

  1. Download from here. Note: DO NOT Use the 7 version, simply it won’t work with Spryker. If you want to use it for your own project, it will work perfectly.
  2. Go to the installation folder, then to the config file “elasticsearch.yml” 
  3. Edit the port number next to “http.port” and make it 10005.
  4. Start from “…/bin/elasticsearch.bat”.

Redis

Here we have 2 options; I tested the windows approach but in theory they are both easy and good.

  1. Windows approach:
    1. Download Redis from windows from here.
    2. Start the installation but don’t forget to specify the port to be 10009.
  2. Subsystem approach is described in the subsystem section.

Graph Viz:

  1. Download from here.
  2. Standard installation, nothing to configure here.

Tools for WSL

PostgreSQL

Download PostgreSQL, it depends basically on your distro. Command: “apt install postgresql”.

RabbitMQ 

  1. No need for erlang
  2. Install using this command “apt install rabbitmq-server”.

Vim

Since we will be editing a lot of stuff here, let’s start with installing the code editor.

  1. Execute the command “apt install vim”
  2. Voila, you have it

PHP FPM

I have installed Kali because it supports) PHP 7.3 by default (at the time of writing this. That’s why I’m going to use it. If you use another version of PHP, change the number, accordingly.)

  1. Execute the command “apt install php-fpm”
  2. And then this command: “apt-get install php-curl php-jsonphp-mysql php-pdo-sqlite php-sqlite3 php-gd php-intl php-mysqli php-pgsql php-ssh2 php-gmp php-mcrypt php-pdo-mysql php-readline php-twig php-imagick php-memcache php-pdo-pgsql php-redis php-xml php-bz2 php-mbstring” 
  3. Go the php config located in /etc/php/7.3/fpm
  4. Enable the following extensions:
    1. extension= bz2
    2. extension= curl
    3. extension= fileinfo
    4. extension= gd2
    5. extension= gettext
    6. extension= gmp
    7. extension= intl
    8. extension= imap
    9. extension= interbase
    10. extension= ldap
    11. extension= mbstring
    12. extension= exif  ; Must be after mastering as it depends on it
    13. extension= mysqli
    14. extension= openssl
    15. extension= pdo_mysql
    16. extension= pdo_pgsql
    17. extension= pdo_sqlite
    18. extension= pgsql
    19. extension= redis.so

To start the service, execute: “service php7.3-fpm start”

NodeJS

  • Spryker uses Node V8, Not 10 nor 12. Trust me, I’ve tried.
  • To install download the file from here. What you are looking for is linux-x64.tar.gz
  • Copy the file into ~ directory: “cp /mnt/c/…/node***.gz ~” while *** means to complete the name of the file.
  • Extract using the command “sudo tar -xJvf node-***.gz -C /usr/local/lib/nodejs”
  • To commit the Path change open the file “~/.bashrc” and add the following: PATH=/usr/local/lib/nodejs/node-v8***/bin:$PATH
  • export PATH
  • replace *** with the full folder name.

Restart wsl, and try “node -v”

NPM

Installed with Node

Nginx

Execute the following command: “apt install nginx”

GIT for linux

Yeah yeah, you figured it out. This command: “apt install git-all”

Configuring Tools for WSL & Windows

PostgreSQL Configuring for WSL

After Downloading PostgreSQL using the command: “apt install postgresql”, follow these two steps for configuring:

  1. Start PostgreSQL service. Command: “service postgresql start”.
  2. No need to install any users.

RabbitMQ Configuring for Windows

  1. Enable administration plugin
    1. Go to installation location.
    2. Run PowerShell/ CMD there: you can do it by holding “shift” while pressing right click.
    3. Type the command “rabbitmq-plugins.bat enable rabbitmq_management”
  2. Go to http://localhost:15672
  3. Use username “guest” and password “guest”
  4. Go to admin tab
  5. Go to virtual hosts and add the following
    1. AT_development_zed
    2. DE_development_zed
    3. US_development_zed
  6. The final product should be something like this
  7. Go to users and add the following
    1. “AT_development” as “management”
    2. “DE_development” as “management”
    3. “US_development” as “management”
    4. “admin” as “administrator” 
  8. Go to each user and assign the appropriate virtual host like: US_development > US_development_zed 
  9. Add all the virtual hosts to the user admin
  10. The final product should be something like this

Spryker Configurations

It was really a surprise to me how complex these configurations can get. Basically, you have a config folder that takes control of all the connections the platform needs. But the thing is, it’s configured in a way that prevent windows from running the thing no matter what. However, since we have a Linux kernel working for us let’s dig in.

The process goes like this:

  1. Clone the B2C/B2B suite.
  2. Composer install it. Based on the HDD/SSD speed you have and the internet speed this is gonna take a while.
  3. Config the platform.
  4. Install the platform.
  5. Config the Nginx
  6. The platform is installed, congrats.

OK, strap in, we start:

Clone the repo

Again, we have two options, either we use our basic windows drive, or we use the Linux one, I would recommend using Linux, since it uses optimized VHD disks images in the version 2. But I will describe both options.

Windows disk approach

This gives us advantage of licensing the editor we use. Since we are describing this tuts for Windows users they have licensed (or not 😊, i.e. they use VS Code) code editor software.

So, I shall clone the repo to “E:\Spryker” path.

The PowerShell script goes like this: (put in code area)

  1. “E:”
  2. “mkdir Spryker”
  3. “cd Spryker”
  4. “git clone https://github.com/spryker-shop/b2c-demo-shop.git
  5. Wait for 200 MB to download without interruption and that’s it
  6. This exact folder is located in the Linux kernel in the path “/mnt/e/Spryker” and will be used when configuring Nginx.

WSL disk approach

Ok, we start by creating the root directory for our site, and we config Nginx to use it. (put in code area)

1. “Mkdir -p /var/www/Spryker/”

2. “cd /var/www/Spryker”

3. “git clone https://github.com/spryker-shop/b2c-demo-shop.git

4. Wait for 200 MB to download uninterrupted, and you got it

Downloading the full platform

Basically, this is the easiest part of this. But before you do that remember to use the command “ulimit -n 65535”. You just got to go to the installation directory and execute the command “composer install”, additional extensions may be required, just enable it and you’re ok.

Configuring the platform

Ok, now we should start moving some stuff from inside the platform:

  1. Switch to MySQL (Optional)
  2. Correct RabbitMQ Links
  3. Correct Other Links

Switching to mysql (optional) 

The file we are looking for is located in the path: “…/config/Shared/config_default-development.php”

Change every “localhost” to “127.0.0.1” since MySQL doesn’t connect using “localhost”.Then change ZED_DB_PORT from 5432 to 3306, and change every PropelConstants::ZED_DB_ENGINE_PGSQL to PropelConstants::ZED_DB_ENGINE_MYSQL.

Correct RabbitMQ links h3

It’s very important to Remove the “/” from every RABBITMQ_CONNECTION_NAME

NGINX Configs

I downloaded the project in the directory /var/www/Spryker.loc, if you choose another folder, then change accordingly. The full files shall be available from here.

Spryker config Files Corrected

You can download from here.

Initiating the System

We need 3 steps here:

  1. Installing npm dependencies: “npm I” on the project root
  2. Starting the services from Windows and WSL
    1. Service postgresql start
    2. Service rabbitmq-server start (If on WSL)
    3. Service redis-server start (if on WSL)
    4. Service php7.3-fpm start
    5. Service nginx start
    6. Make sure Jenkins is working on Windows
    7. Make sure Elasticsearch 5 is working on Windows
  3. Initiate installation by executing vendor/bin/install -r development

Generating New Module

Type this command: “vendor/bin/console code:generate:module:yves HelloWorld” and voila it works.

Troubleshooting

Almost every error will happen right now, is IP related, so just change the IP from the config and the system should operate well.

Known Issues

  • Relatively low Performance with TLE form almost every connection on WSL, this is due to IO lag, improved on WSL2 to a good state (requests on zed takes 3-8 secs depending on complexity).
  • Network issues due to changing IP addresses for every reboot. It was fixed with me by installing VirtualBox and using 10.10.0.1 as a primary IP for connections.

Categories : Blog, e-commerce, ISHTAR, Spryker
Tags: ,

User Avatar
Yes Soft ( Yes Soft )

There Is No Biography


User Post Count: 20
User Profile Link: Yes Soft
« »

Comments Number :6 Comments


Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2020 Yes Soft - All right reserved.
Implemented By Yes Soft Team.