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

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 3027d04  Server module prepared, standalone start ok
3027d04 is described below

commit 3027d04f16b8c478e6b198cac9eae8064a2686bd
Author: Dmitriy Pavlov <dpav...@apache.org>
AuthorDate: Thu Sep 20 23:57:14 2018 +0300

    Server module prepared, standalone start ok
---
 build.gradle                                       |  5 ++
 ignite-tc-helper-web/build.gradle                  |  8 +--
 .../org/apache/ignite/ci/db/Ignite2Configurer.java | 63 ++++++++++++++++++-
 .../java/org/apache/ignite/ci/db/TcHelperDb.java   | 67 +++------------------
 jetty-launcher/build.gradle                        |  2 +-
 tc-bot-server/build.gradle                         |  9 ++-
 .../ignite/ci/TcBotIgniteServerLauncher.java       | 70 ++++++++++++++++++++++
 .../org/apache/ignite/ci/TcHelperDbLauncher.java   | 26 --------
 8 files changed, 154 insertions(+), 96 deletions(-)

diff --git a/build.gradle b/build.gradle
index e18073c..c08e5e1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -41,6 +41,11 @@ allprojects {
 
         ignVer = '2.6.0'
         //  ignVer = '2.7.0-SNAPSHOT'
+
+        guavaVer = '26.0-jre'
+
+        //dual-licensed under the EPL v1.0 (Category B list.) and the LGPL 2.1 
(category X).
+        logbackVer = '1.2.3'
     }
 
     repositories {
diff --git a/ignite-tc-helper-web/build.gradle 
b/ignite-tc-helper-web/build.gradle
index 70c4917..76e9f4e 100644
--- a/ignite-tc-helper-web/build.gradle
+++ b/ignite-tc-helper-web/build.gradle
@@ -28,7 +28,7 @@ repositories {
 
 // https://www.apache.org/legal/resolved.html#category-a
 dependencies {
-    compile group: 'com.google.guava', name: 'guava', version: '26.0-jre'
+    compile group: 'com.google.guava', name: 'guava', version: guavaVer
 
     compile group: 'org.apache.ignite', name: 'ignite-core', version: ignVer
     compile group: 'org.apache.ignite', name: 'ignite-slf4j', version: ignVer
@@ -36,10 +36,8 @@ dependencies {
     // MIT/X11 license, category A;
     compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
 
-    //dual-licensed under the EPL v1.0 (Category B list.) and the LGPL 2.1 
(category X).
-    def lbVer = '1.2.3'
-    compile group: 'ch.qos.logback', name: 'logback-core', version: lbVer
-    compile group: 'ch.qos.logback', name: 'logback-classic', version: lbVer
+    compile group: 'ch.qos.logback', name: 'logback-core', version: logbackVer
+    compile group: 'ch.qos.logback', name: 'logback-classic', version: 
logbackVer
 
     //Apache License Version 2.0
     compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
index 048a152..9dbc0b3 100644
--- 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
+++ 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/Ignite2Configurer.java
@@ -23,12 +23,19 @@ import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
 import ch.qos.logback.core.rolling.RollingFileAppender;
 import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
 import org.apache.ignite.ci.HelperConfig;
+import org.apache.ignite.ci.ITcHelper;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.jetbrains.annotations.NotNull;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.io.IOException;
 
 public class Ignite2Configurer {
-    static void configLogger(File workDir, String subdir) {
+    public static void configLogger(File workDir, String subdir) {
         LoggerContext logCtx = (LoggerContext) 
LoggerFactory.getILoggerFactory();
 
         PatternLayoutEncoder logEncoder  = new PatternLayoutEncoder();
@@ -45,7 +52,6 @@ public class Ignite2Configurer {
         final File logs = new File(workDir, subdir);
         HelperConfig.ensureDirExist(logs);
 
-        rollingFa.setFile(new File(logs, "logfile.log").getAbsolutePath());
 
         TimeBasedRollingPolicy logFilePolicy = new TimeBasedRollingPolicy();
         logFilePolicy.setContext(logCtx);
@@ -54,7 +60,9 @@ public class Ignite2Configurer {
         logFilePolicy.setMaxHistory(7);
         logFilePolicy.start();
 
-        //todo use logFilePolicy.getActiveFileName()
+        final String activeFileName = logFilePolicy.getActiveFileName();
+
+        rollingFa.setFile(new File(activeFileName).getAbsolutePath());
 
         rollingFa.setRollingPolicy(logFilePolicy);
         rollingFa.start();
@@ -66,4 +74,53 @@ public class Ignite2Configurer {
 
         log.addAppender(rollingFa);
     }
+
+    public static void setIgniteHome(IgniteConfiguration cfg, File workDir) {
+        try {
+            cfg.setIgniteHome(workDir.getCanonicalPath());
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+            cfg.setIgniteHome(workDir.getAbsolutePath());
+        }
+    }
+
+    @NotNull
+    public static DataRegionConfiguration getDataRegionConfiguration() {
+        final DataRegionConfiguration regConf = new DataRegionConfiguration()
+            .setPersistenceEnabled(true);
+
+        String regSzGb = System.getProperty(ITcHelper.TEAMCITY_BOT_REGIONSIZE);
+
+        if (regSzGb != null) {
+            try {
+                int szGb = Integer.parseInt(regSzGb);
+
+                String msg = "Using custom size of region: " + szGb + "Gb";
+                LoggerFactory.getLogger(Ignite2Configurer.class).info(msg);
+                System.out.println(msg);
+
+                regConf.setMaxSize(szGb * 1024L * 1024 * 1024);
+            }
+            catch (NumberFormatException e) {
+                e.printStackTrace();
+
+                LoggerFactory.getLogger(Ignite2Configurer.class).error("Unable 
to setup region", e);
+            }
+        } else {
+            String msg = "Using default size of region.";
+            LoggerFactory.getLogger(Ignite2Configurer.class).info(msg);
+            System.out.println(msg);
+        }
+        return regConf;
+    }
+
+    static DataStorageConfiguration 
getDataStorageConfiguration(DataRegionConfiguration regConf) {
+        return new DataStorageConfiguration()
+                .setWalMode(WALMode.LOG_ONLY)
+                .setWalHistorySize(1)
+                .setCheckpointFrequency(5 * 60 * 1000)
+                .setWriteThrottlingEnabled(true)
+                .setDefaultDataRegionConfiguration(regConf);
+    }
 }
diff --git 
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/TcHelperDb.java 
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/TcHelperDb.java
index 0d38baa..4384ea5 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/TcHelperDb.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/db/TcHelperDb.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.ci.db;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,8 +27,6 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.ci.HelperConfig;
-import org.apache.ignite.ci.ITcHelper;
-import org.apache.ignite.ci.IgniteTeamcityHelper;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.logger.slf4j.Slf4jLogger;
 import org.apache.ignite.spi.IgniteSpiContext;
@@ -46,8 +43,8 @@ import static 
org.apache.ignite.ci.web.Launcher.waitStopSignal;
  *
  */
 public class TcHelperDb {
-    /** Logger. */
-    private static final org.slf4j.Logger logger = 
LoggerFactory.getLogger(IgniteTeamcityHelper.class);
+       /** Logger. */
+    private static final org.slf4j.Logger logger = 
LoggerFactory.getLogger(TcHelperDb.class);
 
     public static void main(String[] args) {
         Ignite ignite = start();
@@ -72,27 +69,20 @@ public class TcHelperDb {
 
     public static Ignite start() {
         final File workDir = HelperConfig.resolveWorkDir();
-        configLogger(workDir);
+        Ignite2Configurer.configLogger(workDir, "tchelper_logs");
 
         final IgniteConfiguration cfg = new IgniteConfiguration();
-        setWork(cfg, workDir);
+        Ignite2Configurer.setIgniteHome(cfg, workDir);
 
         setupDisco(cfg);
         cfg.setConsistentId("TcHelper");
         cfg.setGridLogger(new Slf4jLogger());
 
+        final DataRegionConfiguration regConf = 
Ignite2Configurer.getDataRegionConfiguration();
 
-        final DataRegionConfiguration regConf = new DataRegionConfiguration()
-            .setPersistenceEnabled(true);
+        final DataStorageConfiguration dsCfg = 
Ignite2Configurer.getDataStorageConfiguration(regConf);
 
-        setupRegSize(regConf);
-
-        final DataStorageConfiguration dsCfg = new DataStorageConfiguration()
-            .setWalMode(WALMode.LOG_ONLY)
-            .setWalHistorySize(1)
-            .setCheckpointFrequency(5 * 60 * 1000)
-            .setWriteThrottlingEnabled(true)
-            .setDefaultDataRegionConfiguration(regConf);
+        dsCfg.setPageSize(4 * 1024);
 
         cfg.setDataStorageConfiguration(dsCfg);
 
@@ -109,39 +99,6 @@ public class TcHelperDb {
         return ignite;
     }
 
-    /**
-     * @param regConf Reg conf.
-     */
-    private static void setupRegSize(DataRegionConfiguration regConf) {
-        String regSzGb = System.getProperty(ITcHelper.TEAMCITY_BOT_REGIONSIZE);
-
-        if (regSzGb != null) {
-            try {
-                int szGb = Integer.parseInt(regSzGb);
-
-                String msg = "Using custom size of region: " + szGb + "Gb";
-                logger.info(msg);
-                System.out.println(msg);
-
-                regConf.setMaxSize(szGb * 1024L * 1024 * 1024);
-            }
-            catch (NumberFormatException e) {
-                e.printStackTrace();
-
-                logger.error("Unable to setup region", e);
-            }
-        } else {
-            String msg = "Using default size of region.";
-            logger.info(msg);
-            System.out.println(msg);
-        }
-    }
-
-    private static void configLogger(File workDir) {
-        final String subdir = "tchelper_logs";
-        Ignite2Configurer.configLogger(workDir, subdir);
-    }
-
     public static Ignite startClient() {
         final IgniteConfiguration cfg = new IgniteConfiguration();
 
@@ -170,16 +127,6 @@ public class TcHelperDb {
         cfg.setDiscoverySpi(spi);
     }
 
-    private static void setWork(IgniteConfiguration cfg, File workDir) {
-        try {
-            cfg.setIgniteHome(workDir.getCanonicalPath());
-        }
-        catch (IOException e) {
-            e.printStackTrace();
-            cfg.setIgniteHome(workDir.getAbsolutePath());
-        }
-    }
-
     public static void stop(Ignite ignite) {
         Ignition.stop(ignite.name(), false);
     }
diff --git a/jetty-launcher/build.gradle b/jetty-launcher/build.gradle
index 57b9977..0ae34b0 100644
--- a/jetty-launcher/build.gradle
+++ b/jetty-launcher/build.gradle
@@ -64,5 +64,5 @@ dependencies {
     compile group: 'org.eclipse.jetty', name: 'jetty-server', version: jettyVer
     compile group: 'org.eclipse.jetty', name: 'jetty-webapp', version: jettyVer
 
-    compile group: 'com.google.guava', name: 'guava', version: '22.0'
+    compile group: 'com.google.guava', name: 'guava', version: guavaVer
 }
diff --git a/tc-bot-server/build.gradle b/tc-bot-server/build.gradle
index 67922a2..31709d9 100644
--- a/tc-bot-server/build.gradle
+++ b/tc-bot-server/build.gradle
@@ -26,7 +26,7 @@ repositories {
     mavenLocal()
 }
 
-mainClassName = 'org.apache.ignite.ci.TcHelperDbLauncher'
+mainClassName = 'org.apache.ignite.ci.TcBotIgniteServerLauncher'
 applicationDefaultJvmArgs = ["-Dteamcity.helper.home=../work",
                              "-Dteamcity.bot.regionsize=16", // 16g Durable 
Memory region
                              "-server",
@@ -51,4 +51,11 @@ dependencies {
         transitive = false
     }
 
+    compile group: 'com.google.guava', name: 'guava', version: guavaVer
+
+    compile group: 'ch.qos.logback', name: 'logback-core', version: logbackVer
+    compile group: 'ch.qos.logback', name: 'logback-classic', version: 
logbackVer
+
+    compile group: 'org.apache.ignite', name: 'ignite-core', version: ignVer
+    compile group: 'org.apache.ignite', name: 'ignite-slf4j', version: ignVer
 }
\ No newline at end of file
diff --git 
a/tc-bot-server/src/main/java/org/apache/ignite/ci/TcBotIgniteServerLauncher.java
 
b/tc-bot-server/src/main/java/org/apache/ignite/ci/TcBotIgniteServerLauncher.java
new file mode 100644
index 0000000..0070dc9
--- /dev/null
+++ 
b/tc-bot-server/src/main/java/org/apache/ignite/ci/TcBotIgniteServerLauncher.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ci;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.ci.db.Ignite2Configurer;
+import org.apache.ignite.ci.db.TcHelperDb;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.logger.slf4j.Slf4jLogger;
+
+import java.io.File;
+import java.io.IOException;
+
+public class TcBotIgniteServerLauncher {
+    public static void main(String[] args) throws IOException {
+        final File workDir = HelperConfig.resolveWorkDir();
+        Ignite2Configurer.configLogger(workDir, "tcbot_srv_logs");
+
+        final IgniteConfiguration cfg = new IgniteConfiguration();
+        Ignite2Configurer.setIgniteHome(cfg, workDir);
+        cfg.setWorkDirectory(new File(cfg.getIgniteHome(), 
"tcbot_srv").getCanonicalPath());
+
+/*
+        setupDisco(cfg);*/
+        cfg.setConsistentId("tcbot");
+        cfg.setGridLogger(new Slf4jLogger());
+        System.err.println("Hello");
+
+
+        final DataRegionConfiguration regConf = 
Ignite2Configurer.getDataRegionConfiguration();
+
+        final DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+                .setWalMode(WALMode.LOG_ONLY)
+                .setWalHistorySize(1)
+                .setCheckpointFrequency(5 * 60 * 1000)
+                .setWriteThrottlingEnabled(true)
+                .setDefaultDataRegionConfiguration(regConf);
+
+        cfg.setDataStorageConfiguration(dsCfg);
+
+        System.out.println("Starting Ignite Server Node");
+
+        final Ignite ignite = Ignition.start(cfg);
+
+        System.out.println("Activating Ignite Server Node");
+
+        ignite.cluster().active(true);
+
+        System.out.println("Activate Completed");
+    }
+}
diff --git 
a/tc-bot-server/src/main/java/org/apache/ignite/ci/TcHelperDbLauncher.java 
b/tc-bot-server/src/main/java/org/apache/ignite/ci/TcHelperDbLauncher.java
deleted file mode 100644
index 81c2d99..0000000
--- a/tc-bot-server/src/main/java/org/apache/ignite/ci/TcHelperDbLauncher.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ci;
-
-import org.apache.ignite.ci.db.TcHelperDb;
-
-public class TcHelperDbLauncher {
-    public static void main(String[] args) {
-        System.err.println("Hello");
-    }
-}

Reply via email to