Previous Overview and Introduction
In our series on setting up the INFINI local environment:
- The first article, "Setting Up a Persistent INFINI Console and Easysearch Container Environment," explored how to use basic
docker runcommands to build the Console and Easysearch services step by step, with a focus on solving data persistence. - The second article, "Simplifying INFINI Console and Easysearch Environment Setup with Docker Compose," taught how to use Docker Compose's declarative configuration to simplify the definition and management of multi-container applications.
While Docker Compose has already significantly improved convenience, in real development and testing workflows, you may still need to handle more detailed requirements such as version selection, initial configuration copying, multi-node configurations, and metrics collection activation. To further encapsulate this complexity and provide a true one-click experience, we have developed a powerful Shell script called start-local.
This article will show you the capabilities of start-local, demonstrating how it elevates the setup and management of the Console and Easysearch (this article still uses Console 1.29.6 and Easysearch 1.13.0 as examples) local environment to a new level of convenience—just one command to get a fully functional, persistent local INFINI Console running environment.
start-local: Your Swiss Army Knife for the INFINI Console Local Environment
The start-local script (inspired by elastic/start-local) integrates many best practices for environment setup, aiming to provide an exceptional user experience. It still relies on Docker and Docker Compose in the background but hides the underlying complex configuration details from the user.
Core Features:
- Intelligent Version Management: Automatically fetches the latest stable versions of INFINI Console and Easysearch (or the version you specify) as default image tags.
- Dynamic Configuration Generation: Generates
.envanddocker-compose.ymlfiles based on command-line options provided by the user (such as number of nodes, password, version, etc.). - Automatic Initial Configuration Handling: Automatically extracts and sets initial configuration files from the Docker image when starting for the first time or if the local configuration directory does not exist.
- One-Click Lifecycle Management: Use simple commands (
up,down,logs,clean) to manage the application's startup, shutdown, log viewing, and complete cleanup. - Built-in Persistence: By default, all critical data (configuration, index data, logs) is persisted to the local
./startlocaldirectory (which can be configured). - Integrated Agent Metrics Collection: Enable Easysearch's metric collection through the
--metrics-agentoption and automatically configure it to point to INFINI Console. - Cross-Platform Design: Primarily designed to Linux and macOS environments.
How to Get and Use start-local
The easiest way to get and execute start-local is to use curl to pipe the script content directly to sh:
# Start with default settings (Console + 1 Easysearch node)
curl -fsSL http://get.infini.cloud/start-local | sh -s
# For a richer experience, try this:
# Start 3 Easysearch nodes, set a password, and enable metrics agent
curl -fsSL http://get.infini.cloud/start-local | sh -s -- up --nodes 3 --password "MyDevPass123." --metrics-agent
(Replace http://get.infini.cloud/start-local with the actual official script location)
The sh -s -- part ensures the script reads from standard input, and subsequent arguments are correctly passed to the script.
After the script runs, all operation files and persistent data are created and managed within the ./startlocal (default) subdirectory in the current directory.
Overview of start-local Commands and Options
You can view all supported features using the help command:
curl -fsSL http://get.infini.cloud/start-local | sh -s -- help
Here are some of the most commonly used commands and options:
Commands (COMMAND):
up: Core command. Creates and starts defined services. Handles initial configuration automatically.down: Stops services, removes containers, networks, and related anonymous volumes. Local persistent data remains unaffected.logs [service names...]: Views logs for specified services or all services in real-time.clean: Completely cleans up. After executingdown, deletes the entire working directory (./startlocaland all its contents).help: Displays help information.
Common Options (OPTIONS) (used mainly with up):
-cv TAG,--console-version TAG: Specifies the Console image version (e.g.,1.29.6).-ev TAG,--easysearch-version TAG: Specifies the Easysearch image version (e.g.,1.13.0).-n N,--nodes N: Number of Easysearch nodes (default is 1).-p PASSWORD,--password PASSWORD: Initial password for the Easysearch admin user (default isShouldChangeme123.).--services s1[,s2,...]: Specifies which services to start (possible values:console,easysearch). If unspecified, both are started by default.--metrics-agent: Enables Easysearch metrics collection agent.-wd PATH,--work-dir PATH: Customizes the working directory, replacing the default./startlocal.
Practical Operation Examples
Let’s explore a few examples to see how start-local simplifies things:
1. Start a standard development environment (Console + 1 Easysearch node, with metrics enabled)
curl -fsSL http://get.infini.cloud/start-local | sh -s
The script automatically handles all background tasks: checking dependencies, determining versions, creating a working directory, generating configuration files, copying initial configurations, building the docker-compose.yml, and finally starting the services and printing access addreses.
2. Start a 3-node Easysearch cluster, specifying versions and passwords
curl -fsSL http://get.infini.cloud/start-local | sh -s -- up \
--nodes 3 \
--password "ComplexP@ssw0rd." \
--console-version 1.29.6 \
--easysearch-version 1.13.0 \
--services easysearch,console
The script intelligently handles multi-node configurations and persistent directory structures.
3. View logs for all services
curl -fsSL http://get.infini.cloud/start-local | sh -s -- logs
4. Stop the running environment (use with caution)
curl -fsSL http://get.infini.cloud/start-local | sh -s -- down
This stops all running containers.
5. Delete the running environment (use with caution)
curl -fsSL http://get.infini.cloud/start-local | sh -s -- clean
This removes all related Docker resources and the local ./startlocal directory.
Persistence: Ensuring Data Security
One of the core designs of the start-local script is ensuring data persistence. All important configurations, data, and logs are mapped to structured subdirectories under the host machine's ./startlocal (or the directory you specify with -wd):
- Console:
./startlocal/console/{config,data,logs}/ - Easysearch (single node):
./startlocal/easysearch/{config,data,logs}/ - Easysearch (multi-node):
./startlocal/easysearch/node-X/{config,data,logs}/
This means you can down and up your environment at any time without worrying about losing any work.
Accessing the Services
After successful startup, the script prints the access addresses:
- INFINI Console:
http://localhost:9000(default host port) - INFINI Easysearch:
https://localhost:9200(default host port, useradmin, password set by you or default)
Summary: From Complexity to Simplicity, Focusing on Core Value
From complicated docker run commands to structured docker-compose.yml, and now to the convenient start-local script, we have gradually simplified the process of setting up and managing the INFINI local environment. start-local encapsulates all the underlying complexities, allowing you to have a fully functional, persistent local environment with just one command, so you can focus more on the actual functions of your application for testing, development, and learning.
This is the value of a good tool—making complex tasks simple, enabling us to be more efficient in creation.
We hope that this start-local script becomes a helpful tool in your daily workflow! If you have any suggestions or find issues, feel free to provide feedback through the project repository.