wildfire chat server source initial submit
This commit is contained in:
Executable
+106
@@ -0,0 +1,106 @@
|
||||
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
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>bundle-tar</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
<!--<format>dir</format>-->
|
||||
</formats>
|
||||
<includeBaseDirectory>false
|
||||
</includeBaseDirectory> <!-- disable the creation of root's distribution dir in the archive -->
|
||||
|
||||
<files>
|
||||
<!-- executables scripts-->
|
||||
<file>
|
||||
<source>src/main/scripts/wildfirechat.sh</source>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<fileMode>0755</fileMode>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/scripts/wildfirechat.bat</source>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/scripts/machinecode.sh</source>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/log4j.properties</source>
|
||||
<outputDirectory>config/</outputDirectory>
|
||||
<destName>log4j.properties</destName>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/wildfirechat.conf</source>
|
||||
<outputDirectory>config/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/hazelcast.xml</source>
|
||||
<outputDirectory>config/</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>src/main/resources/c3p0-config.xml</source>
|
||||
<outputDirectory>config/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/README.txt</source>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/sql/1_create_database.sql</source>
|
||||
<outputDirectory>sql/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/sql/2_create_table.sql</source>
|
||||
<outputDirectory>sql/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/sql/3_create_default_chatroom.sql</source>
|
||||
<outputDirectory>sql/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/sql/initialize_db.sh</source>
|
||||
<outputDirectory>sql/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/git.properties</source>
|
||||
<outputDirectory>config/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/resources/register.py</source>
|
||||
<outputDirectory>tools/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/h2/create_table.sql</source>
|
||||
<outputDirectory>h2/</outputDirectory>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>../broker/target/moquette-broker-${project.version}.jar</source>
|
||||
<outputDirectory>lib/</outputDirectory>
|
||||
<destName>moquette-broker-${project.version}.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
|
||||
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib/</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact> <!-- avoid inclusion of the artifact itself -->
|
||||
<excludes>
|
||||
<exclude>io.moquette:moquette-broker</exclude>
|
||||
</excludes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@@ -1,2 +1 @@
|
||||
To run the Moquette distribution, untar the archive and run the script bin/moquette.sh
|
||||
Moquette runs with JDK 8, tested with Oracle Java 8
|
||||
To run the Wildfire Chat distribution, untar the archive and run the script bin/wildfirechat.sh
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#*********************************************
|
||||
# ACL Format:
|
||||
# topic [read|write|readwrite] <topic name>
|
||||
#*********************************************
|
||||
topic write /sensors/anemometer
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?xml version ="1.0" encoding="UTF-8"?>
|
||||
<c3p0-config>
|
||||
<!-- This is default config! -->
|
||||
<default-config>
|
||||
<property name="initialPoolSize">10</property>
|
||||
<property name="maxIdleTime">30</property>
|
||||
<property name="maxPoolSize">100</property>
|
||||
<property name="minPoolSize">10</property>
|
||||
<property name="maxStatements">200</property>
|
||||
</default-config>
|
||||
|
||||
<!-- This is my config for mysql-->
|
||||
<named-config name="mysql">
|
||||
<!-- 指定数据库连接源的基本属性 -->
|
||||
<!--MySQL数据库驱动程序-->
|
||||
<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
|
||||
<!--MySQL数据库地址-->
|
||||
<property name="jdbcUrl">jdbc:mysql://localhost:3306/wfchat?useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true</property>
|
||||
<!--MySQL数据库用户名-->
|
||||
<property name="user">root</property>
|
||||
<!--MySQL数据库密码-->
|
||||
<property name="password">123456</property>
|
||||
<!-- 初始化连接池中的连接数,取值应在minPoolSize与maxPoolSize之间,默认为3-->
|
||||
<property name="initialPoolSize">10</property>
|
||||
<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。默认值: 0 -->
|
||||
<property name="maxIdleTime">30</property>
|
||||
<!--连接池中保留的最大连接数。默认值: 15 -->
|
||||
<property name="maxPoolSize">100</property>
|
||||
<!-- 连接池中保留的最小连接数,默认为:3-->
|
||||
<property name="minPoolSize">10</property>
|
||||
<!--c3p0全局的PreparedStatements缓存的大小。如果maxStatements与maxStatementsPerConnection均为0,则缓存不生效,只要有一个不为0,则语句的缓存就能生效。如果默认值: 0-->
|
||||
<property name="maxStatements">200</property>
|
||||
<!-- 当连接池连接耗尽时,客户端调用getConnection()后等待获取新连接的时间,超时后将抛出SQLException,如设为0则无限期等待。单位毫秒。默认: 0 -->
|
||||
<property name="checkoutTimeout">3000</property>
|
||||
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。默认值: 3 -->
|
||||
<property name="acquireIncrement">2</property>
|
||||
<!--定义在从数据库获取新连接失败后重复尝试的次数。默认值: 30 ;小于等于0表示无限次-->
|
||||
<property name="acquireRetryAttempts">0</property>
|
||||
<!--重新尝试的时间间隔,默认为:1000毫秒-->
|
||||
<property name="acquireRetryDelay">1000</property>
|
||||
<!--关闭连接时,是否提交未提交的事务,默认为false,即关闭连接,回滚未提交的事务 -->
|
||||
<property name="autoCommitOnClose">false</property>
|
||||
<!--c3p0将建一张名为Test的空表,并使用其自带的查询语句进行测试。如果定义了这个参数那么属性preferredTestQuery将被忽略。你不能在这张Test表上进行任何操作,它将只供c3p0测试使用。默认值: null -->
|
||||
<property name="automaticTestTable">Test</property>
|
||||
<!--如果为false,则获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常,但是数据源仍有效保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试获取连接失败后该数据源将申明已断开并永久关闭。默认: false-->
|
||||
<property name="breakAfterAcquireFailure">false</property>
|
||||
<!--每60秒检查所有连接池中的空闲连接。默认值: 0,不检查 -->
|
||||
<property name="idleConnectionTestPeriod">60</property>
|
||||
<!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。默认值: 0 -->
|
||||
<!--<property name="maxStatementsPerConnection"></property>-->
|
||||
</named-config>
|
||||
|
||||
|
||||
<!-- This is my config for oracle -->
|
||||
<named-config name="oracle">
|
||||
<property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
|
||||
<property name="jdbcUrl">jdbc:oracle:thin:@localhost:1521:orcl</property>
|
||||
<property name="user">scott</property>
|
||||
<property name="password">liang</property>
|
||||
<property name="initialPoolSize">10</property>
|
||||
<property name="maxIdleTime">30</property>
|
||||
<property name="maxPoolSize">100</property>
|
||||
<property name="minPoolSize">10</property>
|
||||
<property name="maxStatements">200</property>
|
||||
</named-config>
|
||||
</c3p0-config>
|
||||
@@ -0,0 +1,53 @@
|
||||
# -- coding: utf-8 --
|
||||
|
||||
import time
|
||||
import hashlib
|
||||
import random
|
||||
import requests
|
||||
|
||||
|
||||
|
||||
# 签名方法说明
|
||||
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
|
||||
# 值如下所示。
|
||||
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
|
||||
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
|
||||
|
||||
#需要用到requests库,首先要安装pip
|
||||
#sudo easy_install pip
|
||||
|
||||
#然后在安装requests module
|
||||
#sudo pip install requests
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Usage: python gettoken.py userid'
|
||||
sys.exit()
|
||||
|
||||
user = sys.argv[1]
|
||||
|
||||
SECRET_KEY = '123456'
|
||||
URL = 'http://localhost:18080/admin/user/token'
|
||||
|
||||
ts = (int(round(time.time() * 1000)))
|
||||
random.seed(time.time())
|
||||
nonce = (int(round(random.random() * 100000)))
|
||||
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
|
||||
sign = hashlib.sha1(orignSign).hexdigest()
|
||||
|
||||
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
|
||||
|
||||
payload = {'userId':user}
|
||||
|
||||
print 'headers:'
|
||||
print headers
|
||||
print
|
||||
print 'payload:'
|
||||
print payload
|
||||
print
|
||||
|
||||
r = requests.post(URL, headers = headers, json = payload)
|
||||
print 'response:'
|
||||
print(r.status_code)
|
||||
print r.content
|
||||
@@ -0,0 +1,53 @@
|
||||
# -- coding: utf-8 --
|
||||
|
||||
import time
|
||||
import hashlib
|
||||
import random
|
||||
import requests
|
||||
|
||||
|
||||
|
||||
# 签名方法说明
|
||||
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
|
||||
# 值如下所示。
|
||||
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
|
||||
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
|
||||
|
||||
#需要用到requests库,首先要安装pip
|
||||
#sudo easy_install pip
|
||||
|
||||
#然后在安装requests module
|
||||
#sudo pip install requests
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Usage: python getuserinfo.py userid'
|
||||
sys.exit()
|
||||
|
||||
user = sys.argv[1]
|
||||
|
||||
SECRET_KEY = '123456'
|
||||
URL = 'http://localhost/admin/user/info'
|
||||
|
||||
ts = (int(round(time.time() * 1000)))
|
||||
random.seed(time.time())
|
||||
nonce = (int(round(random.random() * 100000)))
|
||||
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
|
||||
sign = hashlib.sha1(orignSign).hexdigest()
|
||||
|
||||
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
|
||||
|
||||
payload = {'userId':user}
|
||||
|
||||
print 'headers:'
|
||||
print headers
|
||||
print
|
||||
print 'payload:'
|
||||
print payload
|
||||
print
|
||||
|
||||
r = requests.post(URL, headers = headers, json = payload)
|
||||
print 'response:'
|
||||
print(r.status_code)
|
||||
print r.content
|
||||
@@ -0,0 +1,15 @@
|
||||
#Generated by Git-Commit-Id-Plugin
|
||||
#Sat Mar 16 16:47:20 CST 2019
|
||||
git.commit.id.abbrev=80d2a9d
|
||||
git.commit.user.email=[email protected]
|
||||
git.commit.message.full=update\n
|
||||
git.commit.id=80d2a9d1c84db6f17845c6c43de6c84e6de2a913
|
||||
git.commit.message.short=update
|
||||
git.commit.user.name=heavyrain.lee
|
||||
git.build.user.name=heavyrain.lee
|
||||
git.commit.id.describe=v0.10-411-g80d2a9d-dirty
|
||||
git.build.user.email=[email protected]
|
||||
git.branch=IM
|
||||
git.commit.time=20190315085044
|
||||
git.build.time=20190316164720
|
||||
git.remote.origin.url=https\://github.com/heavyrain2012/wildfirechat.git
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
<hazelcast
|
||||
xsi:schemaLocation="http://www.hazelcast.com/schema/config
|
||||
http://www.hazelcast.com/schema/config/hazelcast-config-3.5.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>wfc-pro</name>
|
||||
</group>
|
||||
|
||||
<network>
|
||||
<join>
|
||||
<multicast enabled="true"/>
|
||||
</join>
|
||||
</network>
|
||||
|
||||
<!-- map eviction -->
|
||||
<!-- http://docs.hazelcast.org/docs/latest-development/manual/html/Distributed_Data_Structures/Map/Map_Eviction.html -->
|
||||
<map name="messages_map">
|
||||
<!-- 7 days -->
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.MessageLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<map name="groups_map">
|
||||
<!-- 7 days -->
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.GroupLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<map name="users">
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.UserLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<map name="user_status">
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.UserStatusLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<set name="node_ids"/>
|
||||
|
||||
<multimap name="user_setting">
|
||||
</multimap>
|
||||
|
||||
<multimap name="group_members">
|
||||
</multimap>
|
||||
|
||||
<map name="chatrooms">
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.ChatroomLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<map name="user_chatroom">
|
||||
</map>
|
||||
|
||||
<map name="robots">
|
||||
<!-- 7 days -->
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.RobotLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<map name="things">
|
||||
</map>
|
||||
|
||||
<multimap name="user_robots">
|
||||
</multimap>
|
||||
|
||||
<multimap name="user_things">
|
||||
</multimap>
|
||||
|
||||
|
||||
<multimap name="chatroom_members">
|
||||
</multimap>
|
||||
|
||||
<multimap name="user_friends">
|
||||
</multimap>
|
||||
|
||||
<multimap name="user_friends_request">
|
||||
</multimap>
|
||||
|
||||
<map name="channels_map">
|
||||
<!-- 7 days -->
|
||||
<time-to-live-seconds>604800</time-to-live-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="PER_NODE">1000000</max-size>
|
||||
<eviction-percentage>10</eviction-percentage>
|
||||
<map-store enabled="true">
|
||||
<class-name>io.moquette.persistence.ChannelLoader</class-name>
|
||||
<write-delay-seconds>0</write-delay-seconds>
|
||||
</map-store>
|
||||
</map>
|
||||
|
||||
<multimap name="channel_listeners">
|
||||
</multimap>
|
||||
|
||||
</hazelcast>
|
||||
Regular → Executable
+41
-15
@@ -1,47 +1,73 @@
|
||||
log4j.rootLogger=ERROR, stdout, file
|
||||
# Set root logger level to DEBUG and its only appender to A1.
|
||||
#log4j.rootLogger=ERROR, A1
|
||||
#log4j.rootLogger=INFO, stdout, file
|
||||
log4j.rootLogger=INFO, file, messagelog
|
||||
|
||||
log4j.logger.io.moquette=INFO
|
||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessor=INFO
|
||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessorBootstrapper=WARN
|
||||
|
||||
#Protocol parsing
|
||||
log4j.logger.io.moquette.integration.netty.NettyMQTTHandler=WARN
|
||||
#log4j.logger.io.moquette.integrationation.netty.NettyMQTTHandler=DEBUG
|
||||
log4j.logger.io.moquette.server.netty.NettyMQTTHandler=WARN
|
||||
#log4j.logger.io.moquette.server.netty.NettyMQTTHandler=DEBUG
|
||||
log4j.logger.io.moquette.parser.netty=WARN
|
||||
#Storage integration
|
||||
#Storage server
|
||||
#log4j.logger.io.moquette.spi.impl.subscriptions.SubscriptionsDirectorytory=DEBUG
|
||||
#log4j.logger.io.moquette.spi.impl.HawtDBStorageService=DEBUG
|
||||
|
||||
# stdout appender is set to be a ConsoleAppender.
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
#log4j.appender.stdout.Threshold=WARN
|
||||
#log4j.appender.stdout.Threshold=INFO
|
||||
#log4j.appender.stdout.Threshold=DEBUG
|
||||
log4j.appender.stdout.Threshold=TRACE
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
#log4j.appender.stdout.Threshold=TRACE
|
||||
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
#log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %M %L %x - %m%n
|
||||
|
||||
#file appender
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.Threshold=INFO
|
||||
log4j.appender.file.File=moquette.log
|
||||
log4j.appender.file.MaxFileSize=1MB
|
||||
log4j.appender.file.MaxBackupIndex=1
|
||||
log4j.appender.file.File=logs/wildfirechat.log
|
||||
log4j.appender.file.MaxFileSize=10MB
|
||||
log4j.appender.file.MaxBackupIndex=20
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
#log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
||||
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %M %L %x - %m%n
|
||||
|
||||
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
||||
|
||||
####################################
|
||||
# Message Logger Configuration #
|
||||
#####################################
|
||||
log4j.appender.messagelog=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.messagelog.Threshold=WARN
|
||||
log4j.appender.messagelog.File=moquette_messages.log
|
||||
log4j.appender.messagelog.File=logs/wildfirechat_messages.log
|
||||
log4j.appender.messagelog.MaxFileSize=100MB
|
||||
log4j.appender.messagelog.MaxBackupIndex=1
|
||||
log4j.appender.messagelog.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.messagelog.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
||||
|
||||
log4j.category.io.moquette.broker.metrics.MQTTMessageLogger=WARN, messagelog
|
||||
log4j.category.messageLogger=WARN, messagelog
|
||||
|
||||
|
||||
log4j.logger.cn.wildfirechat.push=INFO, push_log
|
||||
log4j.additivity.cn.wildfirechat.push=false
|
||||
log4j.appender.push_log=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.push_log.File=logs/push.log
|
||||
log4j.appender.push_log.Append=true
|
||||
log4j.appender.push_log.MaxFileSize=10MB
|
||||
log4j.appender.push_log.MaxBackupIndex=5
|
||||
log4j.appender.push_log.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.push_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
||||
log4j.appender.push_log.encoding=UTF-8
|
||||
|
||||
|
||||
log4j.logger.com.xiaoleilu.loServer=INFO, http_log
|
||||
log4j.additivity.com.xiaoleilu.loServer=false
|
||||
log4j.appender.http_log=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.http_log.File=logs/http.log
|
||||
log4j.appender.http_log.Append=true
|
||||
log4j.appender.http_log.MaxFileSize=10MB
|
||||
log4j.appender.http_log.MaxBackupIndex=5
|
||||
log4j.appender.http_log.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.http_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
||||
log4j.appender.http_log.encoding=UTF-8
|
||||
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
##############################################
|
||||
# Moquette configuration file.
|
||||
#
|
||||
# The synthax is equals to mosquitto.conf
|
||||
#
|
||||
##############################################
|
||||
|
||||
port 1883
|
||||
|
||||
websocket_port 8080
|
||||
|
||||
#*********************************************************************
|
||||
# Secure Websocket port (wss)
|
||||
# decommend this to enable wss
|
||||
#*********************************************************************
|
||||
# secure_websocket_port 8883
|
||||
|
||||
#*********************************************************************
|
||||
# SSL tcp part
|
||||
# ssl_provider: defines the SSL implementation to use, default to "JDK"
|
||||
# supported values are "JDK", "OPENSSL" and "OPENSSL_REFCNT"
|
||||
# By choosing one of the OpenSSL implementations the crypto
|
||||
# operations will be performed by a native Open SSL library.
|
||||
#
|
||||
# jks_path: define the file that contains the Java Key Store,
|
||||
# relative to the current broker home
|
||||
#
|
||||
# key_store_type: defines the key store container type, default to "jks"
|
||||
# supported values are "jceks", "jks" and "pkcs12"
|
||||
# The "jceks" and "jks" key stores are a propietary SUN
|
||||
# implementations. "pkcs12" is defined in PKCS#12 standard.
|
||||
#
|
||||
# key_store_password: is the password used to open the keystore
|
||||
#
|
||||
# key_manager_password: is the password used to manage the alias in the
|
||||
# keystore
|
||||
#*********************************************************************
|
||||
#ssl_provider JDK
|
||||
#ssl_port 8883
|
||||
#jks_path serverkeystore.jks
|
||||
#key_store_type jks
|
||||
#key_store_password passw0rdsrv
|
||||
#key_manager_password passw0rdsrv
|
||||
|
||||
#*********************************************************************
|
||||
# The interface to bind the server
|
||||
# 0.0.0.0 means "any"
|
||||
#*********************************************************************
|
||||
host 0.0.0.0
|
||||
|
||||
#*********************************************************************
|
||||
# The file for the persistent store, if not specified, use just memory
|
||||
# no physical persistence
|
||||
#*********************************************************************
|
||||
#persistent_store ./moquette_store.h2
|
||||
|
||||
#*********************************************************************
|
||||
# acl_file:
|
||||
# defines the path to the ACL file relative to moquette home dir
|
||||
# contained in the moquette.path system property
|
||||
#*********************************************************************
|
||||
#acl_file config/acl.conf
|
||||
|
||||
#*********************************************************************
|
||||
# allow_anonymous is used to accept MQTT connections also from not
|
||||
# authenticated clients.
|
||||
# - false to accept ONLY client connetions with credentials.
|
||||
# - true to accept client connection without credentails, validating
|
||||
# only against the password_file, the ones that provides.
|
||||
#*********************************************************************
|
||||
allow_anonymous true
|
||||
|
||||
#*********************************************************************
|
||||
# password_file:
|
||||
# defines the path to the file that contains the credentials for
|
||||
# authenticated client connection. It's relative to moquette home dir
|
||||
# defined by the system property moquette.path
|
||||
#*********************************************************************
|
||||
password_file config/password_file.conf
|
||||
|
||||
|
||||
#*********************************************************************
|
||||
# Optional Database Authentication
|
||||
#*********************************************************************
|
||||
# authenticator_class io.moquette.broker.security.DBAuthenticator
|
||||
# authenticator.db.driver org.postgresql.Driver
|
||||
# authenticator.db.url jdbc:postgresql://localhost/test?user=dbuser&password=dbpassword
|
||||
# authenticator.db.query SELECT PASSWORD FROM ACCOUNT WHERE LOGIN=?
|
||||
# authenticator.db.digest SHA-256
|
||||
|
||||
#*********************************************************************
|
||||
# Optional
|
||||
# authorizator_class:
|
||||
# class name of the authorizator, by default uses the
|
||||
# password_file.conf.
|
||||
# If not specified uses the class: AuthorizationsCollector
|
||||
#
|
||||
# Optional
|
||||
# authenticator_class:
|
||||
# class name of the authenticator, default implementation uses
|
||||
# definitions in the acl.conf.
|
||||
# If not specified uses FileAuthenticator
|
||||
# Optional
|
||||
# reauthorize_subscriptions_on_connect:
|
||||
# true to force the validation of authorizations of existing
|
||||
# subscriptions when the client reconnects with not clean session
|
||||
#*********************************************************************
|
||||
# authenticator_class [[path to your class>]]
|
||||
# authorizator_class [[path to your class>]]
|
||||
# reauthorize_subscriptions_on_connect true|false
|
||||
|
||||
|
||||
#*********************************************************************
|
||||
# Persistence configuration
|
||||
# autosave_interval:
|
||||
# interval between flushes of MapDB storage to disk. It's in
|
||||
# seconds, if not specified defaults is 30 s.
|
||||
#*********************************************************************
|
||||
# autosave_interval 120
|
||||
|
||||
#*********************************************************************
|
||||
# Netty Configuration
|
||||
#
|
||||
# netty.epoll: Linux systems can use epoll instead of nio. To get a performance
|
||||
# gain and reduced GC.
|
||||
# http://netty.io/wiki/native-transports.html for more information
|
||||
# netty.mqtt.message_size : by default the max size of message is set at 8092 bytes
|
||||
# http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180836
|
||||
# Fore more information about payload size specs.
|
||||
#*********************************************************************
|
||||
# netty.epoll true
|
||||
# netty.mqtt.message_size 8092
|
||||
|
||||
#*********************************************************************
|
||||
# Metrics Configuration
|
||||
#
|
||||
# use_metrics: used to enable Dropwizard Metrics sampling metrics.
|
||||
# metrics.librato.email: Librato account's email
|
||||
# metrics.librato.token: Librato account's security token
|
||||
# metrics.librato.source: your application as source in Librato
|
||||
# definitions
|
||||
#*********************************************************************
|
||||
# use_metrics true
|
||||
# metrics.librato.email [email protected]
|
||||
# metrics.librato.token sdfergheghliuhyr2283ehd9827398h
|
||||
# metrics.librato.source My Fantastic Service
|
||||
|
||||
#*********************************************************************
|
||||
# Error Monitoring
|
||||
#
|
||||
# use_bugsnag: used to enable BugSnag error handler catcher.
|
||||
# bugsnag.token: the token from your's bugsnag account
|
||||
#*********************************************************************
|
||||
# use_bugsnag false
|
||||
# bugsnag.token wleifb8723784dbfeig74
|
||||
@@ -1,6 +0,0 @@
|
||||
#*********************************************
|
||||
# Each line define a user login in the format
|
||||
# <username>:sha256(<password>)
|
||||
#*********************************************
|
||||
#NB this password is sha256(passwd)
|
||||
testuser:0d6be69b264717f2dd33652e212b173104b4a647b7c11ae72e9885f11cd312fb
|
||||
@@ -0,0 +1,55 @@
|
||||
# -- coding: utf-8 --
|
||||
|
||||
import time
|
||||
import hashlib
|
||||
import random
|
||||
import requests
|
||||
|
||||
|
||||
|
||||
# 签名方法说明
|
||||
# 注册用户需要签名,需要在header中加入nonce,timestamp, sign。
|
||||
# 值如下所示。
|
||||
# 服务器会检查时间戳,2个小时内有效。注意测试使用时避免过期
|
||||
# 请注意需要与wildfirechat.conf中的SECRET_KEY保持一致
|
||||
|
||||
#需要用到requests库,首先要安装pip
|
||||
#sudo easy_install pip
|
||||
|
||||
#然后在安装requests module
|
||||
#sudo pip install requests
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
print 'Usage: python register.py username password displayname'
|
||||
sys.exit()
|
||||
|
||||
user = sys.argv[1]
|
||||
pwd = sys.argv[2]
|
||||
displayname = sys.argv[3]
|
||||
|
||||
SECRET_KEY = '123456'
|
||||
URL = 'http://localhost:18080/admin/user/create'
|
||||
|
||||
ts = (int(round(time.time() * 1000)))
|
||||
random.seed(time.time())
|
||||
nonce = (int(round(random.random() * 100000)))
|
||||
orignSign = bytes(nonce) + '|' + SECRET_KEY + '|' + bytes(ts)
|
||||
sign = hashlib.sha1(orignSign).hexdigest()
|
||||
|
||||
headers = {'nonce': bytes(nonce), 'timestamp':bytes(ts), 'sign':sign, 'Content-Type':'application/json'}
|
||||
|
||||
payload = {'name':user, 'password':pwd, 'displayName':displayname}
|
||||
|
||||
print 'headers:'
|
||||
print headers
|
||||
print
|
||||
print 'payload:'
|
||||
print payload
|
||||
print
|
||||
|
||||
r = requests.post(URL, headers = headers, json = payload)
|
||||
print 'response:'
|
||||
print(r.status_code)
|
||||
print r.content
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
#*********************************************************************
|
||||
# Server configuration
|
||||
#*********************************************************************
|
||||
#服务器的接入IP。给客户端提供是${server.ip}和${http_port}。
|
||||
#客户端会从${http_port}端口获取到长链接端口。
|
||||
server.ip 0.0.0.0
|
||||
|
||||
##原生客户端长链接端口
|
||||
port 1883
|
||||
|
||||
##客户端短链接端口
|
||||
http_port 80
|
||||
|
||||
##WEB客户端长链接端口
|
||||
websocket_port 8083
|
||||
|
||||
#管理端口
|
||||
http.admin.port 18080
|
||||
|
||||
##节点ID,当集群部署时,一定不能有重复。
|
||||
node_id 1
|
||||
|
||||
##绑定IP,保持不变即可
|
||||
host 0.0.0.0
|
||||
|
||||
##本地绑定端口
|
||||
local_port 80
|
||||
|
||||
##是否使用内置DB。0使用mysql;1使用h2db
|
||||
embed.db 1
|
||||
|
||||
##服务器管理接口密钥
|
||||
http.admin.secret_key 123456
|
||||
|
||||
##客户端协议栈密钥,需要与客户端协议栈文件libemqq.cc文件中的aes_key值保持一致,16进制byte用逗号分割
|
||||
client.proto.secret_key 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F
|
||||
|
||||
#*********************************************************************
|
||||
# hazelcase configuration
|
||||
#*********************************************************************
|
||||
hazelcast.configuration config/hazelcast.xml
|
||||
|
||||
#*********************************************************************
|
||||
# Media server configuration
|
||||
#*********************************************************************
|
||||
##是否使用七牛云存储。1使用七牛;0使用内存文件服务器。
|
||||
media.server.use_qiniu 0
|
||||
|
||||
##媒体类型分类
|
||||
#Media_Type_GENERAL = 0,
|
||||
#Media_Type_IMAGE = 1,
|
||||
#Media_Type_VOICE = 2,
|
||||
#Media_Type_VIDEO = 3,
|
||||
#Media_Type_FILE = 4,
|
||||
#Media_Type_PORTRAIT = 5,
|
||||
#Media_Type_FAVORITE = 6
|
||||
|
||||
# qiniu media server configuration
|
||||
qiniu.server_url http://up.qbox.me
|
||||
qiniu.access_key tU3vdBK5BL5j4N7jI5N5uZgq_HQDo170w5C9Amnn
|
||||
qiniu.secret_key YfQIJdgp5YGhwEw14vGpaD2HJZsuJldWtqens7i5
|
||||
qiniu.bucket_general_name media
|
||||
qiniu.bucket_general_domain http://cdn.wildfirechat.cn
|
||||
qiniu.bucket_image_name media
|
||||
qiniu.bucket_image_domain http://cdn.wildfirechat.cn
|
||||
qiniu.bucket_voice_name media
|
||||
qiniu.bucket_voice_domain http://cdn.wildfirechat.cn
|
||||
qiniu.bucket_video_name media
|
||||
qiniu.bucket_video_domain http://cdn.wildfirechat.cn
|
||||
qiniu.bucket_file_name media
|
||||
qiniu.bucket_file_domain http://cdn.wildfirechat.cn
|
||||
qiniu.bucket_portrait_name storage
|
||||
qiniu.bucket_portrait_domain http://cdn2.wildfirechat.cn
|
||||
qiniu.bucket_favorite_name storage
|
||||
qiniu.bucket_favorite_domain http://cdn2.wildfirechat.cn
|
||||
|
||||
|
||||
# local media server configuration
|
||||
# 本地媒体服务器配置。
|
||||
local.media.storage.root ./media
|
||||
|
||||
#*********************************************************************
|
||||
# Push server configuration
|
||||
#*********************************************************************
|
||||
##安卓推送服务器地址
|
||||
push.android.server.address http://localhost:8085/android/push
|
||||
##苹果推送服务器地址
|
||||
push.ios.server.address http://localhost:8085/ios/push
|
||||
|
||||
|
||||
#*********************************************************************
|
||||
# Netty Configuration
|
||||
#
|
||||
# Linux systems can use epoll instead of nio. To get a performance
|
||||
# gain and reduced GC.
|
||||
# http://netty.io/wiki/native-transports.html for more information
|
||||
#*********************************************************************
|
||||
# 如果是linux系统,一定要打开下面这个参数,能大幅度提高性能
|
||||
#netty.epoll true
|
||||
|
||||
#*********************************************************************
|
||||
# Sensitive configuration
|
||||
#*********************************************************************
|
||||
##文本敏感词过滤处理方法,0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***
|
||||
sensitive.filter.type 0
|
||||
|
||||
#*********************************************************************
|
||||
# Message forward configuration
|
||||
#*********************************************************************
|
||||
##消息转发地址
|
||||
#message.forward.url http://localhost:8087/message/forward
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PRG="$0"
|
||||
|
||||
while [ -h "$PRG" ]; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
cd ..
|
||||
WILDFIRECHAT_HOME=`pwd`
|
||||
|
||||
|
||||
export WILDFIRECHAT_HOME
|
||||
|
||||
if [ -f "${JAVA_HOME}/bin/java" ]; then
|
||||
JAVA=${JAVA_HOME}/bin/java
|
||||
else
|
||||
JAVA=java
|
||||
fi
|
||||
export JAVA
|
||||
|
||||
|
||||
WILDFIRECHAT_PATH=$WILDFIRECHAT_HOME/
|
||||
|
||||
|
||||
$JAVA -cp "$WILDFIRECHAT_HOME/lib/*" cn.wildfirechat.server.MechineCode $1 $2
|
||||
@@ -1,88 +0,0 @@
|
||||
@ECHO OFF
|
||||
rem #
|
||||
rem # Copyright (c) 2012-2015 Andrea Selva
|
||||
rem #
|
||||
|
||||
echo " "
|
||||
echo " ___ ___ _ _ ___ ________ _____ _____ "
|
||||
echo " | \/ | | | | | | \/ | _ |_ _|_ _| "
|
||||
echo " | . . | ___ __ _ _ _ ___| |_| |_ ___ | . . | | | | | | | | "
|
||||
echo " | |\/| |/ _ \ / _\ | | | |/ _ \ __| __/ _ \ | |\/| | | | | | | | | "
|
||||
echo " | | | | (_) | (_| | |_| | __/ |_| || __/ | | | \ \/' / | | | | "
|
||||
echo " \_| |_/\___/ \__, |\__,_|\___|\__|\__\___| \_| |_/\_/\_\ \_/ \_/ "
|
||||
echo " | | "
|
||||
echo " |_| "
|
||||
echo " "
|
||||
echo " version: 0.12.1 "
|
||||
|
||||
set "CURRENT_DIR=%cd%"
|
||||
if not "%MOQUETTE_HOME%" == "" goto gotHome
|
||||
set "MOQUETTE_HOME=%CURRENT_DIR%"
|
||||
if exist "%MOQUETTE_HOME%\bin\moquette.bat" goto okHome
|
||||
cd ..
|
||||
set "MOQUETTE_HOME=%cd%"
|
||||
cd "%CURRENT_DIR%"
|
||||
:gotHome
|
||||
if exist "%MOQUETTE_HOME%\bin\moquette.bat" goto okHome
|
||||
echo The MOQUETTE_HOME environment variable is not defined correctly
|
||||
echo This environment variable is needed to run this program
|
||||
goto end
|
||||
:okHome
|
||||
|
||||
rem Set JavaHome if it exists
|
||||
if exist { "%JAVA_HOME%\bin\java" } (
|
||||
set "JAVA="%JAVA_HOME%\bin\java"
|
||||
)
|
||||
|
||||
echo Using JAVA_HOME: "%JAVA_HOME%"
|
||||
echo Using MOQUETTE_HOME: "%MOQUETTE_HOME%"
|
||||
|
||||
rem set LOG_CONSOLE_LEVEL=info
|
||||
rem set LOG_FILE_LEVEL=fine
|
||||
set JAVA_OPTS=
|
||||
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true
|
||||
set MOQUETTE_PATH=%MOQUETTE_HOME%
|
||||
set LOG_FILE=%MOQUETTE_HOME%\config\moquette-log.properties
|
||||
|
||||
rem # Use the Hotspot garbage-first collector.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseG1GC
|
||||
|
||||
rem # Have the JVM do less remembered set work during STW, instead
|
||||
rem # preferring concurrent GC. Reduces p99.9 latency.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:G1RSetUpdatingPauseTimePercent=5
|
||||
|
||||
rem # Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
|
||||
rem # 200ms is the JVM default and lowest viable setting
|
||||
rem # 1000ms increases throughput. Keep it smaller than the timeouts.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxGCPauseMillis=500
|
||||
|
||||
rem # Optional G1 Settings
|
||||
|
||||
rem Save CPU time on large (>= 16GB) heaps by delaying region scanning
|
||||
rem until the heap is 70% full. The default in Hotspot 8u40 is 40%.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:InitiatingHeapOccupancyPercent=70
|
||||
|
||||
rem For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
|
||||
rem Otherwise equal to the number of cores when 8 or less.
|
||||
rem Machines with > 10 cores should try setting these to <= full cores.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:ParallelGCThreads=16
|
||||
|
||||
rem By default, ConcGCThreads is 1/4 of ParallelGCThreads.
|
||||
rem Setting both to the same value can reduce STW durations.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:ConcGCThreads=16
|
||||
|
||||
rem ## GC logging options -- uncomment to enable
|
||||
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintHeapAtGC
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintPromotionFailure
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:PrintFLSStatistics=1
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -Xloggc:/var/log/moquette/gc.log
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseGCLogFileRotation
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:NumberOfGCLogFiles=10
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M"
|
||||
|
||||
%JAVA% -server %JAVA_OPTS% %JAVA_OPTS_SCRIPT% -Dlog4j.configuration=file:%LOG_FILE% -Dmoquette.path=%MOQUETTE_PATH% -cp %MOQUETTE_HOME%\lib\* io.moquette.broker.Server
|
||||
@@ -0,0 +1,74 @@
|
||||
@ECHO OFF
|
||||
|
||||
set "CURRENT_DIR=%cd%"
|
||||
if not "%WILDFIRECHAT_HOME%" == "" goto gotHome
|
||||
set "WILDFIRECHAT_HOME=%CURRENT_DIR%"
|
||||
if exist "%WILDFIRECHAT_HOME%\bin\wildfirechat.bat" goto okHome
|
||||
cd ..
|
||||
set "WILDFIRECHAT_HOME=%cd%"
|
||||
cd "%CURRENT_DIR%"
|
||||
:gotHome
|
||||
if exist "%WILDFIRECHAT_HOME%\bin\wildfirechat.bat" goto okHome
|
||||
echo The WILDFIRECHAT_HOME environment variable is not defined correctly
|
||||
echo This environment variable is needed to run this program
|
||||
goto end
|
||||
:okHome
|
||||
|
||||
rem Set JavaHome if it exists
|
||||
if exist { "%JAVA_HOME%\bin\java" } (
|
||||
set "JAVA="%JAVA_HOME%\bin\java""
|
||||
) else {
|
||||
set "JAVA="java""
|
||||
}
|
||||
|
||||
echo Using JAVA_HOME: "%JAVA_HOME%"
|
||||
echo Using WILDFIRECHAT_HOME: "%WILDFIRECHAT_HOME%"
|
||||
|
||||
rem set LOG_CONSOLE_LEVEL=info
|
||||
rem set LOG_FILE_LEVEL=fine
|
||||
set JAVA_OPTS=
|
||||
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true
|
||||
set WILDFIRECHAT_PATH=%WILDFIRECHAT_HOME%
|
||||
set LOG_FILE=%WILDFIRECHAT_HOME%\config\log4j.properties
|
||||
|
||||
rem Use the Hotspot garbage-first collector.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseG1GC
|
||||
|
||||
rem Have the JVM do less remembered set work during STW, instead
|
||||
rem preferring concurrent GC. Reduces p99.9 latency.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:G1RSetUpdatingPauseTimePercent=5
|
||||
|
||||
rem Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
|
||||
rem 200ms is the JVM default and lowest viable setting
|
||||
rem 1000ms increases throughput. Keep it smaller than the timeouts.
|
||||
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxGCPauseMillis=500
|
||||
|
||||
rem Optional G1 Settings
|
||||
|
||||
rem Save CPU time on large (>= 16GB) heaps by delaying region scanning
|
||||
rem until the heap is 70% full. The default in Hotspot 8u40 is 40%.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:InitiatingHeapOccupancyPercent=70
|
||||
|
||||
rem For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
|
||||
rem Otherwise equal to the number of cores when 8 or less.
|
||||
rem Machines with > 10 cores should try setting these to <= full cores.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:ParallelGCThreads=16
|
||||
|
||||
rem By default, ConcGCThreads is 1/4 of ParallelGCThreads.
|
||||
rem Setting both to the same value can reduce STW durations.
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:ConcGCThreads=16
|
||||
|
||||
rem rem GC logging options -- uncomment to enable
|
||||
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintHeapAtGC
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintPromotionFailure
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:PrintFLSStatistics=1
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:+UseGCLogFileRotation
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:NumberOfGCLogFiles=10
|
||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M"
|
||||
|
||||
%JAVA% -server %JAVA_OPTS% %JAVA_OPTS_SCRIPT% -Dlog4j.configuration=file:%LOG_FILE% -Dwildfirechat.path=%WILDFIRECHAT_PATH% -cp %WILDFIRECHAT_HOME%\lib\* cn.wildfirechat.server.Server
|
||||
Regular → Executable
+17
-27
@@ -1,20 +1,4 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012-2015 Andrea Selva
|
||||
#
|
||||
|
||||
echo " "
|
||||
echo " ___ ___ _ _ ___ ________ _____ _____ "
|
||||
echo " | \/ | | | | | | \/ | _ |_ _|_ _| "
|
||||
echo " | . . | ___ __ _ _ _ ___| |_| |_ ___ | . . | | | | | | | | "
|
||||
echo " | |\/| |/ _ \ / _\ | | | |/ _ \ __| __/ _ \ | |\/| | | | | | | | | "
|
||||
echo " | | | | (_) | (_| | |_| | __/ |_| || __/ | | | \ \/' / | | | | "
|
||||
echo " \_| |_/\___/ \__, |\__,_|\___|\__|\__\___| \_| |_/\_/\_\ \_/ \_/ "
|
||||
echo " | | "
|
||||
echo " |_| "
|
||||
echo " "
|
||||
echo " version: 0.12.1 "
|
||||
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
@@ -31,23 +15,27 @@ while [ -h "$PRG" ]; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Get standard environment variables
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
cd ..
|
||||
WILDFIRECHAT_HOME=`pwd`
|
||||
|
||||
# Only set MOQUETTE_HOME if not already set
|
||||
[ -f "$MOQUETTE_HOME"/bin/moquette.sh ] || MOQUETTE_HOME=`cd "$PRGDIR/.." ; pwd`
|
||||
export MOQUETTE_HOME
|
||||
|
||||
# Set JavaHome if it exists
|
||||
if [ -f "${JAVA_HOME}/bin/java" ]; then
|
||||
export WILDFIRECHAT_HOME
|
||||
|
||||
echo $WILDFIRECHAT_HOME
|
||||
|
||||
if [ -f "${JAVA_HOME}/bin/java" ]; then
|
||||
JAVA=${JAVA_HOME}/bin/java
|
||||
else
|
||||
JAVA=java
|
||||
fi
|
||||
export JAVA
|
||||
|
||||
LOG_FILE=$MOQUETTE_HOME/config/moquette-log.properties
|
||||
MOQUETTE_PATH=$MOQUETTE_HOME/
|
||||
LOG_FILE=$WILDFIRECHAT_HOME/config/log4j.properties
|
||||
HZ_CONF_FILE=$WILDFIRECHAT_HOME/config/hazelcast.xml
|
||||
C3P0_CONF_FILE=$WILDFIRECHAT_HOME/config/c3p0-config.xml
|
||||
|
||||
WILDFIRECHAT_PATH=$WILDFIRECHAT_HOME/
|
||||
#LOG_CONSOLE_LEVEL=info
|
||||
#LOG_FILE_LEVEL=fine
|
||||
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true"
|
||||
@@ -88,10 +76,12 @@ JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution"
|
||||
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
|
||||
JAVA_OPTS="$JAVA_OPTS -XX:+PrintPromotionFailure"
|
||||
#JAVA_OPTS="$JAVA_OPTS -XX:PrintFLSStatistics=1"
|
||||
#JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/moquette/gc.log"
|
||||
JAVA_OPTS="$JAVA_OPTS -Xloggc:$MOQUETTE_HOME/gc.log"
|
||||
JAVA_OPTS="$JAVA_OPTS -XX:+UseGCLogFileRotation"
|
||||
JAVA_OPTS="$JAVA_OPTS -XX:NumberOfGCLogFiles=10"
|
||||
JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M"
|
||||
|
||||
$JAVA -server $JAVA_OPTS $JAVA_OPTS_SCRIPT -Dlog4j.configuration="file:$LOG_FILE" -Dmoquette.path="$MOQUETTE_PATH" -cp "$MOQUETTE_HOME/lib/*" io.moquette.broker.Server
|
||||
|
||||
JAVA_OPTS="$JAVA_OPTS -Xmx128M"
|
||||
JAVA_OPTS="$JAVA_OPTS -Xms128M"
|
||||
|
||||
$JAVA -server $JAVA_OPTS $JAVA_OPTS_SCRIPT -Dlog4j.configuration="file:$LOG_FILE" -Dcom.mchange.v2.c3p0.cfg.xml="$C3P0_CONF_FILE" -Dhazelcast.configuration="file:$HZ_CONF_FILE" -Dwildfirechat.path="$WILDFIRECHAT_PATH" -cp "$WILDFIRECHAT_HOME/lib/*" cn.wildfirechat.server.Server
|
||||
Reference in New Issue
Block a user