Skip to content

Latest commit

 

History

History
87 lines (65 loc) · 1.39 KB

06-cart.MD

File metadata and controls

87 lines (65 loc) · 1.39 KB

Cart

Cart is a microservice that is responsible for Cart Service in RobotShop e-commerce portal.

Setup NodeJS repos. Vendor is providing a script to setup the repos.

curl -sL https://rpm.nodesource.com/setup_lts.x | bash

Install NodeJS

yum install nodejs -y

Configure the application.

Add application User

useradd roboshop

Lets setup an app directory.

mkdir /app

Download the application code to created app directory.

curl -L -o /tmp/cart.zip https://roboshop-builds.s3.amazonaws.com/cart.zip
cd /app 
unzip /tmp/cart.zip

Every application is developed by development team will have some common softwares that they use as libraries. This application also have the same way of defined dependencies in the application configuration.

Lets download the dependencies.

cd /app 
npm install 

We need to setup a new service in systemd so systemctl can manage this service

Setup SystemD Cart Service

vim /etc/systemd/system/cart.service
[Unit]
Description = Cart Service
[Service]
User=roboshop
Environment=REDIS_HOST=<REDIS-SERVER-IP>
Environment=CATALOGUE_HOST=<CATALOGUE-SERVER-IP>
Environment=CATALOGUE_PORT=8080
ExecStart=/bin/node /app/server.js
SyslogIdentifier=cart

[Install]
WantedBy=multi-user.target

Load the service.

systemctl daemon-reload
systemctl enable cart 
systemctl start cart