This is an automated email from the ASF dual-hosted git repository.

apkhmv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 2e24a00c19 IGNITE-19153 Fix docker compose (#1914)
2e24a00c19 is described below

commit 2e24a00c199c41f2562c98ee9fce552a36835561
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Fri Apr 7 10:38:38 2023 +0300

    IGNITE-19153 Fix docker compose (#1914)
---
 .../installation/installing-using-docker.adoc      | 26 ++++++++++++++++++----
 .../java/org/apache/ignite/app/IgniteRunner.java   | 24 +++++---------------
 packaging/docker/cluster.conf                      | 12 ++++++++++
 packaging/docker/docker-compose.yml                |  8 ++++---
 4 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/docs/_docs/installation/installing-using-docker.adoc 
b/docs/_docs/installation/installing-using-docker.adoc
index d7e7cce6e1..759b3bef3d 100644
--- a/docs/_docs/installation/installing-using-docker.adoc
+++ b/docs/_docs/installation/installing-using-docker.adoc
@@ -44,7 +44,23 @@ sudo docker run -it --rm -p 10300:10300 apacheignite/ignite3
 
 This command will launch a single Ignite node.
 
-To run multiple nodes, instead use a docker-compose file:
+To run multiple nodes, instead use a docker-compose file with cluster config 
file:
+
+[source,json]
+----
+{
+  network: {
+    port: 3344,
+    nodeFinder: {
+      netClusterNodes: [
+        "node1:3344",
+        "node2:3344",
+        "node3:3344"
+      ]
+    }
+  }
+}
+----
 
 ----
 version: "3.9"
@@ -54,23 +70,25 @@ name: ignite3
 x-ignite-def:
   &ignite-def
   image: apacheignite/ignite3:${IGNITE3_VERSION:-latest}
+  volumes:
+    - ./cluster.conf:/opt/ignite/etc/ignite-config.conf
 
 services:
   node1:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node1
+    command: --node-name node1
     ports:
       - 10300:10300
       - 3344:3344
   node2:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node2
+    command: --node-name node2
     ports:
       - 10301:10300
       - 3345:3344
   node3:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node3
+    command: --node-name node3
     ports:
       - 10302:10300
       - 3346:3344
diff --git 
a/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java 
b/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
index 255f985882..fdfd036676 100644
--- a/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
+++ b/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
@@ -24,33 +24,28 @@ import java.util.concurrent.ExecutionException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgnitionManager;
 import org.apache.ignite.internal.app.EnvironmentDefaultValueProvider;
-import org.apache.ignite.network.NetworkAddress;
 import picocli.CommandLine;
 import picocli.CommandLine.Command;
 import picocli.CommandLine.Option;
-import picocli.CommandLine.TypeConversionException;
 
 /**
- * The main entry point for running new Ignite node. Configuration values can 
be overridden using environment variables
- * or command-line arguments. Base configuration is either empty, or taken 
from the {@code --config-path}. Then,
- * if an environment variable with the pattern {@code IGNITE_VAR_NAME} (where 
VAR_NAME corresponds to {@code --var-name} command line
- * argument) is set, it overrides the value from the config. And last, if the 
{@code --var-name} command line argument is passed, it
- * overrides any other values.
+ * The main entry point for running new Ignite node. Command-line arguments 
can be provided using environment variables
+ * {@code IGNITE_CONFIG_PATH}, {@code IGNITE_WORK_DIR} and {@code 
IGNITE_NODE_NAME} for {@code --config-path}, {@code --work-dir} and
+ * {@code --node-name} command line arguments respectively.
  */
 @Command(name = "runner")
 public class IgniteRunner implements Callable<CompletableFuture<Ignite>> {
-    @Option(names = {"--config-path"}, description = "Path to node 
configuration file in HOCON format.", required = true)
+    @Option(names = "--config-path", description = "Path to node configuration 
file in HOCON format.", required = true)
     private Path configPath;
 
-    @Option(names = {"--work-dir"}, description = "Path to node working 
directory.", required = true)
+    @Option(names = "--work-dir", description = "Path to node working 
directory.", required = true)
     private Path workDir;
 
-    @Option(names = {"--node-name"}, description = "Node name.", required = 
true)
+    @Option(names = "--node-name", description = "Node name.", required = true)
     private String nodeName;
 
     @Override
     public CompletableFuture<Ignite> call() throws Exception {
-        // If config path is specified and there are no overrides then pass it 
directly.
         return IgnitionManager.start(nodeName, configPath.toAbsolutePath(), 
workDir);
     }
 
@@ -63,13 +58,6 @@ public class IgniteRunner implements 
Callable<CompletableFuture<Ignite>> {
     public static CompletableFuture<Ignite> start(String... args) {
         CommandLine commandLine = new CommandLine(new IgniteRunner());
         commandLine.setDefaultValueProvider(new 
EnvironmentDefaultValueProvider());
-        commandLine.registerConverter(NetworkAddress.class, value -> {
-            try {
-                return NetworkAddress.from(value);
-            } catch (IllegalArgumentException e) {
-                throw new TypeConversionException(e.getMessage());
-            }
-        });
         int exitCode = commandLine.execute(args);
         if (exitCode != 0) {
             System.exit(exitCode);
diff --git a/packaging/docker/cluster.conf b/packaging/docker/cluster.conf
new file mode 100644
index 0000000000..8551eea26f
--- /dev/null
+++ b/packaging/docker/cluster.conf
@@ -0,0 +1,12 @@
+{
+  network: {
+    port: 3344,
+    nodeFinder: {
+      netClusterNodes: [
+        "node1:3344",
+        "node2:3344",
+        "node3:3344"
+      ]
+    }
+  }
+}
diff --git a/packaging/docker/docker-compose.yml 
b/packaging/docker/docker-compose.yml
index 65c335120d..988c55717a 100644
--- a/packaging/docker/docker-compose.yml
+++ b/packaging/docker/docker-compose.yml
@@ -20,23 +20,25 @@ name: ignite3
 x-ignite-def:
   &ignite-def
   image: apacheignite/ignite3:${IGNITE3_VERSION:-latest}
+  volumes:
+    - ./cluster.conf:/opt/ignite/etc/ignite-config.conf
 
 services:
   node1:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node1
+    command: --node-name node1
     ports:
       - 10300:10300
       - 3344:3344
   node2:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node2
+    command: --node-name node2
     ports:
       - 10301:10300
       - 3345:3344
   node3:
     << : *ignite-def
-    command: --join node1:3344,node2:3344,node3:3344 --node-name node3
+    command: --node-name node3
     ports:
       - 10302:10300
       - 3346:3344

Reply via email to