⛽ Servo
From Australian slang servo, which stands for service station, Servo is a backend middleware responsible for serving micro-lc configuration files, applying some useful parsing logic before returning their content. This logic is also distributed through an SDK to ease the process of building custom configurations serves.
On top of that, Servo distributes a CLI that can be used to automatically convert micro-lc configuration files from one version to another.
For a detailed description of the service capabilities, referer to the server and CLI official documentation.
Local development
To develop Servo locally you need:
- Node 16+
- Yarn 1.22+
To set up Node, please if possible try to use nvm, so you can manage multiple
versions easily. Once you have installed nvm, you can go inside the directory of the project and simply run
nvm install
, the .nvmrc
file will install and select the correct version if you don’t already have it.
Yarn can be installed globally running npm i -g yarn
.
Once you have all the dependency in place, you can launch:
yarn
yarn coverage
This two commands, will install the dependencies and run the tests with the coverage report that you can view as an HTML
page in coverage/lcov-report/index.html
.
Now create your local copy of the default values for the env
variables needed for launching the application.
cp ./default.env ./local.env
From now on, if you want to change anyone of the default values for the variables you can do it inside the local.env
file without pushing it to the remote repository.
Once you have all your dependency in place you can launch:
set -a && source local.env
yarn build:server
yarn start
and you will have the service exposed on your machine. In order to verify that the service is working properly you could launch in another terminal shell:
curl http://localhost:3000/-/ready
As a result the terminal should return you the following message:
{"name":"@micro-lc/servo","status":"OK","version":"0.2.1"}
Build a Docker container
The service Docker image can be build through provided Dockerfile, running
docker build --tag servo .
To start the container, you can use the run.sh script, running:
.scripts/run.sh