Giter Club home page Giter Club logo

cronstorm-opensource's Introduction

cronstorm-services

So this is my first fully functional SaaS

Except no one wants to pay for it, it seems.

So I'm open-sourcing it.

As an act of rebellion, or whatever.

At least now everyone has access to the code that can let them run a scalable, fault-tolerant, distributed task scheduling SaaS on AWS and GCP.

System Overview

There's 6 servies:

  • redis cache (ElastiCache) (pocketwatch-cache)
  • GCP Datastore (gstore)
  • Timekeeper (An EB SQS worker that runs the cron jobs and manages message delays) (pocketwatch-mechanism)
  • Supervisor (An EB SQS worker that manages the Timekeeper and makes sure all jobs that are supposed to be running are running and restarts any that have missed their calls)
  • An API services (the root director, cronstorm-services aka pocketwatch-api)
  • A one-off timer / web service (pocketwatch)

Setup

In order to get this up and running, you need to have AWS and GCP set up and clone this repository.

Internally I have 1 repo for each service and include them as submodules in each other for dependencies.

But here in this repo (cronstorm-services) it's just a recursive copy of everything, without submodule structure.

So the basic idea is to clone this mono repo, and then break out the various services into their own directories, and run eb init on them, and them eb deploy.

In the case of the GCP Datastore service (gstore) and the ElastiCache Redis service (pocketwatch-cache) you'll need to set those up in the respective CLIs/ consoles and input your own API keys (I've blacked out mine).

If you have Stripe, you can add your keys in there to allow people to pay you for this service. A basic subscription purchase flow is setup in this main repo.

Each service runs on "npm start". And the four non-storage services ( timekeeper, supervisor, api and web ) all run on EB ( the first two are worker nodes and the latter two are web server nodes ).

If you do go ahead and deploy this, you are on your own in terms of GCP / AWS setup. Just set things up and configure as you like. But it should all work as this is the copy I just deployed to production from.

So to recap, to set this up you need to clone this monorepo, and recursive copy each service into its own directory (except the storage services, you just need to set those resources up in AWS and GCP yourself, and add your keys / endpoints), and then EB deploy on the four services, two being workers, two being web servers.

It's all pretty simple, but I've stress tested the system extensively and it can gracefully handle load / degradation and still keep running, thanks the its fault-tolerant architecture.

Some of this capability depends on the configuration parameters you chooose for the SQS queues / workers, and the web servers. Anyway, if you know your way around AWS, this ought to be no problem.

A final note is the sm.js script runs in prestart to recurse submodules and run an npm install step there, since otherwise EB does not work / install dependencies, for submodules.

cronstorm-opensource's People

Contributors

o0101 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.