GithubHelp home page GithubHelp logo

jimcreate78 / mage2vuestorefront Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vuestorefront/mage2vuestorefront

0.0 1.0 0.0 101 KB

Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront

Home Page: http://vuestorefront.io

License: MIT License

JavaScript 100.00%

mage2vuestorefront's Introduction

mage2vuestorefront

For those who would love to work with Magento on backend but use NoSQL power on the frontend. Two way / real time data synchronizer.

It's part of vue-storefront project - first Progressive Web App for eCommerce with Magento2 support.

Some details about the rationale and our goals here: https://www.linkedin.com/pulse/magento2-nosql-database-pwa-support-piotr-karwatka

It synchronizes all the products, categories and links between products and categories.

This is multi-process data synchronizer between Magento (and in further versions Shopify / other platforms) to local MongoDB AND ElasticSearch databases.

At this point synchronization works with following entities:

  • Products
  • Categories
  • Product-to-categories

Categories and Product-to-categories links are additionaly stored in Redis cache for rapid-requests (for example from your WebAPI). Our other project vue-storefront-api exposes this databse to be used in PWA/JS webapps.

Datasync uses oauth + magento2 rest API to get the data. KUE is used for job queueing and multi-process/multi-tenant processing is enabled by default MongoDB OR ElastiCsearch is used for NoSQL database Redis is used for KUE queue backend

By default all services are used without authorization and on default ports (check out config.js or ENV variables for change of this behavior).

Start Elasticsearch and Redis:

  • docker-compose up

Install:

  • cd src/
  • npm install

Config -see: config.js or use following ENV variables:

  • MAGENTO_URL
  • MAGENTO_CONSUMER_KEY
  • MAGENTO_CONSUMER_SECRET
  • MAGENTO_ACCESS_TOKEN
  • MAGENTO_ACCESS_TOKEN_SECRET
  • DATABASE_URL (default: 'mongodb://localhost:27017/rcom')

Run:

  • cd src/ and then:
  • node --harmony cli.js fullreindex - synchronizes all the categories, products and links between products and categories

Other commands supported:

  • node --harmony cli.js products --partitions=10
  • node --harmony cli.js products --partitions=10 --initQueue=false - run the products sync worker (product sync jobs should be populated eslewhere - it's used to run multi-tenant environment of workers)
  • node --harmony cli.js products --partitions=10 --delta=true - check products changed since last run (last run data is stored in mongodb); compared by updated_at field
  • node --harmony cli.js productcategories - to synchronize the links between products and categories it should be run before products synchronization because it populates Redis cache assigments for product-to-category link
  • node --harmony cli.js categories
  • node --harmony cli.js --adapter=magento --partitions=1 --skus=24-WG082-blue,24-WG082-pink products - to pull out only selected SKUs
  • node --harmony cli.js --adapter=magento --partitions=10 productsworker - run queue worker for pulling out individual products (jobs can be assigned by webapi.js microservice triggers; it can be called by webhook for example from within Magento2 plugin)
  • node --harmony webapi.js - run localhost:3000 service endpoint for adding queue tasks

WebAPI:

  • node --harmony webapi.js
  • curl localhost:8080/api/magento/products/pull/WT09-XS-Purple - to schedule data refresh for SKU=WT09-XS-Purple
  • node --harmony cli.js productsworker - to run pull request processor

Available options:

  • partitions=10 - number of concurent processes, by default number of CPUs core given
  • adapter=magento - for now only Magento is supported
  • delta - sync products changed from last run
  • command names: products / categories / productsworker / productcategories

mage2vuestorefront's People

Contributors

pkarw avatar mirkocesaro avatar

Watchers

Jim H avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.