Skip to content

Commit

Permalink
Server module more skeletons were added
Browse files Browse the repository at this point in the history
  • Loading branch information
dspavlov committed Sep 20, 2018
1 parent c36a3a8 commit 5d8ddb0
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.db;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
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.slf4j.LoggerFactory;

import java.io.File;

public class Ignite2Configurer {
static void configLogger(File workDir, String subdir) {
LoggerContext logCtx = (LoggerContext) LoggerFactory.getILoggerFactory();

PatternLayoutEncoder logEncoder = new PatternLayoutEncoder();
logEncoder.setContext(logCtx);
logEncoder.setPattern("%-12date{YYYY-MM-dd HH:mm:ss.SSS} %-5level [%t] - %msg%n");
logEncoder.start();

RollingFileAppender rollingFa = new RollingFileAppender();
rollingFa.setContext(logCtx);
rollingFa.setName("logFile");
rollingFa.setEncoder(logEncoder);
rollingFa.setAppend(true);

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);
logFilePolicy.setParent(rollingFa);
logFilePolicy.setFileNamePattern(new File(logs, "logfile-%d{yyyy-MM-dd_HH}.log").getAbsolutePath());
logFilePolicy.setMaxHistory(7);
logFilePolicy.start();

//todo use logFilePolicy.getActiveFileName()

rollingFa.setRollingPolicy(logFilePolicy);
rollingFa.start();

Logger log = logCtx.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
log.setAdditive(false);
log.setLevel(Level.INFO);
log.detachAndStopAllAppenders();

log.addAppender(rollingFa);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Collection;
import java.util.Collections;

import ch.qos.logback.classic.LoggerContext;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
Expand All @@ -39,11 +38,6 @@
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.jetbrains.annotations.NotNull;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.core.rolling.RollingFileAppender;
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
import org.slf4j.LoggerFactory;

import static org.apache.ignite.ci.web.Launcher.waitStopSignal;
Expand Down Expand Up @@ -77,7 +71,6 @@ public static void main(String[] args) {
}

public static Ignite start() {

final File workDir = HelperConfig.resolveWorkDir();
configLogger(workDir);

Expand Down Expand Up @@ -145,42 +138,8 @@ private static void setupRegSize(DataRegionConfiguration regConf) {
}

private static void configLogger(File workDir) {
LoggerContext logCtx = (LoggerContext) LoggerFactory.getILoggerFactory();

PatternLayoutEncoder logEncoder = new PatternLayoutEncoder();
logEncoder.setContext(logCtx);
logEncoder.setPattern("%-12date{YYYY-MM-dd HH:mm:ss.SSS} %-5level [%t] - %msg%n");
logEncoder.start();

RollingFileAppender rollingFa = new RollingFileAppender();
rollingFa.setContext(logCtx);
rollingFa.setName("logFile");
rollingFa.setEncoder(logEncoder);
rollingFa.setAppend(true);

final File logs = new File(workDir, "tchelper_logs");
HelperConfig.ensureDirExist(logs);

rollingFa.setFile(new File(logs, "logfile.log").getAbsolutePath());

TimeBasedRollingPolicy logFilePolicy = new TimeBasedRollingPolicy();
logFilePolicy.setContext(logCtx);
logFilePolicy.setParent(rollingFa);
logFilePolicy.setFileNamePattern(new File(logs, "logfile-%d{yyyy-MM-dd_HH}.log").getAbsolutePath());
logFilePolicy.setMaxHistory(7);
logFilePolicy.start();

//todo use logFilePolicy.getActiveFileName()

rollingFa.setRollingPolicy(logFilePolicy);
rollingFa.start();

Logger log = logCtx.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
log.setAdditive(false);
log.setLevel(Level.INFO);
log.detachAndStopAllAppenders();

log.addAppender(rollingFa);
final String subdir = "tchelper_logs";
Ignite2Configurer.configLogger(workDir, subdir);
}

public static Ignite startClient() {
Expand All @@ -198,8 +157,12 @@ public static Ignite startClient() {
}

private static void setupDisco(IgniteConfiguration cfg) {
final TcpDiscoverySpi spi = new TcpDiscoverySpi();
final int locPort = 54433;
setupSinglePortDisco(cfg, locPort);
}

private static void setupSinglePortDisco(IgniteConfiguration cfg, int locPort) {
final TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setLocalPort(locPort);
spi.setLocalPortRange(1);
spi.setIpFinder(new LocalOnlyTcpDiscoveryIpFinder(locPort));
Expand Down
54 changes: 54 additions & 0 deletions tc-bot-server/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.
*/

apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
mavenCentral()
mavenLocal()
}

mainClassName = 'org.apache.ignite.ci.TcHelperDbLauncher'
applicationDefaultJvmArgs = ["-Dteamcity.helper.home=../work",
"-Dteamcity.bot.regionsize=16", // 16g Durable Memory region
"-server",
"-Xmx2g",
"-XX:+AlwaysPreTouch",
"-XX:+UseG1GC",
"-XX:+ScavengeBeforeFullGC",
"-XX:+UseStringDeduplication",
"-Djava.rmi.server.hostname=app02",
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.port=9011",
"-Dcom.sun.management.jmxremote.local.only=false",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false"]

distributions {

}

dependencies {
compile (project(":ignite-tc-helper-web")) {
transitive = false
}

}
14 changes: 14 additions & 0 deletions tc-bot-server/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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");
}
}

0 comments on commit 5d8ddb0

Please sign in to comment.