Skip to content

Commit 2e11222

Browse files
committed
added assembly
1 parent 8dbea61 commit 2e11222

9 files changed

Lines changed: 116 additions & 53 deletions

File tree

README.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,25 @@ Make sure you have Maven3, JDK 7 (with JCE Unlimited Strength Policy Jurisdictio
1919

2020
cd supernode
2121

22-
mvn package
23-
24-
Let us assume the directory you would want to run the server is /home/bitsofproof/run.
25-
26-
cp server/target/bitsofproof-server-version-shaded.jar /home/bitsofproof/run
27-
28-
cp server/src/main/resources/context/*.xml /home/bitsofproof/run
29-
30-
cp server/src/main/resources/log4j.properties /home/bitsofproof/run
31-
32-
mkdir /home/bitsofproof/run/signed-libs
33-
34-
Download http://www.bouncycastle.org/download/bcprov-jdk15on-150.jar
35-
36-
cp bcprov-jdk15on-150.jar /home/bitsofproof/run/signed-libs/bcprov-jdk15on.jar
22+
mvn assembly:assembly
23+
24+
The build will create a zip file in the target directory.
3725

3826
Run
3927
---
40-
cd /home/bitsofproof/run
41-
42-
java -server -Xmx4g -jar target/server/target/bitsofproof-server-version-shaded.jar testnet3 memdb
28+
29+
copy and unzip the distribution zip created in the previous step and cd to it.
30+
31+
java -Xmx4g -jar bitsofproof-server-version-shaded.jar testnet3 memdb
4332

4433
The final two parameters of the above example command line identify configuration contexts you copied under *-profile.xml. You have to choose one of the networks by specifying either testnet3 or production or slave, and a database layer, that could be (examples):
4534

4635
* memdb - in memory database for tests
4736
* leveldb - LevelDB
4837

49-
To use the API of your local server you need to run a message broker process providing the infrastructure. Since the message bus offers authentication and a wide selection of transports, your installation will likely be unique and need to be reflected in BCSAPI-profile.xml. You find example configurations for the message Active MQ there. The complete command line for a production environment might be:
38+
To use the API of your local server you need to run a message broker process providing the infrastructure. Since the message bus offers authentication and a wide selection of transports, your installation will likely be unique and need to be reflected in BCSAPI-profile.xml. You find example configurations for the message Active MQ there. The complete command line for a production environment might be (assuming you run it as a slave behind a satoshi):
5039

51-
java -server -Xmx4g -jar target/server/target/bitsofproof-server-version-shaded.jar production leveldb BCSAPI activemq
40+
java -server -Xmx4g -jar bitsofproof-server-version-shaded.jar slave leveldb BCSAPI activemq
5241

5342
License
5443
-------

assembly/bcprov-jdk15on.jar

2.61 MB
Binary file not shown.

assembly/distribution.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<assembly
2+
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.4"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.4 http://maven.apache.org/xsd/assembly-2.4.xsd">
5+
<id>distribution</id>
6+
<formats>
7+
<format>zip</format>
8+
</formats>
9+
<fileSets>
10+
<fileSet>
11+
<directory>server/src/main/resources/context</directory>
12+
<includes>
13+
<include>*.xml</include>
14+
</includes>
15+
<outputDirectory>/config</outputDirectory>
16+
</fileSet>
17+
</fileSets>
18+
<files>
19+
<file>
20+
<source>assembly/bcprov-jdk15on.jar</source>
21+
<outputDirectory>lib-signed</outputDirectory>
22+
<filtered>false</filtered>
23+
</file>
24+
<file>
25+
<source>server/target/bitsofproof-server-${project.version}-shaded.jar
26+
</source>
27+
<outputDirectory>/</outputDirectory>
28+
<filtered>false</filtered>
29+
</file>
30+
<file>
31+
<source>assembly/log4j.properties</source>
32+
<outputDirectory>/config</outputDirectory>
33+
<filtered>true</filtered>
34+
</file>
35+
<file>
36+
<source>README.md</source>
37+
<outputDirectory>/</outputDirectory>
38+
<filtered>true</filtered>
39+
</file>
40+
<file>
41+
<source>NOTICE</source>
42+
<outputDirectory>/</outputDirectory>
43+
<filtered>true</filtered>
44+
</file>
45+
<file>
46+
<source>LICENSE</source>
47+
<outputDirectory>/</outputDirectory>
48+
<filtered>true</filtered>
49+
</file>
50+
</files>
51+
</assembly>

assembly/log4j.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
log4j.rootCategory=WARN, console, file
2+
log4j.logger.com.bitsofproof.supernode=DEBUG
3+
log4j.appender.console.Threshold = INFO
4+
log4j.appender.console = org.apache.log4j.ConsoleAppender
5+
log4j.appender.console.layout = org.apache.log4j.PatternLayout
6+
log4j.appender.console.layout.ConversionPattern = %d [%p] %c{1} %t %m%n
7+
log4j.appender.file = org.apache.log4j.RollingFileAppender
8+
log4j.appender.file.file = logs/bop-server.log
9+
log4j.appender.file.MaxFileSize=100MB
10+
log4j.appender.file.MaxBackupIndex=10
11+
log4j.appender.file.layout = org.apache.log4j.PatternLayout
12+
log4j.appender.file.layout.ConversionPattern = %d [%p] %c{1} %t %m%n

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@
103103
<tagNameFormat>@{project.version}</tagNameFormat>
104104
</configuration>
105105
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-assembly-plugin</artifactId>
109+
<version>2.4</version>
110+
<configuration>
111+
<descriptors>
112+
<descriptor>assembly/distribution.xml</descriptor>
113+
</descriptors>
114+
</configuration>
115+
</plugin>
106116
</plugins>
107117
<extensions>
108118
<extension>

server/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151
<exclude>META-INF/*.SF</exclude>
152152
<exclude>META-INF/*.DSA</exclude>
153153
<exclude>META-INF/*.RSA</exclude>
154+
<exclude>context/*.xml</exclude>
155+
<exclude>log4j.properties</exclude>
154156
</excludes>
155157
</filter>
156158
</filters>

server/src/main/java/com/bitsofproof/supernode/main/Main.java

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.bitsofproof.supernode.main;
1717

18+
import java.io.FileNotFoundException;
1819
import java.security.Security;
1920
import java.util.ArrayList;
2021
import java.util.List;
@@ -23,6 +24,7 @@
2324
import org.slf4j.Logger;
2425
import org.slf4j.LoggerFactory;
2526
import org.springframework.context.support.GenericXmlApplicationContext;
27+
import org.springframework.util.Log4jConfigurer;
2628

2729
public class Main
2830
{
@@ -31,22 +33,34 @@ protected interface App
3133
public void start (String[] args) throws Exception;
3234
}
3335

36+
static
37+
{
38+
try
39+
{
40+
Log4jConfigurer.initLogging ("config/log4j.properties");
41+
}
42+
catch ( FileNotFoundException e )
43+
{
44+
System.err.println ("Can not find config/log4.properties");
45+
}
46+
}
47+
3448
private static final Logger log = LoggerFactory.getLogger (Main.class);
3549

3650
public static void main (String[] args) throws Exception
3751
{
3852
log.info ("bitsofproof supernode (c) 2013-2014 bits of proof zrt.");
39-
Security.addProvider (new BouncyCastleProvider ());
40-
log.trace ("Spring context setup");
41-
42-
if ( args.length == 0 )
43-
{
44-
System.err.println ("Usage: java com.bitsofproof.main.Main profile [profile...] -- [args...] [options...]");
45-
return;
46-
}
47-
4853
try
4954
{
55+
Security.addProvider (new BouncyCastleProvider ());
56+
57+
if ( args.length == 0 )
58+
{
59+
System.err.println ("Usage: java -Xmx4g -jar this.jar profile [profile...] -- [args...] [options...]");
60+
System.err.println (" where profile A is any of config/A-profile.xml");
61+
return;
62+
}
63+
5064
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext ();
5165
List<String> a = new ArrayList<String> ();
5266
boolean profiles = true;
@@ -69,14 +83,15 @@ public static void main (String[] args) throws Exception
6983
}
7084
}
7185
}
72-
ctx.load ("file:server.xml");
73-
ctx.load ("file:*-profile.xml");
86+
ctx.load ("file:config/server.xml");
87+
ctx.load ("file:config/*-profile.xml");
7488
ctx.refresh ();
7589
ctx.getBean (App.class).start (a.toArray (new String[0]));
90+
ctx.close ();
7691
}
7792
catch ( Exception e )
7893
{
79-
log.error ("Error setting up spring context", e);
94+
log.error ("Bootstrap error", e);
8095
}
8196
}
8297
}

server/src/main/resources/context/server.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
1010

1111
<context:property-placeholder />
12-
<bean id="log4jInitializer"
13-
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
14-
<property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
15-
<property name="targetMethod" value="initLogging" />
16-
<property name="arguments">
17-
<list>
18-
<value>log4j.properties</value>
19-
</list>
20-
</property>
21-
</bean>
2212

2313
<context:component-scan base-package="com.bitsofproof.supernode" />
2414

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
log4j.rootCategory=WARN, S, F
1+
log4j.rootCategory=WARN, console
22
log4j.logger.com.bitsofproof.supernode=DEBUG
3-
log4j.appender.S = org.apache.log4j.ConsoleAppender
4-
log4j.appender.S.layout = org.apache.log4j.PatternLayout
5-
log4j.appender.S.layout.ConversionPattern = %d [%p] %c{1} %t %m%n
6-
log4j.appender.S.Threshold = INFO
7-
log4j.appender.F = org.apache.log4j.RollingFileAppender
8-
log4j.appender.F.file = logs/bop-server.log
9-
log4j.appender.F.MaxFileSize=100MB
10-
log4j.appender.F.MaxBackupIndex=10
11-
log4j.appender.F.layout = org.apache.log4j.PatternLayout
12-
log4j.appender.F.layout.ConversionPattern = %d [%p] %c{1} %t %m%n
3+
log4j.appender.console = org.apache.log4j.ConsoleAppender
4+
log4j.appender.console.layout = org.apache.log4j.PatternLayout
5+
log4j.appender.console.layout.ConversionPattern = %d [%p] %c{1} %t %m%n
6+

0 commit comments

Comments
 (0)