Whats App

Fast Guide to Install Spryker on Debian/ Ubuntu Linux Based Systems

Yes Soft 0 Comment
Post Image

The documentation has changed again in Spryker webpage, and I didn’t find it helpful especially for the native installation upon my linux system. So, in this blog I plan to fix that along with updating the last blog on some changes on the installation process. 

Here we go.

Preface

Spryker is the name of modality. With more than 700+ “modules” so far, each one has a specific job in mind connected via the facade design pattern. You can find more on their website.

Note: I’m using a modified version of Debian, but none of the commands is OS version specific. So, you can move along with no problem.

System Requirements

  • JDK (Java Development Kit V8 or Greater, But I recommend 5)
  • ElasticSearch 5, and version 5 of it specifically only so far.
  • PostgreSQL 11
  • MySQL (Optional) 
  • Jenkins
  • Redis server
  • PHP 7.2+ (I used PHP 7.3 in My installation) along with several extensions
  • Nginx or Apache
  • NodeJS v8 is not the pre-installed 10 in my case. Since NVM is Node Version Manager, it switches the default version of Node on the fly.
  • RabbitMQ

Installation Process

I will be using a lot of SH/BASH commands, but I will provide the source of that command -if possible- to make this blog as future proof as possible.

NVM Installation (NodeJS Installation)

From their github repo we can use the following command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

After that, we should restart the terminal.

Then, we install the proper version for Spryker which is 8.11.4 using the command:

nvm install 8.11.4

After some downloading we can use node -v to make sure we have the proper version. Note that we can switch between versions of node using nvm which will save us a lot of headache when dealing with different projects.

You can also use the binary package that suites provided by the link https://nodejs.org/en/blog/release/ and use this blog for installing from binaries: https://github.com/nodejs/help/wiki/Installation.

ElasticSearch Installation

It’s really hard to find the required release for Spryker, but you can find it in the link  https://www.elastic.co/downloads/past-releases/elasticsearch-5-6-16.  You’ll need the deb file, you can use rpm for fedora and RedHat-Linux Based systems.

To install the package you can execute the following command:

sudo dpkg -i elasticsearch-5.6.16.deb

Now you can start/stop the service using:

sudo systemctl start elasticsearch.service

sudo systemctl stop elasticsearch.service

If the service isn’t loaded yet (and it should be), then you’ll need to enable the service using:

sudo /bin/systemctl daemon-reload

sudo /bin/systemctl enable elasticsearch.service

GraphViz Installation

This one is pretty easy, just install it using apt:

sudo apt install graphviz

RabbitMQ Installation

Using apt:

sudo apt install rabbitmq-server

Redis Server

Easy peasy lemon squeezy:

sudo apt install redis-server

PHP with Extensions

If PHP is not installed we’ll install php-fpm in the system. This is done by executing:

sudo apt install php-fpm

Note that this is used for Nginx Config. If you plan to use Apache2, then the command would be:

sudo apt install php libapache2-mod-php

check the version of PHP using php –version. It should be above 7.2+. If not, use the following blog post to upgrade PHP. 

In my system it’s 7.3.12.

To install all the extensions needed just execute the command

sudo apt install php-curl php-json php-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 

If the pdo sql dependencies are not working or displaying an error, just delete them.

Cloning B2B/B2C Shops

Choose a directory that suits you and clone either one of these repos. I chose B2C and cloned it in the ~/spryker directory. So, get used to it. This is done by using the command (for completion sake):

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

Installing Jenkins

First, we should enable Jenkins PPA using the commands:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Then, we should update the apt list and add install Jenkins:

sudo apt update

sudo apt install jenkins

and voila, Jenkins is installed.

Now, you need to unlock it. But, I’ll save that to the config stage.

Configuring the System

These steps could be done in any order you like.

Starting Services

sudo systemctl start elasticsearch.service

sudo systemctl start jenkins

sudo systemctl start redis-server

sudo systemctl start rabbitmq-server

Configuring Jenkins

First, edit the port used by Jenkins by editing the file located in: /etc/default/jenkins and change the port located there from 8080 to 10007.

HTTP_PORT=8080 => HTTP_PORT=10007.

Restart the service using:

sudo systemctl restart jenkins

Then:

sudo less /var/lib/jenkins/secrets/initialAdminPassword

You’ll get a password to copy it and use it to start Jenkins.

Then, head to localhost:10007 using your browser and paste that password.

Configuring ElasticSearch

Run this command:

sudo vi /etc/elasticsearch/elasticsearch.yml

Then, un-comment the part in network about the port and change the port to: http.port: 10005

Configuring Redis

Make sure that the used port is 10009. You can find this setting in the file /etc/redis/redis.conf and it’s located in a section called network in the line about 69.

RabbitMQ

First, enable admin ui: 

rabbitmq-plugins enable rabbitmq_management

Then, start the server:

sudo systemctl start rabbitmq-server

After that, go to the link: localhost:15672, use guest for both username and password. 

  1. Go to admin tab
  2. Go to virtual hosts and add the following:
  3. AT_development_zed
  4. DE_development_zed
  5. US_development_zed
  6. The final product should be something like this.
  7. Go to users and add the following
  8. AT_development” as “management” with password mate20mg
  9. “DE_development” as “management” with password mate20mg
  10. “US_development” as “management” with password mate20mg
  11. “admin” as “administrator” with password mate20mg
  12. The final product should be something like this

And we’re almost done. What remains is just installing the B2C repo.

Correcting config files

There might be some errors with RabbitMQ Permissions, this is due to a config problem where an unnecessary “/” exists, to fix this download the config from this link.

And replace the files that exist in config/Shared folder or remove “/” yourself from every RabbitMQ config in the folder.

Installing the Software

Execute the following command in the repository:

ulimit -n 65535

vendor/bin/install -r development

Configuring Nginx

Use the following Nginx config:

For Yves

The original file is located under:

location / {

    if (-f $document_root/maintenance.html) {

        return 503;

    }

    if ($http_origin ~* "^(http|https)://(img[1234]|cdn|static|cms)\.") {

      add_header "Access-Control-Allow-Origin" $http_origin;

    }

    if ($request_method = OPTIONS) {

        return 200;

    }

    add_header X-Server $hostname;

    try_files $uri @rewriteapp;

}

For Zed

proxy_read_timeout 600s;

proxy_send_timeout 600s;

fastcgi_read_timeout 600s;

client_body_timeout 600s;

client_header_timeout 600s;

send_timeout 600s;

location ~ (/images/|/scripts|/styles|/fonts|/bundles|/favicon.ico|/robots.txt) {

    access_log        off;

    expires           30d;

    add_header Pragma public;

    add_header Cache-Control "public, must-revalidate, proxy-revalidate";

    try_files $uri =404;

}

location /payone/ {

    auth_basic off;

    add_header X-Server $hostname;

    try_files $uri @rewriteapp;

}

location / {

    try_files $uri @rewriteapp;

}

location @rewriteapp {

    # rewrite all to app.php

    rewrite ^(.*)$ /index.php last;

}

Categories : 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 :No 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.