Giter VIP home page Giter VIP logo

regi's Introduction

Regi

[ rej-ee ]

nuget Publish Package Run Tests

Regi is a "config-first" microservice orchestrator. The first iteration of this project was created to address the growing complexity of a microservice domain without adding vendor dependencies or cumbersome overhead. This project is still a work in progress, and is likely evolve over its lifetime; however, we are committed to always uphold the following standards:

  • Cross platform support: Regi is actively used on Windows, Mac, and Linux. We feel very strongly that the development of microservice architecture should be accessible to anyone, no matter their choice of platform or technology.
  • Painless configuration: Our goal is to make your life easier—you shouldn't have to toil with config files or bash scripts! With features such as auto-configuration and route injection, you can focus more on building software and less on how to integrate it.
  • Open source licensing: Regi is, and will always be, a free and open source project. Because of this, we are highly receptive to community feedback and contributions. If there's a feature that you'd like added, please submit an issue or a pull request.

Installation

NuGet

dotnet tool install -g regi

Building from source code

Powershell:

./build.ps1

Bash:

./build.sh

Configuration

Create a file named regi.json in a top-level directory with the following command:

regi init

Regi uses a discovery service in conjunction with a project identifier framework to automate the generation of the regi.json configuration file. At this time, the identifiers are shipped as part of the Regi.Core package; however, we plan to externalize this so that it is easy to add new identifiers or create your own.

Framework support

Regi currently supports the following frameworks:

  • .NET Core
  • NodeJS

There is ongoing work to add native support for a full suite of popular frameworks—please search for issues with the framework label to check the current state of this initiative. Additionally, we plan to offer an externalization API that could enable 3rd party "plugins" or allow frameworks to be configured within the regi.json file. If you have any ideas or strong feelings about the design of this API, please join the discussion and share your thoughts!

Usage

Regi is most commonly used as a .NET Core Global tool (i.e. a command line application). Detailed documentation is currently a work in progress, so please use the regi --help command for the most up-to-date documentation. The most common commands used in daily development are listed below:

  • regi start [project]

    This command will start every project or any projects that matches the project regular expression. It will also start any projects or services that these projects depend on.

  • regi test [project]

    This command will test every project or any projects that matches the project regular expression. If a project has any dependencies, it will start those before executing the tests. Tests are configured to run in parallel by default; however, any project can be configured to run serially by setting the serial property to true.

  • regi kill [project]

    This command will kill the processes for every project or any projects that matches the project regular expression. By default, Regi will track and kill the processes for every project on shutdown. However, nothing is ever perfect (especially regarding process IO) so this command is quite useful to cleanup any orphaned processes. Note: this command will kill all processes that match a given frameworks criteria. Because of this, it will also kill a dotnet.exe process that was started without Regi.

Samples

The most up-to-date examples can be found in the Sample Projects directory. Below is a simple example of what a regi.json configuration file might look like:

{
  "apps": [
    {
      "name": "frontend",
      "path": "./Frontend/",
      "framework": "node",
      "port": 3000,
      "commands": {
        "start": "run dev"
      }
    },
    {
      "name": "backend",
      "path": "./Backend/",
      "framework": "dotnet",
      "port": 5000,
      "arguments": {
        "*": [ "--foo bar" ]
      }
    }
  ],
  "tests": [
    {
      "name": "frontend-tests",
      "path": "./Frontend/",
      "framework": "dotnet",
      "type": "unit"
    },
    {
      "name": "backend-tests",
      "path": "./Backend/",
      "framework": "node",
      "type": "unit"
    },
    {
      "name": "integration-tests",
      "path": "./Frontend/",
      "framework": "node",
      "type": "integration",
      "serial": true,
      "commands": {
        "test": "run integration"
      }
    }
  ],
  "services": []
}

Note: The simplest way to generate one of these files is to run the regi init command at the top-level directory of your repository.

Contribution Instructions

dotnet pack --output ./
dotnet tool uninstall -g regi
dotnet tool install -g regi --add-source ./
dotnet nuget push

regi's People

Contributors

dependabot[bot] avatar tom-mckinney avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

regi's Issues

Add support for Ruby

We should make a Python implementation of FrameworkService to expand the use-cases for regi.

Print URL when an app starts

As a user, I should be able to click on a URL in the terminal to easily navigate to my running applications.

Today:

Frontend is now listening on port 8080

Next:

