Getting started

How to start using Legolas in 5 minutes?

Docker setup

Legolas uses Docker containers to provide Starters. Because of this, you need to configure docker to be accessible from your Linux user. To enable this, please proceed with the steps below.

  1. Add your Linux user to the docker group usermod -aG docker $(whoami)

  2. Restart your machine

Running an environment

Legolas supports three kinds of runtime environment: LOCAL, TEST and SERVER. An environment has some characteristics that differ from each other as shown in the table above.

Environment

Characteristics

LOCAL

Starters will be reused with the same container always. Bootstrappers and Migration will run normally.

TEST

Starters will be reused with different containers per JVM session and destroyed when JVM terminates. Bootstrappers and Migration will run normally.

SERVER

Starters will not run. Bootstrappers and Migration will run normally.

ExecutorService executorService = ...;
Properties properties = ...;
Promise<RunningEnvironment> promise = RuntimeEnvironment.LOCAL.start(executorService, properties);
RunningEnvironment environment = promise.get();

Legolas RuntimeEnvironment uses an ExecutorServiceinstance to manage the lifecycle components. The type of ExecutorService instance is up to you. The startup process is single-threaded.

Getting running instances

Starters and Bootstrappers are services that can be running in a docker container or as a JVM process and they have a unique ServiceId. For each Starter and Bootstrapper, there is a related RunningInstance where you can access the configurations. In the case of Bootstrappers if applicable, you can access the service instance itself. For a list of Starters and Bootstrappers, consult the Modules section.

Running Migrations

For each Legolas module, if applicable, there is a Migration implemented. For configuration details, follow in the Modules documentation.

Last updated

Was this helpful?