Jolie Slicer is the companion tool to the Sliceable Monolith1 development methodology.
The tool (jolieslicer
) is available on npm:
npm install -g @jolie/slicer
Usage:
jolieslicer <monolith.ol> -c <slicer.json> [--slice <output_directory> | --simulate <service_name>]
-
The entire microservices architecture is coded in a single Jolie file (
monolith.ol
):- Services are parameterised by their deployment configuration (
config
) - Input and Output ports are parameterized by their deployment location available under the path
config.ServiceName.locations._
As an example:
service Gateway( config ) { inputPort ip { location: config.Gateway.locations._[0] ... } outputPort CommandSide { location: config.CommandSide.locations._[0] ... } main { ... } }
- Services are parameterised by their deployment configuration (
-
A configuration file (
slicer.json
) describes the services in the architecture and their ports:{ "Gateway": { "params": {}, "ports": [ 8080 ] }, "CommandSide": { "params": {}, "ports": [ "internal" ] }, ... }
Services provide their functionality through one or more ports, each declared as either:
- Internal (
"internal"
) and accessible only by services in the same deployment - Exposed (e.g.,
8080
) and accessible by external clients through a TCP socket
- Internal (
-
The Jolie Slicer can now be used to either:
- Run the microservices architecture as a single executable by specifying the name of the service that acts as the entry point of the application:
jolieslicer monolith.ol -c slicer.json --simulate Gateway
- Slice the monolith into separate codebases, one for each service mentioned in the configuration (
slicer.json
):and a reasonable docker-compose configuration for the distributed deployment of the architecture:jolieslicer monolith.ol -c slicer.json --slice <output_directory>
cd <output_directory> && docker compose up
- Run the microservices architecture as a single executable by specifying the name of the service that acts as the entry point of the application:
An example is provided under example/
:
monolith.ol
implements a Sliceable Monolithslicer.json
is the Slicer configurationmicroservices/
contains the result of slicing the monolith
From within the direcotry example
, one can:
- Run the monolith as a single executable:
jolieslicer monolith.ol -c slicer.json --simulate Main
- Run the service
Test
to locally execute an integration test:jolieslicer monolith.ol -c slicer.json --simulate Test
- Slice the monolith into separete codebases:
jolieslicer monolith.ol -c slicer.json --slice microservices