Skip to main content

Production Like Deployment ?

As you know, NotifyOne as been designed to suite the microservices architecture and runs as a group of services. We recommed that you deploy and manage each component individually as a microservice in production.

Each NotifyOne release contains compaitable components code as git sub-module and sub-modules are available at the root of NotifyOne codebase.

NotifyOne supports both stand-alone and container based deployments. We have already included Dockerfile for each NotifyOne component to ease out the container based deployments.

Prerequisites

  • Docker (for container based deployment) : your machine must have docker installed and running.
  • Python (for stand-alone deployment) - your machine must have python version >= 3.7 installed on it.

How to?

  • Clone the NotifyOne project

    • $ git clone https://github.com/tata1mg/notifyone.git
  • cd to notifyone directory

    • $ cd notifyone
  • Components are available as git submodule in the notifyone repo. So we need to init and update the submodules -

    • $ git submodule init
    • $ git submodule update

After updating the submodules, source code for Gateway, Core, Handlers and CMS components will be available inside ./notifyone-gateway, ./notifyone-core, ./notifyone-handler and ./notifyone-dashboard sub-directories respectively.

Above steps are common for all the components. We will now look into step-by-step guide to deploy each component individually.

Deploy Gateway

  • cd to notifyone-gateway sub-directory

    • $ cd notifyone-gateway
  • Generate config.json file

    • The config_template.json file included in the source code provides a template(actual keys, dummy values) for the actual config file. Please refer to the Gateway Configurations to know more about the configuration available. The actual config values specific to your environemnt have to be filled by you.

    • Steps

      • $ cp config_template.json config.json
      • Edit the newly created config.json file and update the values specific to your environment.
  • Stand-alone Deployment

    Use pipenv to create a virtual environment and run the service. Steps -

    • $ pip isntall pipenv (if not alread installed)
    • $ python3 -m pipenv shell
    • $ python3 -m pipenv install
    • $ python3 -m app.service
  • Container-based Deployment

    Here, we pre-assume that you have got docker installed on you system and it's up and running. Steps -

    • Build docker image
      • $ docker build . --tag notifyone-gateway --build-arg SERVICE_NAME=notifyone_gateway --build-arg SYS_PLATFORM=linux/amd64
    • Run docker image
      • $ docker run -p <service-host-port>:<service-container-port> --name notifyone-gateway --detach notifyone-gateway

Deploy Core

  • cd to notifyone-core sub-directory

    • $ cd notifyone-core
  • Generate config.json file

    • The config_template.json file included in the source code provides a template(actual keys, dummy values) for the actual config file. Please refer to the Core Configurations to know more about the configuration available. The actual config values specific to your environemnt have to be filled by you.

    • Steps

      • $ cp config_template.json config.json
      • Edit the newly created config.json file and update the values specific to your environment.
  • Stand-alone Deployment

    Use pipenv to create a virtual environment and run the service. Steps -

    • $ pip isntall pipenv (if not alread installed)
    • $ python3 -m pipenv shell
    • $ python3 -m pipenv install
    • $ python3 -m app.service
  • Container-based Deployment

    Here, we pre-assume that you have got docker installed on you system and it's up and running. Steps -

    • Build docker image
      • $ docker build . --tag notifyone-core --build-arg SERVICE_NAME=notifyone_core --build-arg SYS_PLATFORM=linux/amd64
    • Run docker image
      • $ docker run -p <service-host-port>:<service-container-port> --name notifyone-core --detach notifyone-core

Deploy Handlers

The repository code can be deployed as a single service that handles requests for all the channels. But, to better handle the scale, we have provisioned a multi-service deployment of handlers using the config.ENABLED_CHANNELS config key.

Based on your use case and expected load for a channel (number of notification requests for a channel) you can run multiple deployments of the code each handling requests for a particular channel or a set of channels.

Example usecase - let's say in your setup, there is considerable load for email and sms channels but comparatively less load for push and whatsapp. You can now choose to run 3 deployments here, 1st for email channel (config.ENABLED_CHANNELS: ["email"]), 2nd for sms channel (config.ENABLED_CHANNELS: ["sms"]) and 3rd for push and whatsapp channels (config.ENABLED_CHANNELS: ["push", "whatsapp"])

Irrespective of your choice to run handlers, the steps to deploy each handler deployment remains the same -

  • cd to notifyone-handler sub-directory

    • $ cd notifyone-handler
  • Generate config.json file

    • The config_template.json file included in the source code provides a template(actual keys, dummy values) for the actual config file. Please refer to the Handler Configurations to know more about the configuration available. The actual config values specific to your environemnt have to be filled by you.

    • Steps

      • $ cp config_template.json config.json
      • Edit the newly created config.json file and update the values specific to your environment.
  • Stand-alone Deployment

    Use pipenv to create a virtual environment and run the service. Steps -

    • $ pip isntall pipenv (if not alread installed)
    • $ python3 -m pipenv shell
    • $ python3 -m pipenv install
    • $ python3 -m app.service
  • Container-based Deployment

    Here, we pre-assume that you have got docker installed on you system and it's up and running. Steps -

    • Build docker image
      • $ docker build . --tag notifyone-handler --build-arg SERVICE_NAME=notifyone_handler --build-arg SYS_PLATFORM=linux/amd64
    • Run docker image
      • $ docker run -p <service-host-port>:<service-container-port> --name notifyone-handler --detach notifyone-handler

Deploy CMS

  • cd to notifyone-dashboard sub-directory

    • $ cd notifyone-dashboard
  • Stand-alone Deployment

    Use npm build and run the service. Steps -

    • $ npm start
  • Container-based Deployment

    Here, we pre-assume that you have got docker installed on you system and it's up and running. Steps -

    • Build docker image
      • $ docker build . --tag notifyone-dashboard --build-arg SERVICE_NAME=notifyone_dashboard --build-arg SYS_PLATFORM=linux/amd64
    • Run docker image
      • $ docker run -p <service-host-port>:<service-container-port> --name --name notifyone-dashboard --detach notifyone-dashboard