Reference implementation of LionWeb repository
To run the server you need two applications 1
- Run a Postgres server, easiest done through using docker. There are postgres images available, we are using Postgres 16.1
- Run the LionWeb server, easiest done through using
npx:
npx @lionweb/server-server@0.4.0 --run --config server-config.json You should ensure that the Postgress information in the server-config.json corresponds
with the Postgres you are running.
The database used for storage of models is Postgres, the easiest way to set up Postgres is through Docker.
The Postgres version currently being used is: postgres:16.1.
The .env file contains the user/database/port names and numbers being used.
The lionweb_properties.property, lionweb_containments.containment and lionweb_references.reference
fields are LionWeb metapointers.
We use pgAdmin 4 or the database plugin in WebStorm to test queries and look directly into the database.
Download docker image of postgres
docker pull postgres:16.1Create a container and run it
docker run --shm-size=1g -d --name lionwebrepodb -p 5432:5432 -e POSTGRES_PASSWORD=lionweb postgres:16.1If you start the Postgres container from Docker Desktop, ensure to give the following parameters:
- host port is 5432
- POSTGRES_PASSWORD = lionweb
Then initialize the lionweb-server from a terminal in the packages/server folder,
and run the server:
npm run dev-local-setup
npm run dev-local-devBuild the docker image for the lionweb-server
docker build . -t lionweb-serverRun docker images for postgres and lionweb-server
docker compose -f docker-local/compose.yaml upnpm install
npm run build
npm run lint
Ensure that Postgres is running.
If you have a local copy of the project from github,
the server is started with npm run dev-<???>-run in the packages/server folder:
For example:
cd packages/server
npm run dev-local-run
If you don't want to checkout the code, use npx:
npx @lionweb/server-server@0.4.0-beta.5 --run --config server-config.jsonMake sure that you have the server-config.json file locally and
that the values in the file correspons to your local situation.
For more information on how to configure the server, please check configuration.md.
Ensure the Postgres server and the LionWeb server are both running. Then do
npm run test
This server implements the full LionWeb Bulk API as defined in the LionWeb specification.
The server also implements the full LionWeb Delta protocol.
Contains code to manipulate the Postgres database (create, initialize)
The main LionWeb server. Manages the connections to the databases. Gets all apis from other packages.
Utility classes and functions shared by all other packages.
Utility classes and functionsfor logging server code.
Utility classes and functions for the postgres database connection.
These packages all provide an API with one or more functions.
The API's for the bulk protocol as specified in LionWeb.
Some additiona API functions.
API's to inspect the contents of the nodes table.
The API functions to add/remove LionWeb languages to the server. NOTE: not implemented yet, it is a placeholder.
Code for a TypeScript client for sending and receiving delta messages to/from the server.
Server side code for the delta protocol.
Shared code (like delta type definitions) for the delta protocol.
Tests for the core package
In GitHub actions a Postgres server is started on a host named postgres.
In your local development environment, this hostname is also being used.
You need to ensure that this hostname points to the Postgres server.
It is possible to specify a token to be expected by the server in each request (see configuration.md).
This mechanism is intended to make possible to expose the LionWeb server while providing a minimum level of
security. When the token is specified while launching the server, then each request to the server will be checked
for the presence of the same token in the Authorization header.
To release the lionweb server run the script scripts/tag-and-release-docker-image.sh from the root of the project.
The details of how this works and how to answer the questions being asked are described in the README.md in the scripts folder.
You can get the docker image from the Docker repository hosted by GitHub:
docker pull ghcr.io/lionweb-io/lionweb-server:latest
Alternatively you can specify a specific version
docker pull ghcr.io/lionweb-io/lionweb-server:release-lionweb-server-0.4.2
| Postgres Database | LionWeb Server | Admin UI | |
|---|---|---|---|
| Docker-compose 1 | Docker | Docker of released server | Docker of released admin UI |
| Docker-compose 2 | Docker | Docker of locally build sever | Docker of released admin UI |
| Docker-compose 3 | Docker | Docker of locally build sever | Docker of locally build admin UI |
| Docker + npx | Docker | npx @lionweb/server-server@latest | npx admin UI |
| In memory Postgres | Pglite | npx @lionweb/server-server@latest | npx admin UI |