Running
If you want to run evitaDB as a separate service on your server, you can use Docker. This chapter describes how to run evitaDB in Docker and how to configure it.
Install Docker
Pull and run image
When you start the evitaDB server you should see the following information in the console output:
Argument | Description |
---|---|
--name | gives a container a name evitadb. if you don't give the container a name, Docker will generate a random name for it. |
-i | keeps STDIN open - the container will run in the foreground, and you'll see the container's
standard/error output in the console. in the console, and you can stop the container by sending it
a terminal signal (usually the the key combination Ctrl+C, or Command+. on MacOS). |
--rm | removes the file system (data) created by evitaDB, by using this command there will be nothing left on your system when evitaDB is stopped, this argument is especially useful for testing purposes |
--net=host | instructs Docker to use directly host system network stack, this way evitaDB behaves as if it runs directly
on the host system network-wise, if the port configured in evitaDB configuration is already used on the
system, Evita fails to set up appropriate web API (see next chapter for port remapping or
evitaDB configuration for specifying open ports) |
Open / remap ports
The simplified command shares the network with the host, which is not always the best approach. You can selectively open/re-mapping ports opened inside the Docker container in the following way:
Argument | Description |
---|---|
-p | port remapping in the format host port:container port, so you could remap default ports opened by
evitaDB inside the container to different ports on the host system. |
Configure database persistent storage
For regular use, you'll probably want to specify the folder for storing evitaDB data and easily access it in the host's file system structure. You can specify any (initially) empty host folder to store the evitaDB database files:
The folder begins to fill with data as you create your first catalogs and collections of entities. The organisation of folder will look like this:
Each folder will contain one or more files representing the contents of the catalog.
Configure the evitaDB in the container
You can take advantage of all the following variables:
Variable name | Meaning |
---|---|
EVITA_CONFIG_FILE | path to configuration file, default: /evita/conf/evita-configuration.yaml |
EVITA_STORAGE_DIR | path to storage directory, default: /evita/data |
EVITA_CERTIFICATE_DIR | path to directory with automatically generated server certificates. Default: /evita/certificates |
EVITA_JAVA_OPTS | Java commandline arguments (list of basic arguments can be found here), default: none (empty string) |
EVITA_ARGS | evitaDB server command-line arguments, default: none (empty string) the list of all available arguments is given in the configuration file:
the format of the argument is visible in the variables ${argument_name:default_value} to pass an argument to a Java aplication, you need to prefix it with -D, the correct argument name for
variable ${storage.lockTimeoutSeconds:50} is -Dstorage.lockTimeoutSeconds=90 |
You can also provide the entire configuration YAML file using a special volume in the following way:
Check the container status
You can check the container status by running the `docker ps' command, and you'll see similar output:
Check statuses of the APIs
GraphQL
For GraphQL API run (applies to default evitaDB configuration):
this should return following confirmation about liveness status of the GraphQL API:
REST
For REST API run (applies to default evitaDB configuration):
this should return following confirmation about liveness status of the REST API:
Control logging
Restart an existing container
The running (and named) container can be stopped and restarted using the following commands:
Docker Compose
If you want to use evitaDB in orchestration with other services or your own Dockerised application, you can evitaDB in the Docker compose file. The basic configuration could look like this:
All previously documented options for using Docker apply to Docker Compose:
- use environment variables to configure evitaDB
- use volumes to set the data folder
- use ports for mapping ports in the docker composition