Skip to content

Latest commit

 

History

History
122 lines (87 loc) · 4.48 KB

quick-start.md

File metadata and controls

122 lines (87 loc) · 4.48 KB

Federated Gateway: Quick Start

This article explains how to run the Reaction Federated Gateway service locally for developing or testing. If you want to deploy the service to your Reaction installation, refer to the Deployment article instead.

Table of Contents

Prerequisite

Federated Gateway is just a single service in a larger e-commerce ecosystem that Reaction is creating. The easiest way to get up and running with the entire Reaction system is to use the Reaction Platform. We'll cover how to set it up with and without the Platform, but know the Platform is the preferred way to run the entire Reaction system locally.

You'll need at least the following.

Back to Top

Setup

Before we cover how to set up and run the service, let's briefly touch on what the Apollo Federation is and its relationship to Federated Gateway. TODO: add details

With Reaction Platform

TODO: add instructions on getting started with the Reaction Platform

Back to Top

With Docker Compose

Start by cloning the Federated Gateway repository.

git clone [email protected]:reactioncommerce/federated-gateway.git

Create any networks that you have not already created:

docker network create federation.reaction.localhost

All Reaction Commerce services use Docker and Docker Compose with a .env file to store environment configuration. If running outside of the Reaction Platform, create an .env file for a project by running bin/setup in that project's root directory.

NEVER commit the .env file to git.

Start our Federated Gateway service. We'll change into Federated Gateway's root directory, create a .env and start its Docker containers using docker-compose.

cd federated-gateway
bin/setup
docker-compose up

The initial download and build of these Docker artifacts can take a few minutes depending on your internet connection and host machine.

Back to Top

Configuration

Services are to be specified in the services.js config file. This is an export of an array of objects of the form { name: String, url: String }, where the url is a path to the graphql endpoint of the service being registered.

Back to Top

Up & Running

Start this service by building and running the Docker containers using the Docker Compose up command.

docker-compose up

TODO: add URL where service will be running

Back to Top

Endpoints

TODO: add endpoint URL

Back to Top

Command Cheatsheet

  • Start containers: docker-compose up
  • Stop containers: docker-compose stop
  • Rebuild containers: docker-compose up --build
  • Remove containers (deletes data!): docker-compose down
  • View container logs: docker-compose logs -f
  • Run linter: docker-compose run --rm federated-gateway npm run lint
  • Run test: docker-compose run --rm federated-gateway npm test
  • Run (same as docker-compose up): docker-compose run --rm --service-ports --use-aliases federated-gateway npm run start:debug
  • Run in debug mode: docker-compose run --rm --service-ports --use-aliases federated-gateway npm run start:debug
  • Run in watch mode: docker-compose run --rm --service-ports --use-aliases federated-gateway npm run watch
  • Run in watch and debug mode: docker-compose run --rm --service-ports --use-aliases federated-gateway npm run watch:debug

Back to Top

Next Steps

Back to Top