/MurmurationsServices

Index, Library and other microservices that implement the Murmurations protocol

Primary LanguageGoGNU General Public License v3.0GPL-3.0

Murmurations Services

This project is licensed under the terms of the GNU General Public License v3.0

GitHub Workflow Status Go Report Card

Run in production

We are utilizing Rancher to orchestrate the deployment of Murmurations services in Kubernetes clusters. For detailed instructions on setting up a Kubernetes cluster with Rancher and guidance on launching the index, library and other services that implement the Murmurations protocol, please refer to the Rancher-managed Kubernetes documentation.

Troubleshooting

For troubleshooting, please refer to Debugging Guide.

Run locally

Setup

  1. Install Docker Desktop and enable Kubernetes

  2. Install Helm

  3. Install NGINX Ingress Controller

  4. Install Skaffold

  5. Download large docker files

    docker pull elasticsearch:7.17.5
    docker pull kibana:7.17.5
  6. Create secrets for each service

  7. Add the following to your host file sudo vim /etc/hosts

    127.0.0.1   index.murmurations.developers
    127.0.0.1   library.murmurations.developers
    127.0.0.1   data-proxy.murmurations.developers

After completing the setup

  1. Run make dev to start services

  2. Try index.murmurations.developers/v2/ping, library.murmurations.developers/v2/ping and data-proxy.murmurations.developers/v1/ping

Setting up Pre-commit and custom git hooks for development

Note: Pre-commit is a linter to ensure consistent style, etc. Please use it before submitting pull requests to this repository.

  1. Install pre-commit on a Mac by running brew install pre-commit.

  2. Add pre-commit file and change permission.

    touch .git/hooks/pre-commit
    chmod +x .git/hooks/pre-commit
  3. Use vim .git/hooks/pre-commit to edit the pre-commit file.

    #!/bin/sh
    
    PASS=true
    
    # Run Newman
    make newman-test
    if [[ $? != 0 ]]; then
        printf "\t\033[31mNewman\033[0m \033[0;30m\033[41mFAILURE!\033[0m\n"
        PASS=false
    else
        printf "\t\033[32mNewman\033[0m \033[0;30m\033[42mpass\033[0m\n"
    fi
    
    if ! $PASS; then
        printf "\033[0;30m\033[41mCOMMIT FAILED\033[0m\n"
        exit 1
    else
        printf "\033[0;30m\033[42mCOMMIT SUCCEEDED\033[0m\n"
    fi
    
    exit 0
  4. Run pre-commit install to set up the git hook scripts in your local repository. You can safely ignore the "Running in migration mode with existing hooks" message.

Now, pre-commit will run automatically on git commit. If you want to manually run all pre-commit hooks on a repository, run pre-commit run --all-files.

Running E2E Tests Locally

  1. Ensure that you have nvm and Newman (npm install -g newman) installed.
  2. Execute the command make dev to set up the servers.
  3. Run the command make newman-test to initiate the end-to-end (E2E) tests.

Optional