Frontend is now listening on port 8080 (http://localhost:8080/)

Add ability to restart/reload an instance of an application

I should be able to start all apps and services, and then restart one of those services from a separate commandline without disrupting the active regi process.

  • This feature requires the implementation of a RegiContext for regi-to-regi communication and collaboration

Add support for an external regi configuration

As a user, I should be able to define my regi.yml file in a central repository, and let my microservices reference it externally. This will allow me to have a single source of truth, but multiple repositories that reference it.

Desktop GUI

We should add a desktop GUI for more goodness.

  • Electron + Blazor?
  • WPF?

Resolve confusing configuration names

We should make the following changes to the configuration property names to resolve confusion:

  • required goes back to being optional
  • options becomes arguments
  • requires stays as requires

This should allow for better consistency in naming conventions and stops the double-dipping on property names.

Configurable log levels

As Tony, I should be able to set the log level for the console output to exclude/include warnings

Add support for Python

We should make a Python implementation of FrameworkService to expand the use-cases for regi.

Change configuration schema to support projects that are an app and a test

Change configuration schema to support projects that are both an app and a test (typical in JS projects).

Proposed Schema:

{
  "projects": [
    {
      "name": "Frontend",
      "framework": "npm",
      "paths": ["./src/frontend"],
      "roles": ["app", "test"]
    },
    {
      "name": "Backend",
      "framework": "dotnet",
      "paths": ["./src/backend/Backend"],
      "roles": ["app"]
    },
    {
      "name": "Backend.Test",
      "framework": "dotnet",
      "paths": ["./src/backend/Backend.Test"],
      "roles": ["test"]
    },
    {
      "name": "E2E-Tests",
      "framework": "npm",
      "paths": ["./src/e2e-tests"],
      "roles": ["test"],
      "labels": ["integration"],
      "serial": true,
      "rawOutput": true,
      "requires": [
        "Frontend",
        "Backend"
      ],
      "environment": {
        "Test:Stubs:Foo": false
      }
    }
  ]
}

Changes:

  • Add roles property as an array to specify the project's roles (i.e. "app", "test", etc.)
  • Add labels property as an array to specify arbitrary labels for filtering (i.e. "integration")
  • Remove type property as its function will be replaced by labels

DiscoveryService should support a project that is both an app and test

As a user, I want to be able to discover a project with the init command that is both an app and a tests. The typical use case for this is a React project where the convention to have components files adjacent to their spec files (in the same project).

  • This could be achieved by making every matched IIdentifier create and return a project. Then they would be used more specifically (ReactIdentifier, NodeIdentifier, JestIdentifier, etc.) without overlap
  • Another option is to instead have a separate discovery class with Project and Roles properties

Rename optional project property to required

We should rename the optional property in the project schema to required with a default value of true because the distinction between optional and options is unnecessarily confusing.

Separate Regi and Regi.CommandLine

We should separate the Regi project into Regi and Regi.CommandLine projects. This will allow for greater separation of concerns and a more flexible architecture.

Async execution

As Tony, I want my processes to execute async so that they do not clobber each other

Cleanup project structure for SRP

Cleanup the the project structure to better comply with the single-responsibility principal

Example:

regi
-  docs
-  samples
-  src
   -  Regi.Configuration
   -  Regi.Commandline
   -  Regi.Core
   -  Regi.Frameworks.Abstractions
   -  Regi.Frameworks.Dotnet
   -  Regi.Frameworks.Node
-  test
   -  Regi.Configuration.Test
   -  Regi.Commandline.Test
   -  Regi.Core.Test
   -  Regi.Frameworks.Dotnet.Test
   -  Regi.Frameworks.Node.Test

Add attribute for specifying FrameworkCommand

Add an attribute (i.e. FrameworkCommandAttribute) to map a IFramework method to a FrameworkCommand. This is useful because it vastly reduces the configuration needed for each framework and allows the framework configuration/logic to be encapsulated within the implementation of FrameworkBase.

Allow force option on init command

As a user, I would like to be able to pass a force option (-f or --force) to the init command to overwrite an existing config file.

  • This could be a generic inheritance of RegiOptions since other (but not all) commands could use this

Add support for retry handlers

There should be an easy way to configure retry handlers for either a specific framework or globally. One example is that .NET Core will always return CSC : error CS2012: Cannot open ... if a file is locked while running/testing in parallel. Regi should be able to pause and retry when it encounters this error.

Add an API for externalization of framework configuration

We should add an API for configuration externalization. This will benefit users because it enables frameworks/identifiers to be configured without a release of Regi.Core.

Potential implementations:

  • Plugin model (most likely shipped as NuGet packages)
  • Json configuration (in regi.json file)

Docker support

Regi should have first-class support for Docker and Docker Compose. This should include the following features:

  • Allow build/run/test of docker project types as well as a DockerIdentifier
  • Allow the docker projects to be defined separately but executed with a Docker Compose aggregate
  • An option to auto-generate Dockerfiles with a docker-compose.yml file on regi init?

Add support for Java

We should make a Java implementation of FrameworkService to expand the use-cases for regi.

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.