Giter Site home page Giter Site logo

indigo-tutorial-payground's Introduction

todo

A basic Javascript agent.

Requirements

Docker Compose is already included in some distributions of Docker.

You can check versions by running:

$ docker version
$ docker-compose version

Your installation of Docker must bind containers to 127.0.0.1 in order for the agent user interface to work properly (which should already be the case if you are using a recent release of Docker).

To make sure that it is the case, check that the value of $DOCKER_HOST (or %DOCKER_HOST% on Windows) is not set:

$ echo $DOCKER_HOST # or echo %DOCKER_HOST% on Windows

Also make sure Docker is running properly:

$ docker run hello-world

If your installation of Docker requires root permissions, you can add your username to the docker group (you might need to restart your terminal after doing so).

Launch development server

To launch all the services locally, run:

$ strat up

The agent is bound to http://localhost:3000. It will automatically restart when a file is changed.

A web user interface for the agent is available on http://localhost:4000. You can use it to test and visualize your workflows. A web user interface for the Indigo node is also available on http://localhost:8000. You can use it to explore blocks and view transactions.

Press Ctrl^C to stop the services.

Note: While the agent will automatically restart if a file changes, you will have to run strat up again if you add NodeJS packages to package.json. During development, the segments will be saved to the ./segments directory. Make sure Docker is configured to allow mounting that directory. Note that the file storage adapter is very slow and only suited for development and testing.

Run tests

$ strat test

Project structure

The agent's files are in the ./agent directory.

Workflow actions

The actions are defined in ./agent/lib/actions.js. You can arrange your actions in different files then require() them if you want.

Tests

The tests are defined in ./agent/test/actions. You can also arrange them in different files if you prefer. The stratumn-mock-agent module is preinstalled for easy testing of actions.

During tests, the same store and fossilizer types used in development are launched. They are started in a different namespace so that they don't conflict with the development Docker containers.

Configuration

There are some configuration files in ./config that make it possible to define environment variables for the services, including your agent.

The variables defined in common.env are accessible by all services during development and testing.

The variables defined in common.secret.env work similarly, but will not be included in a Git repository so it is a good place to define more sensitive variables.

The variables defined in dev.env and dev.secret.env are only accessible during development.

The variables defined in test.env and test.secret.env are only accessible during testing.

License

See LICENSE file.

indigo-tutorial-payground's People

Contributors

clinejm avatar

Watchers

 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.