- Introduction
- Renaming the repository
- Building and running with Docker locally
- Running NPL on Noumena Cloud & local services
- Running pipelines against NOUMENA Cloud
- NPL Development
- Next steps
The npl-integrations repo contains a sample project that demonstrates how to integrate with Noumena's Engine using different programming languages and frameworks. It includes a Python listener service, a Typescript React web app, and a Python Streamlit UI.
The underlying NPL code is an extension of the IOU, which can be found in the npl-starter repository.
Details about each component can be found in the corresponding README files in the respective directories.
To rename the repository, follow the steps below. Make sure to replace <new-project-name> with the desired name.
export PROJECT_NAME=<new-project-name>
perl -p -i -e's/npl-integrations/$(PROJECT_NAME)/g' `find . -type f`
perl -p -i -e"s/nplintegrations/$(shell echo $(PROJECT_NAME) | tr '[:upper:]' '[:lower:]' | tr -d '-')/g" `find . -type f`
cd .. && mv npl-integrations $(PROJECT_NAME);The project can be built and run locally using Docker Compose. To run the Noumena Engine, the corresponding Docker image is required, which is available under license. Please contact Noumena Digital for more information at info@noumenadigital.com
The npl-integrations project can be locally built and all containers run locally using Docker Compose.
Make sure the /etc/hosts file includes the line 127.0.0.1 keycloak
If the line is not present, add it by running echo "127.0.0.1 keycloak" | sudo tee -a /etc/hosts in the terminal.
Make sure the c:\Windows\System32\Drivers\etc\hosts file includes the line 127.0.0.1 keycloak and add it if missing.
To build and run the project, follow the steps below:
- Run
make installto build and generate NPL-API and clients. It also builds Python listener service, the Python Streamlit UI and the Typescript React frontend in addition to the Engine and its dependencies. - Run
make upto create and start the containers.
To stop the containers, run make down.
Once the project is running, services can be accessed with the following URLs:
| Service | URL |
|---|---|
| Engine APIs | http://localhost:12000/ |
| Swagger UI of Engine APIs | http://localhost:12000/ |
| Keycloak admin console | http://localhost:11000 |
| Webapp | http://localhost:8090 |
| Inspector | http://localhost:8070 |
Alternative to the local setup, NPL can be deployed on Noumena Cloud. Noumena offers a cloud-based environment for running NPL code, which can be accessed at portal.noumena.cloud.
In this setup, to allow a setup without Docker, the Python listener, Python Streamlit UI & Typescript React webapp are run as services outside of docker containers.
This setup includes running a Python listener, Python Streamlit UI & Typescript React webapp locally, and Noumena Engine on Noumena Cloud.
In this setup, NPL code runs on Noumena Cloud. Supporting services of the NPL Engine are deployed alongside the NPL Engine. Supporting services include Keycloak for authentication and authorization, and databases.
- Install the NPL CLI by running
make cliin the root directory. - Create an application on NOUMENA Cloud
- Create users on NOUMENA Cloud
- Log in the NPL CLI to NOUMENA Cloud by running
npl cloud login - Run
make clear-deployto clear pre-existing packages in the app and upload the current NPL and migration sources.
- Create a zip file by running the
make zipcommand in the root directory. A zip file will be created in thetargetdirectory. - In the Noumena Cloud UI, click on
Upload packagesand upload the zip file.
The ./python-listener folder contains a Python service interacting with the configured Engine.
In this setup, the Python listener service runs locally and connects to the Engine on Noumena Cloud.
To set up your Python venv, to generate the Python client from the NPL code and install python requirements, run
make python-listener-clientNote: the generated client need to be installed every time NPL code is changed as the generated code is installed as a package.
From the root directory, run
make python-listener-runTo stop the service, press Ctrl+C
To keep the service running and continue this walkthrough, open a new terminal window.
The ./webapp folder contains a Typescript frontend service for interacting with the configured Engine.
In this setup, the webapp runs locally and connects to the Engine on Noumena Cloud.
From the root directory, run
make webapp-clientto generate the webapp client from the NPL code and install webapp dependencies
From the root directory, run
make webapp-runTo stop the service, press Ctrl+C
To keep the service running and continue this walkthrough, open a new terminal window.
The ./streamlit-ui folder contains a frontend implemented in Python with the Streamlit library.
In this setup, the Streamlit UI runs locally and connects to the Engine on Noumena Cloud.
To generate the Python client from the NPL code and install python requirements, run
make streamlit-ui-clientNote: the generated client need to be installed every time NPL code is changed as the generated code is installed as a package.
From the root directory, run
make streamlit-ui-runTo stop the service, press Ctrl+C
To keep the service running and continue this walkthrough, open a new terminal window.
Once the project is running, services run behind the following URLs:
| Service | URL |
|---|---|
| Engine APIs | https://engine-$VITE_NC_TENANT_SLUG-$NC_APP_NAME.noumena.cloud |
| Swagger UI of Engine APIs | https://engine-$VITE_NC_TENANT_SLUG-$NC_APP_NAME.noumena.cloud/ |
| Keycloak admin console | https://keycloak-$VITE_NC_TENANT_SLUG-$NC_APP_NAME.noumena.cloud |
| Webapp | http://localhost:5173 |
| Streamlit UI | http://localhost:8501 |
For deployment or testing, the NPL CLI can be used in pipelines. An authorisation mode with services accounts is available for this use case.
- In the tenant page on NOUMENA Cloud, create a service account.
- In your github repo running the pipeline, set the
NPL_SERVICE_ACCOUNT_CLIENT_SECRETwith the provided client secret
After implementing the NPL code, tests can be run:
make npl-testOr run using the NPL-Dev plugin in IntelliJ.
You now know everything you need to know about NPL deployment in order to start developing your own applications on top of the Engine in your preferred language.
For more information about the Engine, please refer to the NPL documentation.
