Migrated from GitLab wiki
@@ -0,0 +1,157 @@
|
|||||||
|
(date written Nov 28, 2022)
|
||||||
|
|
||||||
|
**Setup**
|
||||||
|
|
||||||
|
For any developer, who want to setup eStack on his system must have some specific software installed with specific versions. eStack software don't run in host machine, but you need to setup a Virtual Machine using and have to run that inside that . To run eStack on host machine you may need to make lots of changes to software versions, in that case its better to run in virtual machine.
|
||||||
|
|
||||||
|
**Operating System**
|
||||||
|
|
||||||
|
In early days, we tried hard to setup eStack on windows machine, but honestly it is not that easy to make it running on the windows machine. We worked hard to setup that, but nothing worked out.
|
||||||
|
|
||||||
|
So, to run eStack you need to be very specific about machine and softwares. After trying all the things, we installed ubuntu 18.04 configured eStack on that, which worked quite smoothly. Ubuntu has released 22.10 but for eStack we need 18.04.
|
||||||
|
|
||||||
|
Well we never tested on latest versions, but its better if you keep 18.04 for the setup.
|
||||||
|
|
||||||
|
So, first you thing you need to have Ubuntu 18.04 installed on machine or if you have macbook, that need to be intel mac not M1 mac. Because M1 mac is not working well with the Virtualbox.
|
||||||
|
|
||||||
|
**Virtualbox**
|
||||||
|
|
||||||
|
Then second software you need to setup on machine is VirtualBox and that need to 6.0.24. Well here it may work with latest version, but once I upgraded the VirtualBox and all the things went down and system was not working vagrant box was not getting up. Then I installed that specific version 6.0.24 for VirtualBox and things started working fine back.
|
||||||
|
|
||||||
|
PS: I am sharing all these stories, because I have spent lots of time in figuring those things why this happened, so its better not to try these things just follow the specific versions and setups, so that system should start working without any issue on your system.
|
||||||
|
|
||||||
|
**Vagrant**
|
||||||
|
|
||||||
|
You need to have another software installed on your host machine is vagrant. eStack is configured using Vagrant box, and you will get one vagrant file in your setup through that eStack machine will get setup on the host machine. As of now latest version of the vagrant is 2.3.3, but I used Vagrant 2.2.9 on my host machine to run eStack. Although we never tried to update vagrant , it may work with latest version, but if latest is not working then switch back 2.2.9 vagrant version.
|
||||||
|
|
||||||
|
**These three are the main softwares you need to have on your system to run the eStack virtual machine.**
|
||||||
|
|
||||||
|
**GIT**
|
||||||
|
|
||||||
|
You need to have git binaries installed on your system to push pull eStack code from gitlab. Yes, eStack repositories resides on the gitlab and that is accessible with url git.estack.com. When you will make first pull from the gitlab after downloading the code you need to run the following command to start the machine:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd <estack-code-folder>
|
||||||
|
|
||||||
|
<estack-code-folder>$ vagrant up
|
||||||
|
```
|
||||||
|
|
||||||
|
You face an issue while fetching the code from Gitlab because you need some credentials and ssh-keys to get connected with the Gitlab. When you are added to Gitlab, you will get change to create your gitlab account, then a fter that, you have to add your public ssh key inside the gitlab.
|
||||||
|
|
||||||
|
To generate ssh keys, execute the following command and you will get ssh-keys generated and if you already have the keys generated, use the public key and save it inside the Gitlab.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ssh-keygen -t rsa
|
||||||
|
```
|
||||||
|
|
||||||
|
once key added to gitlab, you can easily clone the repository to your local system. After cloning repository execute the **vagrant up** command as explained above.
|
||||||
|
|
||||||
|
**Getting into the machine**
|
||||||
|
|
||||||
|
The first time you set up a machine, it will take time to download the vagrant box and setup it on your local. It may take 5 to 10 or more based on internet speed.
|
||||||
|
|
||||||
|
Once machine is fully ready you can get into the machine using the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ vagrant ssh
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command will connect you to the virtual machine through ssh. After getting into the machine you need to do following things step by step.
|
||||||
|
|
||||||
|
* Check if Composer is installed in the machine or not:
|
||||||
|
* if not installed just install that using the Composer documentation or apt-get install composer
|
||||||
|
* if already installed you also update this using composer selfupdate command
|
||||||
|
* Once your composer installed/updated move to folder estack
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd /estack
|
||||||
|
```
|
||||||
|
|
||||||
|
This is folder which is mapped inside the virtual machine to your local code folder. Run the composer install to install all the dependencies.
|
||||||
|
|
||||||
|
```
|
||||||
|
/estack$ composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
Sometimes ssh agent forwarding don't work right out of the box, in that case you will face some issue while downloading the dependencies. Because some packages are downloaded from the git.estack.com repository server.
|
||||||
|
|
||||||
|
In that case, you need to add ssh keys from inside the guest machine to gitlab as you have added for the host machine. Afterward if you will try installing dependencies, things will work smoothly.
|
||||||
|
|
||||||
|
Note: These are the basic steps to start the eStack machine, but if you get some issues, you may have to check that on the spot.
|
||||||
|
|
||||||
|
_PS: Don't try to update any version of the PHP, Mysql, Mariadb, Nginx etc. inside the virtual machine, it will immediately break the system._
|
||||||
|
|
||||||
|
Because inside the virtual machine PHP 7.2.24 is configured, and if you will try to upgrade the some of the packages and services from the code will stop working, because they are using standards of PHP 7.2.24.
|
||||||
|
|
||||||
|
**eStack Code**
|
||||||
|
|
||||||
|
**Framework: Zend Framework 2**
|
||||||
|
|
||||||
|
eStack is built on Zend Framework 2.5.3, This is very complex project, its not like other projects where you will get some forms, some emails code, some contact forms, some carts, some inventory. Nothing like that, eStack works on very different and unique style.
|
||||||
|
|
||||||
|
Most of code in eStack works on API and Services. eStack has vast codebase which is divided into separate modules, each module has its own features, working, services, forms, entities and many more.
|
||||||
|
|
||||||
|
The Main module of the application is PMS that is where from application initialises. You need to very careful while making any change into this module, because single wrong change in this module may break the complete application.
|
||||||
|
|
||||||
|
Every module is divided in eStack e.g.:
|
||||||
|
|
||||||
|
* Amazon related code in AmazonOrder module
|
||||||
|
* Ebay related code in EbayOrder Module
|
||||||
|
* Walmart related code in WalmartOrder
|
||||||
|
* Channel Accounts related code in ChannelAccount and many more
|
||||||
|
|
||||||
|
There are around 35 to 40 such modules, those are divided for code base and works together to make eStack and a big platform.
|
||||||
|
|
||||||
|
**Database ORM : Doctrine ORM 2**
|
||||||
|
|
||||||
|
eStack is using Doctrine ORM 2 to handle database related operations. To work with Doctrine ORM, you need to quite comfortable with Doctrine ORM, because eStack has advanced level of implementation of **Doctrine ORM 2**
|
||||||
|
|
||||||
|
e.g. Database inheritance mapping is used in application
|
||||||
|
|
||||||
|
* single table and class table both type of inheritance is used in the system
|
||||||
|
|
||||||
|
In eStack there is lots of work goes on in CLI mode, such as Order fetching, Order fulfillment, listings sync, MCF order processing and much more.
|
||||||
|
|
||||||
|
The following are some example of CLI commands, these are just for reference for actual commands check console routes in **module.config.php** files of different modules:
|
||||||
|
|
||||||
|
* bin/pms3 amazon fetch orders \[--custId=\] \[--minutesAgo=\] \[--acknowledged=\] \[--no-ack=\]' =\> 'Queue jobs to check for scheduled order reports for all active customer accounts, or if --custId is supplied, just for that account.',
|
||||||
|
* 'bin/pms3 amazon update orders \[--custId=\]' =\> 'Queue a PostFulfillmentFeed job for customer identified by --custId',
|
||||||
|
* 'bin/pms3 amazon fetch fba \[--custId=\] \[--since=\]' =\> 'Queue a job to pull in FBA Shipment/Order Data',
|
||||||
|
|
||||||
|
But to execute any command in the CLI you have to use **bin/pms3 \<command/console route\>** then it will execute and work properly.
|
||||||
|
|
||||||
|
On the other hand if you need to execute some doctrine migrations, you can use the command like below. Make sure you are inside virtual machine to execute all commands and migrations:
|
||||||
|
|
||||||
|
$ PMS_CUST_ID=cb vendor/bin/doctrine-multitenant-module orm:clear-cache:query
|
||||||
|
|
||||||
|
$ PMS_CUST_ID=cb vendor/bin/doctrine-multitenant-module orm:clear-cache:metadata
|
||||||
|
|
||||||
|
$ PMS_CUST_ID=cb vendor/bin/doctrine-multitenant-module orm:clear-cache:result
|
||||||
|
|
||||||
|
$ PMS_CUST_ID=cb vendor/bin/doctrine-multitenant-module migrations:diff
|
||||||
|
|
||||||
|
$ PMS_CUST_ID=cb vendor/bin/doctrine-multitenant-module migrations:migrate
|
||||||
|
|
||||||
|
These are the actual commands for database migrations, I used these alot while making migrations and while cleaning up cache.
|
||||||
|
|
||||||
|
'**cb**' is the instance for which you want to execute the commands. Yes, eStack is multi tenant application and every tenant has its own database, which gets created when a new instance is created.
|
||||||
|
|
||||||
|
**CRONS**
|
||||||
|
|
||||||
|
eStack runs so many crons after regular interval, those are pushed to supervisor job management service and they start getting executed one by one. So you need to have good understanding of Supervisord as well, if you need to make any of your new worker.
|
||||||
|
|
||||||
|
e.g. if I need to run amazon worker, I will do it like below
|
||||||
|
|
||||||
|
```
|
||||||
|
/estack$ bin/pms3 worker amazon
|
||||||
|
```
|
||||||
|
|
||||||
|
this will start the amazon worker which will start looking for jobs queued for this worker. same you can use for ebay and shopify as well.
|
||||||
|
|
||||||
|
To check this, you must have two terminals opened, One is running with the worker and another one to push the jobs by executing some commands as like below
|
||||||
|
|
||||||
|
```
|
||||||
|
/estack$ bin/pms3 amazon fetch spapi-orders
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will push jobs for each instance in the queue and worker will start processing those jobs, based on this jobs orders from amazon channels will be fetched and stored inside the eStack system for further processing.
|
||||||
Reference in New Issue
Block a user