Add a custom logic module to your app

This tutorial will show you how to add your existing backend service or frontend client to your Walhall app as a custom logic module.

Note: If your Walhall app uses BiFrost as an API gateway and you want to add your own backend service, then you need to complete the “Connect service to BiFrost” tutorial first.

Technical requirements

Currently, you can only create logic modules from code repositories that are hosted on GitHub.

Your logic module must satisfy these technical requirements before you can add it to your Walhall app:

Dockerfile

Your logic module repository must contain a Dockerfile that builds an image of the module.

Supported stacks

Currently, Walhall supports the following stacks:

Backend:

  • Django
  • Flask

Frontend:

  • Angular
  • React

Swagger documentation

If your logic module is a backend service, it must follow the OpenAPI (Swagger) specification and expose a Swagger file (swagger.json) at the /docs endpoint.

Implement Walhall CI/CD

First, you must create a .drone.yml file in the root of your logic module repository. You can find a template here.

Your service must also EXPOSE its content at port 8080. Example:

# Dockerfile
EXPOSE 8080
ENTRYPOINT ["bash", "/code/docker-entrypoint.sh"]

Add the logic module in Walhall

  1. Log in to Walhall and click on your app.
  2. In the box labeled “Add a custom module,” click Create Module.
  3. Enter a name for your module.
  4. Specify whether it’s a frontend or backend module and which stack it uses.
  5. Enter the URL to the GitHub repo for the logic module, including the username or organization name of the repo owner.
    Screenshot: Add a logic module to your app
  6. Click Create and Add.
  7. Now, go to the logic module’s GitHub repository and push a tag.

What happens next

Walhall will add your custom logic module to the Docker registry. It will then be deployable from the app overview page.

If you’re using BiFrost in your app, then BiFrost will auto-discover the logic module’s IP address and Swagger file and add the endpoints to your app’s API.

If you’re not using BiFrost, then the logic module will be assigned its own public URL.

Update logic module

To push an update to your logic module, just push a tag in GitHub. This will trigger the deployment process and the new version will become available in the Walhall UI. Note that you can always roll back to a previous version of a logic module by choosing it from the Version field and then clicking Deploy.