Package and shell
This commit is contained in:
parent
30a25c8aad
commit
8c87939d5e
|
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
|
||||
setlocal
|
||||
set COLLECOTR_PROCESS_TITLE=Skywalking-Collector
|
||||
set COLLECTOR_BASE_PATH=%~dp0%..
|
||||
set COLLECTOR_RUNTIME_OPTIONS="-Xms256M -Xmx512M"
|
||||
|
||||
set CLASSPATH=%COLLECTOR_BASE_PATH%\config;
|
||||
SET CLASSPATH=%COLLECTOR_BASE_PATH%\libs\*;%CLASSPATH%
|
||||
|
||||
if ""%JAVA_HOME%"" == """" (
|
||||
set _EXECJAVA=java
|
||||
) else (
|
||||
set _EXECJAVA="%JAVA_HOME%"/bin/java
|
||||
)
|
||||
|
||||
start /MIN "%COLLECOTR_PROCESS_TITLE%" %_EXECJAVA% "%COLLECTOR_RUNTIME_OPTIONS%" -cp "%CLASSPATH%" org.skywalking.apm.collector.boot.CollectorBootStartUp &
|
||||
echo Collector started successfully!
|
||||
|
||||
endlocal
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PRG="$0"
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
[ -z "$COLLECTOR_HOME" ] && COLLECTOR_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
|
||||
|
||||
COLLECTOR_LOGS_DIR="${COLLECTOR_HOME}/logs"
|
||||
JAVA_OPTS=" -Xms256M -Xmx512M"
|
||||
|
||||
if [ ! -d "${COLLECTOR_HOME}/logs" ]; then
|
||||
mkdir -p "${COLLECTOR_LOGS_DIR}"
|
||||
fi
|
||||
|
||||
_RUNJAVA=${JAVA_HOME}/bin/java
|
||||
[ -z "$JAVA_HOME" ] && _RUNJAVA=`java`
|
||||
|
||||
CLASSPATH="$COLLECTOR_HOME/config:$CLASSPATH"
|
||||
for i in "$COLLECTOR_HOME"/libs/*.jar
|
||||
do
|
||||
CLASSPATH="$i:$CLASSPATH"
|
||||
done
|
||||
|
||||
echo "Starting collector...."
|
||||
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} -classpath $CLASSPATH org.skywalking.apm.collector.boot.CollectorBootStartUp \
|
||||
2>${COLLECTOR_LOGS_DIR}/collector.log 1> /dev/null &"
|
||||
|
||||
retval=$?
|
||||
pid=$!
|
||||
FAIL_MSG="Collector started failure!"
|
||||
SUCCESS_MSG="Collector started successfully!"
|
||||
[ ${retval} -eq 0 ] || (echo ${FAIL_MSG}; exit ${retval})
|
||||
sleep 1
|
||||
if ! ps -p ${pid} > /dev/null ; then
|
||||
echo ${FAIL_MSG}
|
||||
exit 1
|
||||
fi
|
||||
echo ${SUCCESS_MSG}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@echo off
|
||||
|
||||
setlocal
|
||||
call "%~dp0"\collector-service.bat start
|
||||
endlocal
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PRG="$0"
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
EXECUTABLE=collector-service.sh
|
||||
|
||||
exec "$PRGDIR"/"$EXECUTABLE" start
|
||||
|
|
@ -12,6 +12,13 @@
|
|||
<artifactId>apm-collector-boot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<main.class>org.skywalking.apm.collector.boot.CollectorBootStartUp</main.class>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<docker.image.name>skywalking/${artifactId}</docker.image.name>
|
||||
<docker.image.version>${version}</docker.image.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
|
|
@ -54,4 +61,73 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>skywalking-collector</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>*.xml</exclude>
|
||||
<exclude>*.config</exclude>
|
||||
<exclude>*.yml</exclude>
|
||||
</excludes>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>${main.class}</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>${docker.plugin.version}</version>
|
||||
<configuration>
|
||||
<skipDocker>false</skipDocker>
|
||||
<imageName>${docker.image.name}</imageName>
|
||||
<imageTags>
|
||||
<imageTag>${docker.image.version}</imageTag>
|
||||
</imageTags>
|
||||
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${build.finalName}.tar.gz</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id></id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/libs</outputDirectory>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/bin</directory>
|
||||
<outputDirectory>/bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
<include>*.bat</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>logback.xml</include>
|
||||
</includes>
|
||||
<outputDirectory>/config</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<outputDirectory>/libs</outputDirectory>
|
||||
<includes>
|
||||
<include>${build.finalName}.jar</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -1,10 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_PATH" value="../logs" />
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${LOG_PATH}/skywalking-server-log4j2.log</file>
|
||||
<append>true</append>
|
||||
<immediateFlush>true</immediateFlush>
|
||||
<encoder>
|
||||
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.skywalking.apm.collector.agentstream.worker.storage.PersistenceTimer" level="INFO"/>
|
||||
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||
|
|
@ -12,5 +22,6 @@
|
|||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package org.skywalking.apm.collector.core.util;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -41,7 +42,8 @@ public class DefinitionLoader<D> implements Iterable<D> {
|
|||
while (urlEnumeration.hasMoreElements()) {
|
||||
URL definitionFileURL = urlEnumeration.nextElement();
|
||||
logger.info("definition file url: {}", definitionFileURL.getPath());
|
||||
properties.load(new FileReader(definitionFileURL.getPath()));
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(definitionFileURL.openStream()));
|
||||
properties.load(bufferedReader);
|
||||
|
||||
Enumeration defineItem = properties.propertyNames();
|
||||
while (defineItem.hasMoreElements()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue