Spurtcommerce
DocumentAPI ReferenceAdd-ons
Docs
Docs
  • Overview
  • Getting Started
    • Introduction
    • Prerequisites
      • Server Configuration (Minimal)
      • Set up development environment
    • Development and Setup
      • API Setup
      • Environment Configuration
      • Store Front Setup
        • Angular Store Front
        • React Store Front
        • Flutter store front
      • Angular Admin Setup
      • Angular Vendor Setup
  • API Deployment and Setup
    • Deployment From Source Code
    • Deployment From Docker
    • Troubleshooting
  • Frontend Deployment Setup
    • Store Front Setup
      • React Store Front
      • Angular Store Front
      • Flutter Store Front
      • Troubleshooting
  • Front End Angular Admin Setup
    • Angular Admin
    • Troubleshooting
  • Front End Angular Vendor Setup
    • Angular Vendor
    • Troubleshooting
  • For Developers
    • Architecture
      • Back End API Architecture
      • Front-end Architecture
      • Technology stack
    • Performance
      • Benchmark
      • Image Optimzation
      • Load Balancing
      • RabbitMQ
      • Clustering
      • Database Load Balancing
    • Security
    • Testing Reports
      • Unit Testing Report
      • E2E Test Report
      • Vulnerability Test Report
        • Spurt Admin Report
        • Spurt Store Report
        • Spurt Vendor Report
      • Functional Test Report
  • How to Guides
    • Store Language Setup
    • Addon Management
    • Spurtcommerce Microservices Deployment
Powered by GitBook
On this page
  1. API Deployment and Setup

Deployment From Source Code

This is the step-by-step guide to help you set up the Backend API in your server, with which, all the API endpoints for Spurtcommerce Admin panel, Vendor panel and Storefront gets deployed.

PreviousAngular Vendor SetupNextDeployment From Docker

Last updated 6 months ago

Single Server Deployment in Ubuntu

In order to begin with Single Server deployment, you need to have the prerequisites ready in the Server .

If you have not installed required prerequisite software please install now following the link

Now, follow the steps to begin the deployment process:

  • Step 1 - Set up API following the link .

  • Step 2 - After building the source code in your local development machine, move the required folders listed below

demo/

dist/

sitemap/

package.json

views/

.env

  • Step 4- To install Node packages use the command

 npm i
  • Step 5- Change apache configuration and specify ProxyPass rules inside virtual host in 000-default.conf.

Run the following commands from system's root directory

 cd /etc/apache2/sites-available/




sudo nano 000-default.conf
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>


<Location /backend>
ProxyPass http://127.0.0.1:8000 ProxyPassReverse http://127.0.0.1:8000
</Location>

The port number that has been set up in .env has to entered in place of {PORT}

"ProxyPass http://127.0.0.1:{PORT} ProxyPassReverse http://127.0.0.1:{PORT}"

Then restart apache with below command

sudo service apache2 restart
  • Step 6- Click the link given below to install PM2. Skip if it is already installed.

Check whether you are having ecosystem.config.js in api folder. If it does not exist, then create the file and copy and paste the following code in that file

module.exports = {
  apps : [
      {
        name: "spurt",
        script: "dist/src/app.js",
        instances: "max",
        exec_mode: "cluster",
        env: {
            "PORT": 8000,
            "NODE_ENV": "production"
        }
      }
  ]
}

"PORT" : {your port number}

"NODE_ENV": {your env type}

  • Step 7- To run Api use pm2 command pm2 start

pm2 start
pm2 status

  • Step 7- After having followed the above steps correctly, you have successfully setup the API server. You can now open the browser and give this URL —

- http://<YOUR_IP_ADDRESS>/backend/api

check the API documentation with the URL

  • http://<YOUR_IP_ADDRESS>/backend/apidoc

Step 3- You have to edit your ENV file based on your infrastructure. please follow link to edit your env file.

For additional PM2 commands follow the referral link

Environment Configuration
https://www.npmjs.com/package/pm2
https://www.npmjs.com/package/pm2
Set up development environment
API Setup