Giter VIP home page Giter VIP logo

commercetools-algolia-integration's Introduction

Enable data sync from Commercetools to Algolia

Contributing

Contributions are more than welcome! Please create a branch, commit your code and create a pull request. Please make sure you document your changes, and that you use conventional commit guidelines when commiting.

Structure

This repository comprises of two parts:

  1. A lambda function (commercetools-lambda)
  2. A terraform script (terraform-lambda-sns)

The lambda function code is needed for the terraform script, and it handles the processing and updating of a product into algolia.

The lambda currently does three things:

  • Parse the event and retrieve the commercetools product ID from the SNS message
  • Fetch the full product from Commercetools
  • Update the product inside algolia using save objects

The lambda currently only supports:

  • A product which is created/published in commercetools

The terraform script does three things:

  • Create a message queue (SNS) connected to a lambda in AWS
  • Create a subscription in commercetools to pass events to the message queue
  • Connect the subscription to the queue to the lambda so new products get added to algolia

Requirements

  1. AWS account + CLI
  2. Commercetools account
  3. Algolia account

Usage

In commercetools-lambda folder

  1. Rename .example.env to .env and add your own values where "XXXX" is specified

In terraform-lambda-sns folder

  1. Rename example.variables.tf to variables.tf, uncomment all lines and add your own values where "XXXX" is specified

  2. Ensure you have installed Terraform and configured it for use with AWS

  3. Run terraform init, then terraform plan to ensure the configuration is set up successfully, you will receive a view of everything that will be created.

  4. Run terraform apply to create all of the needed infrastructure on commercetools and AWS.

Testing the lambda event

You can test the lambda event locally using SAM in order to adjust the function to your specific needs. There is a sample event in the root of commercetools-lambda

  1. Make sure sam is installed locally

  2. In the commercetools-lambda directory, run sam local invoke -e example-event.json CommercetoolsLambda

Roadmap

Found in Github issues + projects

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.